Rescuing a failed VM install with guestfish

After spending 3 hours watching a Fedora 10 install yesterday, it crashed at the very end. The VM wouldn’t even boot – it hadn’t installed grub.

I used guestfish to attempt a rescue, installing grub manually, and editing the root password in /etc/passwd so I could log in.

# guestfish -a /dev/Guests/F10x32 -m /dev/VolGroup00/LogVol00 -m /dev/sda1:/boot
><fs> ll /boot/
total 7294
drwxr-xr-x  5 root root    1024 May 10 18:15 .
drwxr-xr-x 21 root root    4096 May 10 16:48 ..
-rw-r--r--  1 root root 1089949 Nov 18 12:30 System.map-2.6.27.5-117.fc10.i686
-rw-r--r--  1 root root   90889 Nov 18 12:30 config-2.6.27.5-117.fc10.i686
drwxr-xr-x  3 root root    1024 May 10 17:59 efi
drwxr-xr-x  2 root root    1024 Nov 18 15:28 grub
-rw-------  1 root root 3650255 May 10 18:15 initrd-2.6.27.5-117.fc10.i686.img
drwx------  2 root root   12288 May 10 16:36 lost+found
-rwxr-xr-x  1 root root 2570960 Nov 18 12:30 vmlinuz-2.6.27.5-117.fc10.i686
><fs> ll /boot/grub
total 46
drwxr-xr-x 2 root root  1024 Nov 18 15:28 .
drwxr-xr-x 5 root root  1024 May 10 18:15 ..
-rw-r--r-- 1 root root 40685 Oct 24  2008 splash.xpm.gz
><fs> grub-install / /dev/sda
><fs> ll /boot/grub
total 280
drwxr-xr-x 2 root root   1024 May 11 03:36 .
drwxr-xr-x 5 root root   1024 May 10 18:15 ..
-rw-r--r-- 1 root root     30 May 11 03:36 device.map
-rw-r--r-- 1 root root  11736 May 11 03:36 e2fs_stage1_5
-rw-r--r-- 1 root root  11512 May 11 03:36 fat_stage1_5
-rw-r--r-- 1 root root  10744 May 11 03:36 ffs_stage1_5
-rw-r--r-- 1 root root  10736 May 11 03:36 iso9660_stage1_5
-rw-r--r-- 1 root root  12328 May 11 03:36 jfs_stage1_5
-rw-r--r-- 1 root root  10968 May 11 03:36 minix_stage1_5
-rw-r--r-- 1 root root  13360 May 11 03:36 reiserfs_stage1_5
-rw-r--r-- 1 root root  40685 Oct 24  2008 splash.xpm.gz
-rw-r--r-- 1 root root    512 May 11 03:36 stage1
-rw-r--r-- 1 root root 111020 May 11 03:36 stage2
-rw-r--r-- 1 root root  11008 May 11 03:36 ufs2_stage1_5
-rw-r--r-- 1 root root  10344 May 11 03:36 vstafs_stage1_5
-rw-r--r-- 1 root root  12984 May 11 03:36 xfs_stage1_5
><fs> cat /boot/grub/grub.conf
libguestfs: error: open: /boot/grub/grub.conf: No such file or directory
><fs> upload /tmp/grub.conf /boot/grub/grub.conf
><fs> cat /boot/grub/grub.conf
# Shared grub.conf for intel.
#boot=/dev/sda
default=0
timeout=30
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu

title Fedora
	root (hd0,1)
	kernel /vmlinuz-2.6.27.5-117.fc10.i686
	initrd /initrd-2.6.27.5-117.fc10.i686.img
><fs> vi /boot/grub/grub.conf
><fs> cat /boot/grub/grub.conf
# Shared grub.conf for intel.
#boot=/dev/sda
default=0
timeout=30
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu

title Fedora
	root (hd0,0)
	kernel /vmlinuz-2.6.27.5-117.fc10.i686 root=/dev/VolGroup00/LogVol00 ro
	initrd /initrd-2.6.27.5-117.fc10.i686.img
><fs> vi /etc/passwd
><fs> vi /etc/shadow
libguestfs: error: open: /etc/shadow: No such file or directory

At least I got it to boot. There was still quite a lot wrong with this VM, such as the lack of /etc/shadow, but at least it’ll serve temporarily to test the bug in some Fedora 10 package that I was trying to track down.

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.