QEMU KVM hangs “Booting from Hard Disk… “

hanginghard drivekvm-virtualizationqemu

  • Ubuntu 20.04 server (no GUI) as host

  • several guests working perfectly, each with its own LV

  • I created an LV for a VM called "test", similar to working guests

  • Partitioned the LV: one ext4 bootable partition, one swap

  • root system rsync-d onto the bootable partition.

  • created a new VM using virt-install thus:

    virt-install –name=test
    –memory 2000
    –vcpus 2
    –disk path=/dev/vg-main/test,bus=virtio,cache=none,format=raw
    –network="bridge=br0,model=virtio"
    –graphics vnc,port=5905
    –noautoconsole
    –import
    –os-type=generic

When I start the VM, it hangs as follows:

SeaBIOS (version 1.13.0-1ubuntu1.1)
Machine UUID <uuid of xml file>
iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP+7CF8C880+7CECC880 CA00

Booting from Hard Disk...

The file system is mountable and complete:

root@virtual3:~/test# losetup /dev/loop7 /dev/vg-main/test
root@virtual3:~/test# kpartx -av /dev/loop7
add map loop7p1 (253:11): 0 95614977 linear 7:7 3999744
add map loop7p2 (253:12): 0 5238784 linear 7:7 99616768
root@virtual3:~/test# mount /dev/mapper/loop7p1 /mnt
root@virtual3:~/test# ls /mnt
backup  build  etc   initrd          lib         mnt   root  srv  usr      vmlinuz.old
bin     cdrom  from  initrd.img      lost+found  opt   run   sys  var
boot    dev    home  initrd.img.old  media       proc  sbin  tmp  vmlinuz

and the output of fdisk /dev/vg-main/test looks like this:

Disk /dev/vg-main/test: 50 GiB, 53687091200 bytes, 104857600 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
Disklabel type: gpt
Disk identifier: 02EA0DD2-3166-495C-9E0F-37DDEFD15786

Device                Start       End  Sectors  Size Type
/dev/vg-main/test1  3999744  99614720 95614977 45.6G Linux filesystem
/dev/vg-main/test2 99616768 104855551  5238784  2.5G Linux swap

I've compared the .xml file with other working .xml files and I can't see anything obvious.

<disk type='block' device='disk'>
  <driver name='qemu' type='raw' cache='none' io='native'/>
  <source dev='/dev/vg-main/test'/>
  <target dev='vda' bus='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>

I can't see any error message in the logs. I think I must have missed an important step.. .any help much appreciated.

Best Answer

You are booting a GPT disk with the default old-style BIOS, which will not work. Try appending --machine q35 --boot uefi to virt-install