Fedora VM fails to boot

I’m trying to launch a Fedora VM but GRUB is unable to find the kernel. I’ve tried turning secure boot off without any success. I’ve tried the cloud variant image as well. The LXD is v4.15 and qemu is v5.2.0 . The host is Fedora 34 as well with v5.12.14 kernel.

Further details:

$ lxc launch images:fedora/34/amd64 test --vm
Creating test
Starting test

$ lxd console test
error: …/…/grub-core/fs/fshelp.c:257:file
`/containers/distrobuilder-4919b8ba-8eac-4060-a58a-a20fdb210cf9@/rootfs/var/cac
he/distrobuilder.557744431/overlay/boot/vmlinuz-5.12.15-300.fc34.x86_64’ not
found.
error: …/…/grub-core/loader/i386/efi/linux.c:208:you need to load the kernel
first.

Press any key to continue…

VM GRUB entry:

load_video
set gfxpayload=keep
insmod gzio
linux ($root)/containers/distrobuilder-4919b8ba-8eac-4060-a58a-a20fdb210cf9@/r
ootfs/var/cache/distrobuilder.557744431/overlay/boot/vmlinuz-5.12.15-300.fc34.
x86_64 root=/dev/sda2 ro console=tty1 console=ttyS0
initrd ($root)/containers/distrobuilder-4919b8ba-8eac-4060-a58a-a20fdb210cf9@/
rootfs/var/cache/distrobuilder.557744431/overlay/boot/initramfs-5.12.15-300.fc
34.x86_64.img

$ lxc image list --format csv
,1bccc78b3bfa,no,Fedora 34 amd64 (20210716_20:33),x86_64,VIRTUAL-MACHINE,532.69MB,“Jul 16, 2021 at 11:11pm (UTC)”

$ pgrep -af qemu-system
6293 /usr/bin/qemu-system-x86_64 -S -name test -uuid b707b209-6cc9-44b4-9ac1-c72d6455a285 -daemonize -cpu host -nographic -serial chardev:console -nodefaults -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=deny,resourcecontrol=deny -readconfig /var/log/lxd/test/qemu.conf -spice unix=on,disable-ticketing=on,addr=/var/log/lxd/test/qemu.spice -pidfile /var/log/lxd/test/qemu.pid -D /var/log/lxd/test/qemu.log -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas nobody

$ cat /var/log/lxd/test/qemu.conf
# Machine
[machine]
graphics = “off”
type = “q35”
accel = “kvm”
usb = “off”

[global]
driver = “ICH9-LPC”
property = “disable_s3”
value = “1”

[global]
driver = “ICH9-LPC”
property = “disable_s4”
value = “1”
[boot-opts]
strict = “on”

# Console
[chardev “console”]
backend = “pty”

# Memory
[memory]
size = “1024M”

# CPU
[smp-opts]
cpus = “1”
sockets = “1”
cores = “1”
threads = “1”

[object “mem0”]

qom-type = “memory-backend-memfd”
size = “1024M”
share = “on”

[numa]
type = “node”
nodeid = “0”
memdev = “mem0”

# Firmware (read only)
[drive]
file = “/usr/share/edk2/ovmf/OVMF_CODE.fd”
if = “pflash”
format = “raw”
unit = “0”
readonly = “on”

# Firmware settings (writable)
[drive]
file = “/var/lib/lxd/virtual-machines/test/qemu.nvram”
if = “pflash”
format = “raw”
unit = “1”

# Qemu control
[chardev “monitor”]
backend = “socket”
path = “/var/log/lxd/test/qemu.monitor”
server = “on”
wait = “off”

[mon]
chardev = “monitor”
mode = “control”

[device “qemu_pcie0”]
driver = “pcie-root-port”
bus = “pcie.0”
addr = “1.0”
chassis = “0”
multifunction = “on”

# Balloon driver
[device “qemu_balloon”]
driver = “virtio-balloon-pci”
bus = “qemu_pcie0”
addr = “00.0”

multifunction = “on”

# Random number generator
[object “qemu_rng”]
qom-type = “rng-random”
filename = “/dev/urandom”

[device “dev-qemu_rng”]
driver = “virtio-rng-pci”
bus = “qemu_pcie0”
addr = “00.1”

rng = “qemu_rng”

# Input
[device “qemu_keyboard”]
driver = “virtio-keyboard-pci”
bus = “qemu_pcie0”
addr = “00.2”

# Input
[device “qemu_tablet”]
driver = “virtio-tablet-pci”
bus = “qemu_pcie0”
addr = “00.3”

# Vsock
[device “qemu_vsock”]
driver = “vhost-vsock-pci”
bus = “qemu_pcie0”
addr = “00.4”

guest-cid = “58”

# Virtual serial bus
[device “dev-qemu_serial”]
driver = “virtio-serial-pci”
bus = “qemu_pcie0”
addr = “00.5”

# LXD serial identifier
[chardev “qemu_serial-chardev”]
backend = “ringbuf”
size = “16B”

[device “qemu_serial”]
driver = “virtserialport”
name = “org.linuxcontainers.lxd”
chardev = “qemu_serial-chardev”
bus = “dev-qemu_serial.0”

# Spice agent
[chardev “qemu_spice-chardev”]
backend = “spicevmc”
name = “vdagent”

[device “qemu_spice”]
driver = “virtserialport”
name = “com.redhat.spice.0”
chardev = “qemu_spice-chardev”
bus = “dev-qemu_serial.0”

# Spice folder
[chardev “qemu_spicedir-chardev”]
backend = “spiceport”
name = “org.spice-space.webdav.0”

[device “qemu_spicedir”]
driver = “virtserialport”
name = “org.spice-space.webdav.0”
chardev = “qemu_spicedir-chardev”
bus = “dev-qemu_serial.0”

# USB controller
[device “qemu_usb”]
driver = “qemu-xhci”
bus = “qemu_pcie0”
addr = “00.6”

[chardev “qemu_spice-usb-chardev1”]
backend = “spicevmc”
name = “usbredir”

[chardev “qemu_spice-usb-chardev2”]
backend = “spicevmc”
name = “usbredir”

[chardev “qemu_spice-usb-chardev3”]
backend = “spicevmc”
name = “usbredir”

[device “qemu_spice-usb1”]
driver = “usb-redir”
chardev = “qemu_spice-usb-chardev1”

[device “qemu_spice-usb2”]
driver = “usb-redir”
chardev = “qemu_spice-usb-chardev2”

[device “qemu_spice-usb3”]
driver = “usb-redir”
chardev = “qemu_spice-usb-chardev3”

[device “qemu_pcie1”]
driver = “pcie-root-port”
bus = “pcie.0”
addr = “1.1”
chassis = “1”

# SCSI controller
[device “qemu_scsi”]
driver = “virtio-scsi-pci”
bus = “qemu_pcie1”
addr = “00.0”

[device “qemu_pcie2”]
driver = “pcie-root-port”
bus = “pcie.0”
addr = “1.2”
chassis = “2”

# Config drive (9p)
[fsdev “qemu_config”]
fsdriver = “local”
security_model = “none”
readonly = “on”
path = “/var/lib/lxd/virtual-machines/test/config.mount”

[device “dev-qemu_config-drive-9p”]
driver = “virtio-9p-pci”
bus = “qemu_pcie2”
addr = “00.0”
mount_tag = “config”
fsdev = “qemu_config”
multifunction = “on”

[device “qemu_pcie3”]
driver = “pcie-root-port”
bus = “pcie.0”
addr = “1.3”
chassis = “3”

# GPU
[device “qemu_gpu”]
driver = “virtio-vga”
bus = “qemu_pcie3”
addr = “00.0”

[device “qemu_pcie4”]
driver = “pcie-root-port”
bus = “pcie.0”
addr = “1.4”
chassis = “4”

# root drive
[drive “lxd_root”]
file = “/var/lib/lxd/storage-pools/default/virtual-machines/test/root.img”
format = “raw”
if = “none”
cache = “none”
aio = “native”
discard = “on”
media = “disk”
file.locking = “off”
readonly = “off”

[device “dev-lxd_root”]
driver = “scsi-hd”
bus = “qemu_scsi.0”
channel = “0”
scsi-id = “0”
lun = “1”
drive = “lxd_root”
bootindex = “0”

[device “qemu_pcie5”]
driver = “pcie-root-port”
bus = “pcie.0”
addr = “1.5”
chassis = “5”

[device “qemu_pcie6”]
driver = “pcie-root-port”
bus = “pcie.0”
addr = “1.6”
chassis = “6”

[device “qemu_pcie7”]
driver = “pcie-root-port”
bus = “pcie.0”
addr = “1.7”
chassis = “7”

[device “qemu_pcie8”]
driver = “pcie-root-port”
bus = “pcie.0”
addr = “2.0”
chassis = “8”
multifunction = “on”

Hmm, that grub entry is pretty messed up, so that’s definitely an issue.
In the mean time, you can probably edit those paths to be:

linux (hd0,2)/boot/vmlinuz-5.12.15-300.fc34.x86_64 root=/dev/sda2 ro console=tty1 console=ttyS0
initrd (hd0,2)/boot/initramfs-5.12.15-300.fc34.x86_64.img

Which I think should work fine. Maybe that ($root) works too but I’ve not really tried that syntax in grub before.

@monstermunchkin

1 Like

As you suggested, removing “/containers/distrobuilder-4919b8ba-8eac-4060-a58a-a20fdb210cf9@/rootfs/var/cache/distrobuilder.557744431/overlay” from “linux” and “initrd” grub commands worked.

FYI: Using the $(root) worked as well.

Thanks!

Can confirm this with official Fedora image and a custom one I built with distrobuilder on my side.