3

I know there are several similar questions but I couldn't find an answer to my situation. I use Lubuntu 16.04 in KVM and want to write this VM to a USB drive and boot from it. For this I executed sudo qemu-img convert /var/lib/libvirt/images/myimage.qcow2 -O raw /dev/sda. I can also boot the system from USB with KVM: sudo kvm -usb -usbdevice disk:/dev/sda -m 2G. But when I try to boot from the USB drive on a physical system it doesn't work. I tried on three computers and with two USB drives but none of them boots. When choosing the USB drive in the BIOS menu it doesn't reach GRUB or a boot screen at all. How to get a bootable USB drive from the VM?

6
  • Did you take a look at the partitions on the USB drive(s) on another Linux system? Can you see boot flags set with gparted? That would be my first step to check.
    – G Trawo
    Jul 6 '18 at 16:16
  • It looks good to me: Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 10485759 10483712 5G 83 Linux /dev/sda2 10487806 12580863 2093058 1022M 5 Extended /dev/sda5 10487808 12580863 2093056 1022M 82 Linux swap / Solaris
    – jans
    Jul 6 '18 at 18:13
  • 1
    My other guess is that it's an UEFI issue, that it can't see the GRUB boot loader. Is there an option to switch to Legacy USB in the BIOS? Otherwise, try to reinstall GRUB on the USB stick: askubuntu.com/questions/740253/…. If you can reach point 6 in that post, you at least have a working linux install on the USB stick.
    – G Trawo
    Jul 6 '18 at 18:48
  • 1
    You could also just enable CSM instead of disabling UEFI boot entirely (because you'll probably need UEFI later). Or create the VM with UEFI boot initially. Jul 6 '18 at 20:00
  • 1
    @jans You are welcome. Michaels' comment has merit. See if you can figure that out and then you could answer your question here yourself with all that you found out. At least you can then mark it as answered.
    – G Trawo
    Jul 7 '18 at 12:07
3

The UEFI was the root cause of this problem. Changing BIOS' settings from "UEFI" to "legacy BIOS" or to "UEFI and legacy" with CMS enabled solved my issue. Credits go to G Trawo and Michael Hampton.

I didn't try to create the VM with UEFI boot initially, as suggested by Michael Hampton, but it sounds like another possible solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.