Kvm is detected as qemu with systemd-detect-virt


Hi, I upgraded Ubuntu 20.04 LTS to Ubuntu 22.04 LTS but since this upgrade when I use the ‘systemd-detect-virt’ command the result is no longer KVM but qemu.The problem is that plesk uses this value to check my license type.
I have this problem on different kernels and versions of lxd
Am I the only one with this problem? Any idea how to fix this?

systemd-detect-virt gives me qemu on both 20.04 and 22.04 here.

My server under ubuntu 20 kernel 5.4.0-139-generic and lxd version 4.0.9-a29c6f1 :

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal

And in the virtual machine with debian 11.8, systemd-detect-virt gives me KVM

I’ve just done the test with another Ubuntu 20.04.6 host but with lxd version 5.19-31ff7b6 and I see KVM with the command systemd-detect-virt

Not sure what the difference is exactly, I’m getting QEMU as the DMI vendor on both LXD 5.19 and Incus 0.2, there’s also nothing obvious that changed on the QEMU side there in a long time.

Anyway, I’d argue that if you have software that actively depends on that, it feels like a software bug.

You can cheat around this bind-mounting a file with the desired value on top of it:

root@deb11:~# echo KVM > foo
root@deb11:~# mount -o bind foo /sys/class/dmi/id/sys_vendor
root@deb11:~# cat /sys/class/dmi/id/sys_vendor
root@deb11:~# systemd-detect-virt

The solution works, but it’s still weird.
On my debian 11 VM with ubuntu 20.04 :

cat /sys/class/dmi/id/sys_vendor → QEMU
systemd-detect-virt → kvm

I don’t understand what systemd-detect-virt is based on to print KVM

It is indeed a bug on the plesk, they are working on it but strange that we don’t have the same systemd-detect-virt output between you and me