Fix Ubuntu issues in VMware using Live CD

Fix Ubuntu issues in VMware using Live CD

If you’re running Ubuntu VMs in VMware, you may have come across situations where you need to address issues using a Linux live CD/DVD.

Some of the scenarios you may have faced are:

1. Ubuntu VM not booting due to grub issues
2. Ubuntu VM has automatically set grub password after upgrade
3. Ubuntu VM has LVM partition and needs fixing
4. You want to remove grub password

If you  already have a Live CD/DVD in VMware, skip to Section 2

Section 1: Uploading Ubuntu ISO in vCenter datastore


– R/W access to Vcenter web interface
– VMs should have internet connectivity
– Access to Windows VMs or ability to create one

Create a Windows VM

  • Since Vcenter web client integration plugin only works with Windows/Mac, we will have to create a Windows VM
  • Create a temporary Windows VM in the same region/datacenter where you want the ISO file to upload (this enables much faster data transfer rates than uploading directly from your pc to datastore )
  • Install Firefox ESR, not the standard Firefox
  • Install Flash
  • Install VMware client integration plugin
  • Restart Firefox
  • Go to Ubuntu Website and Download the latest Ubuntu live CD/DVD
  • Login to VMware’s Vsphere Web Client
  • Once you’re logged into Vcenter web client, go to Storage section from the Home screen.

  • There must be atleast 2GB free space in the datastore
  • Right click on the datastore and select Browse Files
  • Find a folder in VMware datastore to upload the ISO file.
  • Click on the cylinder icon to upload the ISO file into the datastore
  • Once you have successfully uploaded the ISO file, delete the temporary VM

Section 2: Boot into Live CD

  • Go to the VM in question. Click on Edit settings, and Go to CD/DVD section
  • Select the Ubuntu ISO file you uploaded previously from the correct datastore

  • Set it to “Connect At Power ON”
  • In the next tab, set the VM to force BIOS entry on boot.
  • Once the VM is switched on, the BIOS will appear. Make necessary changes to boot from CD ROM fist and reboot
  • This will make the VM boot from the ISO file
  • Select “Try Ubuntu” on the next screen and then wait for the desktop to appear


Section 3: Fixing Ubuntu issues

  • Open Terminal and check the disk for partition
    $ sudo su -
    # fdisk -l
  • Make a note of the Ubuntu LVM disks . /boot partition of a Linux VM using LVM always is mounted outside LVM. So, it will be usually /dev/sda1
    # mount -o rw /dev/ubuntu-vg/root /mnt
  • If /var and /usr are mounted separately in LVM, you should also mount them. Else the grub recovery will not work
    # mount -o rw /dev/ubuntu-vg/var /mnt/var
    # mount -o rw /dev/ubuntu-vg/usr /mnt/usr
    # mount -o rw /dev/sda1 /mnt/boot
    # mount -o bind /proc /mnt/proc
    # mount -o bind /sys /mnt/sys
    # mount -o bind /dev /mnt/dev
  • Copy the grub file from the live CD/DVD to the disk
    # cp /etc/default/grub /mnt/etc/default/
  • Now, chroot into the /mnt
    # chroot /mnt
  • Start lvmetad
    # /etc/init.d/lvm2-lvmetad start

Fix/Remove GRUB Password

In Ubuntu 16.04, go to /etc/grub.d/10_linux and go to line 132, add the word –unrestricted before ${CLASS}.


echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"


echo "menuentry '$(echo "$os" | grub_quote)' --unrestricted ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"

Then, update GRUB
# update-grub

Repair/Recover GRUB steps

  • Check which grub package is installed in the VM. There are multiple grub packages so check for the correct one.
    # dpkg -l grub*
  • The listing with ii beside it and the file name means the file is installed. So, reinstall that file. In my case it was grub-pc .
    # apt-get install --reinstall grub-pc
    # grub-install /dev/sda
    Installing for i386-pc platform.
    Installation finished. No error reported.
  • Create GRUB2 menu with grub-mkconfig
    # grub-mkconfig -o /boot/grub/grub.cfg

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-42-generic
Found initrd image: /boot/initrd.img-4.4.0-42-generic

  • Once done,  unmount all the paths which were mounted
    # exit
    # umount /mnt/proc /mnt/sys /mnt/var /mnt/usr
    # umount /mnt/dev
    # umount /mnt
  • Power off the VM using init 0 command
  • Uncheck the option to connect CD/DVD at Power On

  • Then Power On the VM. You should have your Ubuntu VM back


Sayantan Das

Sayantan is a DevOps Consultant by the day and works mainly with Ansible and Linux . He is a AWS - SA and RedHat Certified Engineer . He loves to tinker with Linux systems .

Leave a Reply

Close Menu
%d bloggers like this: