You are not logged in.

#1 2024-11-22 17:55:44

gchamon
Member
Registered: 2018-08-07
Posts: 8

Making LXD virtual machines work in Arch

This post is an attempt on my part to collect some information I gathered for some months now that is important to make LXD virtual machines work with Arch.

In a nutshell, there are two issues that happen when installing LXD on arch and trying to use it to spin up virtual machines. I haven't tested it, but it's likely that LXD containers aren't affected because they do not rely on virtualization.

First, after you install LXD and try to spin up the first virtual machine, it'll complain about QEMU feature checks with a message similar to Instance type not operational" driver=qemu err="QEMU failed to run feature checks

If you open /var/log/lxd/lxd.log you will likely see

time="2024-11-21T20:44:14-03:00" level=error msg="Unable to run feature checks during QEMU initialization: Unable to locate the file for firmware \"OVMF_CODE.fd\""
time="2024-11-21T20:44:14-03:00" level=warning msg="Instance type not operational" driver=qemu err="QEMU failed to run feature checks" type=virtual-machine

This means that OVMF_CODE.fd isn't accessible. That is because while this is indeed installed with LXD through package ed2k_ovmf the actual file has been renamed to OVMF_CODE.4m.fd.

To work around it, create two symbolic links:

ln -s /usr/share/edk2-ovmf/x64/OVMF_CODE.4m.fd /usr/share/edk2-ovmf/x64/OVMF_CODE.fd
ln -s /usr/share/edk2-ovmf/x64/OVMF_VARS.4m.fd /usr/share/edk2-ovmf/x64/OVMF_VARS.fd

Restart the LXD service and you will hit another problem, where QEMU fails with a segmentation fault issue. If this is the case, you need to downgrade QEMU as described in this post: https://discuss.linuxcontainers.org/t/q … rt/21639/8

pacman --needed -U \
https://archive.archlinux.org/packages/q/qemu-base/qemu-base-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-system-x86/qemu-system-x86-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-common/qemu-common-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-audio-spice/qemu-audio-spice-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-block-curl/qemu-block-curl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-block-dmg/qemu-block-dmg-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-block-nfs/qemu-block-nfs-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-block-ssh/qemu-block-ssh-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-chardev-spice/qemu-chardev-spice-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-qxl/qemu-hw-display-qxl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-gpu/qemu-hw-display-virtio-gpu-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-gpu-gl/qemu-hw-display-virtio-gpu-gl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-gpu-pci/qemu-hw-display-virtio-gpu-pci-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-gpu-pci-gl/qemu-hw-display-virtio-gpu-pci-gl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-vga/qemu-hw-display-virtio-vga-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-vga-gl/qemu-hw-display-virtio-vga-gl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-s390x-virtio-gpu-ccw/qemu-hw-s390x-virtio-gpu-ccw-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-usb-host/qemu-hw-usb-host-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-usb-redirect/qemu-hw-usb-redirect-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-usb-smartcard/qemu-hw-usb-smartcard-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-img/qemu-img-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-pr-helper/qemu-pr-helper-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-system-x86-firmware/qemu-system-x86-firmware-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-tools/qemu-tools-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-ui-curses/qemu-ui-curses-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-ui-opengl/qemu-ui-opengl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-ui-spice-app/qemu-ui-spice-app-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-ui-spice-core/qemu-ui-spice-core-9.0.2-1-x86_64.pkg.tar.zst

Now after restarting the lxd service again you should be able to make use of a functional LXD installation.

Last edited by gchamon (2024-11-22 18:06:53)

Offline

#2 2024-12-04 06:01:26

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 133

Re: Making LXD virtual machines work in Arch

gchamon wrote:

This means that OVMF_CODE.fd isn't accessible. That is because while this is indeed installed with LXD through package ed2k_ovmf the actual file has been renamed to OVMF_CODE.4m.fd.

To work around it, create two symbolic links:

ln -s /usr/share/edk2-ovmf/x64/OVMF_CODE.4m.fd /usr/share/edk2-ovmf/x64/OVMF_CODE.fd
ln -s /usr/share/edk2-ovmf/x64/OVMF_VARS.4m.fd /usr/share/edk2-ovmf/x64/OVMF_VARS.fd
Restart the LXD service and you will hit another problem, where QEMU fails with a segmentation fault issue. If this is the case, you need to downgrade QEMU as described in this post:

Sounds great but in the context of a server(s), how are you going to automate this?

Seeing as virtual machines are heavily used, mostly in automated ways, on servers.

Offline

#3 2024-12-09 14:34:37

gchamon
Member
Registered: 2018-08-07
Posts: 8

Re: Making LXD virtual machines work in Arch

I wouldn't, because arch is a rolling release platform which is precisely what's messing with LXD. I'd rather use more stable distros for servers.

These workarounds should only be used locally for those that use arch to develop for LXD.

Also, the folks from Canonical should make LXD compatible with the latest version of QEMU so that the workaround isn't necessary in the first place.

Offline

#4 2024-12-11 04:38:09

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 133

Re: Making LXD virtual machines work in Arch

gchamon wrote:

Also, the folks from Canonical should make LXD compatible with the latest version of QEMU so that the workaround isn't necessary in the first place.

You mean creating the sym links? Is that not something the installers should do?

Anyways, it seems like this MR/PR might be related ... https://github.com/SUSE/doc-sle/pull/1780

[Probably not but yeah ^-^]

Last edited by ReDress (2024-12-11 04:39:53)

Offline

#5 2024-12-11 14:27:15

gchamon
Member
Registered: 2018-08-07
Posts: 8

Re: Making LXD virtual machines work in Arch

I mean that apparently LXD isn't compatible with QEMU 9.1+. It might not be that, could well be just an incompatibility with the way that arch deals with packages. I can't say for sure.

Offline

Board footer

Powered by FluxBB