TOPICS
Guides

Rescue a VM that's not Booting

First, boot to rescue mode by selecting the VM, and pressing Rescue. Rescue mode will offer to use either an Ubuntu Rescue Image or the VM's initial disk state. In this guide, we'll assume you're using the Ubuntu Rescue Image.

After the VM status changes from Online to Rescue, press VNC to open the VNC console. After the VM finishes booting to rescue mode, you'll be able to login with username and password both "rescue".

Your VM data will be exposed to the rescue image as a separate disk. Use fdisk -l to list the disks.

$ fdisk -l

Disk /dev/vda: 10.7 GB, 10737418240 bytes
4 heads, 32 sectors/track, 163840 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000afd1c

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    20971519    10484736   83  Linux

Disk /dev/vdb: 21.5 GB, 21474836480 bytes
3 heads, 1 sectors/track, 13981013 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3fb3835a

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1   *        2048    41943006    20970479+  83  Linux

Above, /dev/vda is the rescue image disk, and /dev/vdb contains your VM data. Let's mount the VM data to /mnt:

$ mount /dev/vda1 /mnt

Now, we can chroot into the mountpoint and do whatever is needed to fix the boot issue:

$ mount -t proc /proc /mnt/proc
$ mount -t sysfs /sys /mnt/sys
$ mount -o bind /dev /mnt/dev
$ chroot /mnt

After you're done, exit the chroot and run umount /mnt. Then, press Unrescue to boot to the local disk.