Comment 9 for bug 410886

Revision history for this message
Iain Allan (iain-allan) wrote :

I am seeing the same problem on Karmic with ubuntu-vm-builder and grub not finding the stage1 grub file.

I converted the qcow2 image created by vmbuilder to raw and then mounted the image to inspect the grub directory. It seems that the grub stage files are actually in /boot/grub/i386-pc.

ubuntu-kvm/mnt/boot/
|-- System.map-2.6.31-14-generic-pae
|-- config-2.6.31-14-generic-pae
|-- grub
| |-- default
| |-- device.map
| |-- grubenv
| |-- i386-pc
| | |-- e2fs_stage1_5
| | |-- fat_stage1_5
| | |-- jfs_stage1_5
| | |-- minix_stage1_5
| | |-- reiserfs_stage1_5
| | |-- stage1
| | |-- stage2
| | |-- stage2_eltorito
| | `-- xfs_stage1_5
| |-- menu.lst
| |-- menu.lste
| `-- menu.lst~
|-- initrd.img-2.6.31-14-generic-pae
`-- vmlinuz-2.6.31-14-generic-pae

If you copy the stage files from boot/grub you can then manually install grub and get the KVM image to boot.

# cd ubuntu-kvm ; mkdir mnt
# qemu-img convert -O raw disk0.qcow2 disk0.img
# mount -oloop,offset=16384 -t ext3 disk0.img mnt
# cp mnt/boot/grub/i386-pc/stage* mnt/boot/grub
# grub --device-map=/dev/null
grub> device (hd0) ../disk0.img
device (hd0) ../disk0.img
grub> root (hd0,0)
root (hd0,0)
grub> setup (hd0)
setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... no
 Running "install /boot/grub/stage1 (hd0) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.
# qemu-img convert -O qcow2 disk0.img disk0.qcow2