systemd sometimes misdetects Xen VMs (fixed up-stream)

Bug #1768104 reported by dana on 2018-04-30
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Status tracked in Cosmic

Bug Description


 * XEN virtualization missidentified as hyperv
 * This may cause units limited to a virtualisation not to be started; or redundant units for the other type of virtualisation to be started instead.
 * Previously xen & hyper-v were detected correctly separately, even when xen emulates/suggests that it is hyper-v.

[Test Case]

 * Execute systemd-detect-virt and check that it detects Xen & Hyperv

[Regression Potential]

 * Things that "fake" xen might not work as the detection code branches are changed, but it would affect previous releases and future releases of systemd-detect-virt. So far such things are not known to exist, and if such things appear in the future support for them would need to land upstream first.

[Other Info]

 * Original bug report


It appears that Xen-based VMs sometimes report themselves as Microsoft Hyper-V via CPUID — apparently this is for compatibility with Windows guests. systemd 237 (as found in Bionic) gives preference to this CPUID information when detecting Xen, and thus it erroneously assumes that the guest is running under Hyper-V. This causes Xen-related services (and anything else that relies on systemd's VM-detection functionality) to fail.

I *believe* this is a regression from systemd 229 as used in Xenial — we have at least a few Xen-based VMs that report as Hyper-V via CPUID and don't have this issue on that version — but i haven't confirmed that for certain.

Anyway, i've submitted a ticket with more details to the up-stream project, and that has now been resolved through a fairly simple change which applies cleanly to the Bionic systemd sources:

Would it be possible to pull this down? As mentioned, Xen-based Ubuntu VMs can seriously misbehave without it.


See also:


% lsb_release -rd
Description: Ubuntu 18.04 LTS
Release: 18.04

% apt-cache policy systemd
  Installed: 237-3ubuntu10
  Candidate: 237-3ubuntu10
  Version table:
 *** 237-3ubuntu10 500
        500 bionic/main amd64 Packages
        100 /var/lib/dpkg/status

description: updated
description: updated
Changed in systemd (Ubuntu Cosmic):
status: New → Fix Committed
description: updated

Hello dana, or anyone else affected,

Accepted systemd into bionic-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at . Thank you in advance!

Changed in systemd (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-bionic
dana (okdana) wrote :

Hi Łukasz and Dimitri,

Thanks for responding so quickly. I've tested this on my Bionic VM and it seems to be working:

% lsb_release -sd
Ubuntu 18.04 LTS

% uname -r

% dpkg-query -Wf '${Package}: ${Version}\n' | rg systemd
libnss-systemd: 237-3ubuntu10.1
libpam-systemd: 237-3ubuntu10.1
libsystemd0: 237-3ubuntu10.1
python3-systemd: 234-1build1
systemd: 237-3ubuntu10.1
systemd-sysv: 237-3ubuntu10

% SYSTEMD_LOG_LEVEL=debug systemd-detect-virt
Failed to read $container of PID 1, ignoring: Permission denied
Found container virtualization none.
Virtualization Xen found in DMI (/sys/class/dmi/id/sys_vendor)
Virtualization XEN, found /sys/hypervisor/properties/features with value 00002705, XENFEAT_dom0 (indicating the 'hardware domain') is not set.
Found VM virtualization xen

I also did a few spot checks of journalctl, systemctl, &c., and all that looks OK too.


tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
tags: added: verification-needed
removed: verification-done
tags: added: verification-done
removed: verification-needed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers