virt-install: boot from the 2nd hard disk via UEFI if the first one is "empty"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am new to virt-install and just a regular user of UEFI, so forgive me if I ask something stupid.

I am trying to create and start a VM with virt-install so that
- it needs to boot with UEFI,
- if the first disk is "empty" (just created, not partitioned), then the system should boot from the second HDD, which contains an installer image,
- otherwise if an UEFI bootable system is found in the first HDD, then it should boot from that.
(it is also OK if I could change the boot order after the VM is booted (during installation it gets rebooted)
- it should happen without manual intervention (e.g. interactive boot menu), fully scripted.

So far I put together a command line something like this:

INSTALLER_IMAGE_PATH=/path/to/installer-image.qcow2

virt-install --name my-vm --network default --connect qemu:///system --memory=4096 --cpu=host --vcpus=2 --os-type=linux --os-variant=generic --noautoconsole --events _on_poweroff_=preserve --disk pool=default,size=30 --disk $INSTALLER_IMAGE_PATH --boot loader=/usr/share/ovmf/x64/OVMF_CODE.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/ovmf/x64/OVMF_VARS.fd,loader_secure=no

The "--boot loader=/usr/share/ovmf/x64/OVMF_CODE.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/ovmf/x64/OVMF_VARS.fd,loader_secure=no" magic I googled from somewhere, as the "--boot uefi" option did not work (gave "ERROR    Error: --boot uefi: Did not find any UEFI binary path for arch 'x86_64'").
The OVMF file paths are based on the Arch linux ovmf package.

The problem with this is that the system does not boots the installer image, but I get an "UEFI Interactive Shell v2.2" screen.
If I switch the order of the two disks, then the installer image is booted (but that's not what I want):

# This one boots the installer image, but the order of the disks are reversed
virt-install --name my-vm --network default --connect qemu:///system --memory=4096 --cpu=host --vcpus=2 --os-type=linux --os-variant=generic --noautoconsole --events _on_poweroff_=preserve --disk $INSTALLER_IMAGE_PATH --disk pool=default,size=30 --boot loader=/usr/share/ovmf/x64/OVMF_CODE.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/ovmf/x64/OVMF_VARS.fd,loader_secure=no

(Also, it would be nice if usb boot would would be supported and I could change the boot order like disk, usb.)

$ virt-install --version
2.0.0
$ qemu-system-x86_64 --version
QEMU emulator version 3.1.0
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers

Regards,
Attila

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux