VM boots into UEFI Interactive Shell with the filesystem missing. (custom virt-install boot parameters)
My Setup
Host
OS: Manjaro XFCE x86_64
Apps: packer (plugins: qemu),
virt-manager, virt-install
virt-viewer
Guest
OS: Arch Linux
Hypervisor: QEMU KVM
Architecture: x64
Machine Type: q35
EFI Firmware Code: /usr/share/edk2/x64/OVMF_CODE.4m.fd
EFI Firmware Vars: /usr/share/edk2/x64/OVMF_VARS.4m.fd
I created a customized Arch Linux image on my host using packer build
and log my boot options.
...
"==> bootloader.sh: Show boot options.."
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0007,0000,0001,0002,0003,0004,0005,0006
Boot0000* UiApp FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
Boot0001* UEFI QEMU DVD-ROM QM00001 PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0,65535,0){auto_created_boot_option}
Boot0002* UEFI QEMU DVD-ROM QM00005 PciRoot(0x0)/Pci(0x1f,0x2)/Sata(2,65535,0){auto_created_boot_option}
Boot0003* UEFI Misc Device PciRoot(0x0)/Pci(0x3,0x0){auto_created_boot_option}
Boot0004* UEFI PXEv4 (MAC:525400123456) PciRoot(0x0)/Pci(0x2,0x0)/MAC(525400123456,1)/IPv4(0.0.0.00.0.0.0,0,0){auto_created_boot_option}
Boot0005* UEFI PXEv6 (MAC:525400123456) PciRoot(0x0)/Pci(0x2,0x0)/MAC(525400123456,1)/IPv6([::]:<->[::]:,0,0){auto_created_boot_option}
Boot0006* EFI Internal Shell FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
Boot0007* GRUB HD(1,GPT,2034b5d2-828a-4491-8d23-fe9439932a12,0x800,0x7d000)/File(EFIGRUBgrubx64.efi)
...
So I’m thinking that this should go fine, but instead when I run this:
sudo virt-install
--name bastille-installer
--vcpu 2
--machine q35
--memory 1024
--osinfo archlinux
--debug
--disk /var/lib/libvirt/images/bastille-installer_qemu_archlinux-2023-05.qcow2,format=qcow2
--import
--boot loader=/usr/share/edk2/x64/OVMF_CODE.4m.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/edk2/x64/OVMF_VARS.4m.fd,loader_secure=no
The FS0: in the mapping table is completely missing.
And after exiting to see the boot manager I find that several boot options are missing as well.
In case it’s relevant, virt-install’s verbose output looks like this:
https://gist.github.com/Folaht/d8d4366b79434069ff6e8a7b51abbd25
What am I doing wrong?
[EDIT]
$ sudo qemu-img info ./bastille-installer_qemu_archlinux-2023-05.qcow2
image: ./bastille-installer_qemu_archlinux-2023-05.qcow2
file format: raw
virtual size: 1.42 GiB (1522309120 bytes)
disk size: 1.42 GiB
Child node '/file':
filename: ./bastille-installer_qemu_archlinux-2023-05.qcow2
protocol type: file
file length: 1.42 GiB (1522309120 bytes)
disk size: 1.42 GiB
Looks like I have a raw file issue.
Something must be causing packer to ignore building the box as a qcow2 file despite being configured as such.
bastillebox-installer-box.pkr.hcl
...
source "qemu" "archlinux" {
accelerator = "kvm"
boot_command = local.boot_command_qemu
boot_wait = "1s"
cpus = local.cpus
disk_interface = "virtio"
disk_size = local.disk_size
efi_boot = true
efi_firmware_code = local.efi_firmware_code
efi_firmware_vars = local.efi_firmware_vars
format = "qcow2"
headless = local.headless
http_directory = local.http_directory
iso_url = local.iso_url
iso_checksum = local.iso_checksum
machine_type = local.machine_type
memory = local.memory
net_device = "virtio-net"
shutdown_command = "sudo systemctl start poweroff.timer"
ssh_handshake_attempts = 500
ssh_port = 22
ssh_private_key_file = var.ssh_private_key_file
ssh_timeout = var.ssh_timeout
ssh_username = var.ssh_username
ssh_wait_timeout = var.ssh_timeout
vm_name = "${local.vm_name}.qcow2"
}
...
You have an erroneous disk configuration. You’re using a qcow2 disk image, but you didn’t tell virt-install
that, so your virtual machine configuration looks like this:
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/var/lib/libvirt/images/bastille-installer_qemu_archlinux-2023-05.qcow2"/>
<target dev="vda" bus="virtio"/>
</disk>
It’s attempting to access the disk image as a raw
image, so it’s not finding the expected data. Ensure that you set the format correctly:
virt-install
--disk /var/lib/libvirt/images/bastille-installer_qemu_archlinux-2023-04.qcow2,format=qcow2
...