VMware ESXi 5.0 recovery from passthru boot device

I accidentally did a passthru of my boot device to a vm. This is a real gotcha because then the Host cannot modify the config.

Disclaimer – this could completely hose your system, proceed ONLY if you know what you are doing (or have nothing to lose).

So I had to do a little digging and found the following very helpful articles for ESXi 4:

However there are a couple of additional notes that I need to add because things were a little different.

I found & mounted the following partitions in my client vm (CentOS):
/dev/sdc1 – this was /boot
/dev/sdc5 – this might be the baseline config directory, not 100% sure
/dev/sdc6 – this was the config directory
/dev/sdc8 – this was /var/db stuff

local.tgz is actually inside state.tgz

So here is what I did to recover

mount /dev/sdc6 /mnt/c6
mkdir ~/working
cd ~/working
tar xvzf /mnt/c6/state.tgz
tar xvzf local.tgz
cd etc/vmware
grep passthru esx.conf 
vi esx.conf
   - from: /device/000:000:26.0/owner = "passthru"
   - to:   /device/000:000:26.0/owner = "vmkernel"
cd ../..
tar cvzf local.tgz etc
tar /mnt/c6/state.tgz local.tgz

After that I shutdown the VM & rebooted.

The system came back up, I had a little clean up & documentation to do, but it was recovered.

RHEL 6 Login Display messed up VMware Fusion

I had the problem with my login display on RHEL 6 being wrong. I could not see any of the additional buttons on screen (ie I couldn’t shut down the VM without logging in).

Fixing this was more of a problem than it should have been. Finally found a bug report to Red Hat:

Thanks to Daryl Herzmann for his solution/hack:

  1. Change gdm’s login shell from /sbin/nologin to /bin/bash
  2. Set some password for gdm
  3. Log into GDM as user gdm (sick, hehe)
  4. Run System Preferences -> Display tool to setup mirroring
  5. Log out
  6. Set gdm’s login shell back to /sbin/nologin
  7. (my addition) lock gdm’s account in shadow by replacing password hash with !!

VMware ESXi 5.0 Update from CLI

the update command:
esxcli software vib install --maintenance-mode --depot \

dealing with maintenance mode from the command line:

vim-cmd /hostsvc/maintenance_mode_enter
vim-cmd /hostsvc/maintenance_mode_exit
vim-cmd /hostsvc/hostsummary | grep inMaintenanceMode

Release a VMware Virtual Machine Created by VMware Fusion

On the VM (Linux)

  1. Test Everything
  2. Review configurations
  3. Clean up – get rid of everything that you don’t need (for RPM based Linux):  du -sh /home/*;  ls -lh /tmp; yum clean all; find . -type f -size +100M -exec ls -lh {} \;
  4. Zero the drive space — on linux: cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill

In VMware Fusion (Mac)

  1. Open the Settings UI for the Virtual machine, select the hard drive & click Clean Up Disk
  2. Select the VM in Virtual Machine Library; under select Virtual Machine -> Downgrade Virtual Machine
  3. Copy the vmx & vmdk files

On the Machine with VMware Converter

  1. # vmware-converter-client
  2. Click Convert Machine
  3. Set Source-Type: VMware Workstation or Other VMware virtual machine
  4. Select the vmx file 
  5. Click next
  6. Set Destination Type: Virtual appliance
  7. Enter the VM Name
  8. Enter the Directory to save the new virtual appliance
  9. Set the Distribution Format: Single File (*.ova)
  10. Click next
  11. Edit the Product Information and other text
  12. Click next
  13. Review
  14. Click Finish
  15. Copy ova file

On other VMware machines

  1. Test ova file