Running virtual machines with LXD 4.0

Hi,

thank you for this work and I just tried to install Windows Server 2k19 according to this steps with current LXD 4.4 snap on Ubuntu 20.04 host system.

I just want to add here that it doesn’t work anymore exactly like this because the provided qemu in the LXD snap seem to have no VNC support anymore. I got this error when I tried to start the VM:

Error: Failed to run: /snap/lxd/current/bin/lxd forklimits limit=memlock:unlimited:unlimited -- /snap/lxd/16889/bin/qemu-system-x86_64 -S -name win2k19 -uuid 83dbbd18-28ba-4300-a29b-1ccb04435338 -daemonize -cpu host -nographic -serial chardev:console -nodefaults -no-reboot -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=deny,resourcecontrol=deny -readconfig /var/snap/lxd/common/lxd/logs/win2k19/qemu.conf -pidfile /var/snap/lxd/common/lxd/logs/win2k19/qemu.pid -D /var/snap/lxd/common/lxd/logs/win2k19/qemu.log -chroot /var/snap/lxd/common/lxd/virtual-machines/win2k19 -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas lxd -device virtio-vga -vnc :1 -drive file=/home/user/17763.737.190906-2324.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us_1.iso,index=0,media=cdrom,if=ide -drive file=/home/user/Downloads/virtio-win-0.1.185.iso,index=1,media=cdrom,if=ide: qemu-system-x86_64: -vnc :1: VNC support is disabled: exit status 1

I tried then to set spice as remote display by adding this param -spice port=5900,disable-ticketing, so now it looks like:

echo -n '-device virtio-vga -spice port=5900,disable-ticketing -boot menu=on -drive file=/var/lib/snapd/hostfs/home/user/17763.737.190906-2324.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us_1.iso,index=0,media=cdrom,if=ide -drive file=/var/lib/snapd/hostfs/home/user/Downloads/virtio-win-0.1.185.iso,index=1,media=cdrom,if=ide' | lxc config set win2k19 raw.qemu -

Then the VM was booting and I was able to select the boot drive in qemu BIOS and start the system but I wasn’t able to connect with a spice client to the desktop. But then, after I found this LXD 4.4 has been released, I tried to start and connect to the system with lxc start win2k19;lxc console --type=vga win2k19 I finally could install the system in the VM. I just had to install sudo apt install spice-client-gtk before this and reboot the host, so lxc can find the program.

I’m even not sure if the parameter -spice port=5900,disable-ticketing is even necessary for qemu with LXD 4.4.

Again, thank you for all the work on LXD and I just wanted to add this information here in case someone else will need this.