Changing QEMU virtual machine startup config options

I have found the qemu.conf file for the virtual machine I want to work with. However, whenever I modify the conf file and start the vm instance using “lxc start VMNAME”, the config file immediately reverts all changes.

For example, I want to change the following value:

SCSI controller

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

I want “virtio-scsi-single” instead of “virtio-scsi-pci”.

Any guidance on how to correctly make this modification (or how to make QEMU startup option changes in general) within LXC/LXD would be great. Thank you.

That configuration file is generated by lxd/driver_qemu_templates.go at master · lxc/lxd · GitHub
As you can see, the driver = "virtio-scsi-pci" line is hardcoded there. The only other option is driver = "virtio-scsi-ccw".
It might be possible to add another device with raw.qemu something like

lxc config set VMNAME raw.qemu='-device virtio-scsi-single...'

I don’t know of any way to remove a device with raw.qemu.

Why do you need this?

CC @stgraber

Good day Thomas,

I am hitting a strange issue (seemingly at random) where my ubuntu 20.04 VM will essentially lock up. If I am able to console in (which some times I can, sometimes I can’t), I see tons of “watchdog: BUG: soft lockup - CPU” messages and if I open htop, I always see a process (never the same process interesting), running the CPU to max like its stuck in an endless loop somehow.

I have searched and many have suggested it may be related to the scsi adapter being used. Specifically the values I need set are:


Here is the article that lead me down this road. Figured I would give some of these settings a shot, albeit a long shot:

What is your kernel version?

It may be Bug #1966499 “Recent 5.13 kernel has broken KVM support” : Bugs : linux package : Ubuntu as we’ve been seeing issues with the Ubuntu Focal HWE kernel recently.

Very interesting, I am using HWE.

5.13.0-39-generic #44~20.04.1-Ubuntu

Hrm yeah so you’re running a kernel that has known severe issues with running LXD VMs.
I can’t say for certain the issue you’re experiencing is to do with that, but would seem prudent to wait until that is fixed before going further.

I really appreciate that info… I will build without HWE and report back what I see.

Thank you Thomas!

1 Like

So after several deployments of VMs on the non-HWE build, it certainly seems as if the problem has been resolved. Outstanding! Thank you Thomas!

1 Like