Cannot start virtual machines missing OVMF Gentoo

Hi there! I cannot launch virtual machine images on LXD. Other virtual machine images also don’t work. Any ideas what could go wrong?

$ lxc launch local:ubuntu-vm/21.04 --profile default vm1                                                                                                               
Creating vm1
Starting vm1                              
Error: lstat /usr/share/OVMF: no such file or directory
Try `lxc info --show-log local:vm1` for more info
$ lxc info --show-log local:vm1                                                                                                                                        
Name: vm1
Location: none
Remote: unix://
Architecture: x86_64
Created: 2021/08/26 12:08 UTC
Status: Stopped
Type: virtual-machine
Profiles: default
Error: open /var/log/lxd/vm1/qemu.log: no such file or directory

What OS are you running LXD on?

You need to install the ovmf package.

I use Gentoo. sys-firmware/edk2-ovmf is installed but I’m unable to start virtual machines :frowning:

If you can find where that package has installed those files then you can run LXD with the LXD_OVMF_PATH env var.

Where I can set environment variables? Just in .bashrc, .profile or does exist any smarter way like lxc config?

It would need to be set by the service manager starting LXD.

Can you explain more clearly how to do this step by step? Excuse me but I’m LXD novice.

Also see this as it may be of help

lxc profile set default security.secureboot=false doesn’t help. Do I need to set env vars in service manager like OpenRC, systemd?

Yes (ideally the package provided by the OS would do this).

I set export LXD_OVMF_PATH="/usr/share/edk2-ovmf" in OpenRC service settings and restarted lxd daemon, and then I got following error message when I tried to launch virtual machine image:

$ lxc launch local:debian-vm/11 test
Creating test
Starting test
Error: Failed to run: forklimits limit=memlock:unlimited:unlimited -- /usr/bin/qemu-system-x8
6_64 -S -name test -uuid 6c9d06a7-e24d-4ee1-b35d-fee3b2280a31 -daemonize -cpu host -nographic
-serial chardev:console -nodefaults -no-user-config -sandbox on,obsolete=deny,elevateprivile
ges=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.pi
d -D /var/log/lxd/test/qemu.log -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas
nobody: char device redirected to /dev/pts/5 (label console)
: Process exited with non-zero value 1
Try `lxc info --show-log local:test` for more info
$ lxc info --show-log local:test
Name: test
Location: none
Remote: unix://
Architecture: x86_64
Created: 2021/08/26 13:45 UTC
Status: Stopped
Type: virtual-machine
Profiles: default

Log:

qemu-system-x86_64:/var/log/lxd/test/qemu.conf:43: memdev=mem0 is ambiguous

I have enabled apparmor system-wide and LXD compiled with apparmor support.

Looks like your QEMU version is out of date, you need either QEMU 5.2 or QEMU 6.1 (6.0 was broken for LXD’s usage).

See

1 Like

When I type in terminal lxc console vm1 -t vga I see only tianocore splash screen, not normal tty console. lxc exec vm1 -- /bin/bash works as excepted.

Try hitting alt+f1 or alt+f2 in that VM. A lot of Linux distributions don’t automatically switch to a working TTY these days.

2 Likes

How to enable automatically switching to working TTY behavior? Can it be set in the default profile?

That’s a guest thing, so you’d most likely need to change the kernel command line in grub or whatever bootloader is used by the guest image you’re using.

1 Like