<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - systemd-detect-virt and hostnamectl fail to detect Xen PV"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=61491">61491</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>systemd-detect-virt and hostnamectl fail to detect Xen PV
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>minor
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>andy.melnikov@gmail.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When running inside a Xen PV virtual machine, systemd-detect-virt displays
"none" and hostnamectl doesn't display "Virtualization" line:

[root@foo ~]# systemd-detect-virt
none

[root@foo ~]# hostnamectl
   Static hostname: foo
   Pretty hostname: foo
         Icon name: computer
           Chassis: n/a
        Machine ID: baad787b99df4cc7a8ff801dfd96c735
           Boot ID: baad822deca749a496ee91406681ebd6
  Operating System: Foo Linux
            Kernel: Linux 3.x.x-foo
      Architecture: i686


Compare with running in vmware:

[root@bar ~]# systemd-detect-virt
vmware
[root@bar ~]# hostnamectl
   Static hostname: bar
Transient hostname: localhost
   Pretty hostname: n/a
         Icon name: computer-vm
           Chassis: vm
        Machine ID: d2016ade07564ecfb465fa009630602e
           Boot ID: 09105e4eea624316a8eda284739dcc45
    Virtualization: vmware
  Operating System: Foo Linux
            Kernel: Linux 3.x.x-foo
      Architecture: i686

One way to detect is to look for presense of /sys/hypervisor/type:

[root@zorro ~]# cat /sys/hypervisor/type
xen

Or /proc/xen/ folder.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>