Qemu Booting a PC without an MBR?
Hi all,
today I had the second incidence of a migrated system (copied with DD) to qemu which won't boot. (stuck after booting from harddisk message).
Looking at sector 0 I found out that it does not have an MBR. It seems that real hardware and I was told also vmware can cope with this.
Is there a way we can improve this? (maybe be using an open source mbr in case the mbr section is zeroed out?)
Thanks,
Peter
Il 30/08/2013 08:28, Peter Lieven ha scritto:
Quoted 7 lines
Hi all,
today I had the second incidence of a migrated system (copied with DD) to qemu which won't boot. (stuck after booting from harddisk message).
Looking at sector 0 I found out that it does not have an MBR. It seems that real hardware and I was told also vmware can cope with this.
Maybe because it's got a UEFI bootloader? In this case, you could try using OVMF as the firmware with the -bios command-line option.
Paolo
Quoted 2 lines
Is there a way we can improve this? (maybe be using an open source mbr in case the mbr section is zeroed out?)
Quoted 10 lines · Paolo Bonzini
Il 30/08/2013 08:28, Peter Lieven ha scritto:
Quoted 7 lines
Hi all,
today I had the second incidence of a migrated system (copied with DD) to qemu which won't boot. (stuck after booting from harddisk message).
Looking at sector 0 I found out that it does not have an MBR. It seems that real hardware and I was told also vmware can cope with this.
Maybe because it's got a UEFI bootloader? In this case, you could try using OVMF as the firmware with the -bios command-line option.
I will try, thanks for the pointer.
It seems that the partition marked as boot has a boot loader though.
Peter
Quoted 7 lines · Peter Lieven
Quoted 6 lines · Paolo Bonzini
Il 30/08/2013 08:28, Peter Lieven ha scritto:
Quoted 5 lines
Hi all,
today I had the second incidence of a migrated system (copied with DD) to qemu which won't boot. (stuck after booting from harddisk message).
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Looking at sector 0 I found out that it does not have an MBR. It seems that real hardware and I was told also vmware can cope with this.
Maybe because it's got a UEFI bootloader? In this case, you could try using OVMF as the firmware with the -bios command-line option.
I will try, thanks for the pointer.
It seems that the partition marked as boot has a boot loader though.
As a simple workaround you could boot with a GRUB iso and chainload the partition, when you are in the guest OS, fix the MBR.
Fam
Quoted 5 lines · Peter Lieven
Hi all,
today I had the second incidence of a migrated system (copied with DD) to qemu which won't boot. (stuck after booting from harddisk message).
You should probably have looked at virt-v2v, but you are where you are now, so ...
Quoted 5 lines
Looking at sector 0 I found out that it does not have an MBR. It seems that real hardware and I was told also vmware can cope with this.
Is there a way we can improve this? (maybe be using an open source mbr in case the mbr section is zeroed out?)
(1) Use virt-rescue to open the disk image and then run whatever program is needed inside the guest (eg. grub-install).
Or:
(2) Use guestfish and add a syslinux boot loader. I don't have a direct example you can copy, but you could greatly simplify this:
It'll probably be something like:
Write a /tmp/syslinux cfg file (see EXTLINUX docs).
guestfish -a disk.img
Quoted 4 lines
<fs> upload
/usr/share/syslinux/mbr.bin/dev/sda
<fs> mount/dev/sda1/
<fs> extlinux /
<fs> upload/tmp/syslinux.cfg/syslinux.cfg
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Actually assuming it's a Linux guest, a third option would be:
(3) Use an external kernel + initrd:
guestfish -a disk.img -i
Quoted 2 lines
<fs> download
/boot/vmlinuz-.../tmp/kernel
<fs> download/boot/initrd-.../tmp/initrd
qemu -kernel /tmp/kernel -initrd /tmp/initrd -hda disk.img ...
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v