1SYSTEMD-DETECT-VIRT(1) systemd-detect-virt SYSTEMD-DETECT-VIRT(1)
2
3
4
6 systemd-detect-virt - Detect execution in a virtualized environment
7
9 systemd-detect-virt [OPTIONS...]
10
12 systemd-detect-virt detects execution in a virtualized environment. It
13 identifies the virtualization technology and can distinguish full
14 machine virtualization from container virtualization.
15 systemd-detect-virt exits with a return value of 0 (success) if a
16 virtualization technology is detected, and non-zero (error) otherwise.
17 By default, any type of virtualization is detected, and the options
18 --container and --vm can be used to limit what types of virtualization
19 are detected.
20
21 When executed without --quiet will print a short identifier for the
22 detected virtualization technology. The following technologies are
23 currently identified:
24
25 Table 1. Known virtualization technologies (both VM, i.e. full hardware
26 virtualization, and container, i.e. shared kernel virtualization)
27 ┌──────────┬────────────────┬─────────────────────┐
28 │Type │ ID │ Product │
29 ├──────────┼────────────────┼─────────────────────┤
30 │VM │ qemu │ QEMU software │
31 │ │ │ virtualization, │
32 │ │ │ without KVM │
33 │ ├────────────────┼─────────────────────┤
34 │ │ kvm │ Linux KVM kernel │
35 │ │ │ virtual machine, │
36 │ │ │ with whatever │
37 │ │ │ software, except │
38 │ │ │ Oracle Virtualbox │
39 │ ├────────────────┼─────────────────────┤
40 │ │ zvm │ s390 z/VM │
41 │ ├────────────────┼─────────────────────┤
42 │ │ vmware │ VMware Workstation │
43 │ │ │ or Server, and │
44 │ │ │ related products │
45 │ ├────────────────┼─────────────────────┤
46 │ │ microsoft │ Hyper-V, also known │
47 │ │ │ as Viridian or │
48 │ │ │ Windows Server │
49 │ │ │ Virtualization │
50 │ ├────────────────┼─────────────────────┤
51 │ │ oracle │ Oracle VM │
52 │ │ │ VirtualBox │
53 │ │ │ (historically │
54 │ │ │ marketed by innotek │
55 │ │ │ and Sun │
56 │ │ │ Microsystems), for │
57 │ │ │ legacy and KVM │
58 │ │ │ hypervisor │
59 │ ├────────────────┼─────────────────────┤
60 │ │ xen │ Xen hypervisor │
61 │ │ │ (only domU, not │
62 │ │ │ dom0) │
63 │ ├────────────────┼─────────────────────┤
64 │ │ bochs │ Bochs Emulator │
65 │ ├────────────────┼─────────────────────┤
66 │ │ uml │ User-mode Linux │
67 │ ├────────────────┼─────────────────────┤
68 │ │ parallels │ Parallels Desktop, │
69 │ │ │ Parallels Server │
70 │ ├────────────────┼─────────────────────┤
71 │ │ bhyve │ bhyve, FreeBSD │
72 │ │ │ hypervisor │
73 │ ├────────────────┼─────────────────────┤
74 │ │ qnx │ QNX hypervisor │
75 ├──────────┼────────────────┼─────────────────────┤
76 │Container │ openvz │ OpenVZ/Virtuozzo │
77 │ ├────────────────┼─────────────────────┤
78 │ │ lxc │ Linux container │
79 │ │ │ implementation by │
80 │ │ │ LXC │
81 │ ├────────────────┼─────────────────────┤
82 │ │ lxc-libvirt │ Linux container │
83 │ │ │ implementation by │
84 │ │ │ libvirt │
85 │ ├────────────────┼─────────────────────┤
86 │ │ systemd-nspawn │ systemd's minimal │
87 │ │ │ container │
88 │ │ │ implementation, see │
89 │ │ │ systemd-nspawn(1) │
90 │ ├────────────────┼─────────────────────┤
91 │ │ docker │ Docker container │
92 │ │ │ manager │
93 │ ├────────────────┼─────────────────────┤
94 │ │ rkt │ rkt app container │
95 │ │ │ runtime │
96 └──────────┴────────────────┴─────────────────────┘
97
98 If multiple virtualization solutions are used, only the "innermost" is
99 detected and identified. That means if both machine and container
100 virtualization are used in conjunction, only the latter will be
101 identified (unless --vm is passed).
102
104 The following options are understood:
105
106 -c, --container
107 Only detects container virtualization (i.e. shared kernel
108 virtualization).
109
110 -v, --vm
111 Only detects hardware virtualization).
112
113 -r, --chroot
114 Detect whether invoked in a chroot(2) environment. In this mode, no
115 output is written, but the return value indicates whether the
116 process was invoked in a chroot() environment or not.
117
118 --private-users
119 Detect whether invoked in a user namespace. In this mode, no output
120 is written, but the return value indicates whether the process was
121 invoked inside of a user namespace or not. See user_namespaces(7)
122 for more information.
123
124 -q, --quiet
125 Suppress output of the virtualization technology identifier.
126
127 --list
128 Output all currently known and detectable container and VM
129 environments.
130
131 -h, --help
132 Print a short help text and exit.
133
134 --version
135 Print a short version string and exit.
136
138 If a virtualization technology is detected, 0 is returned, a non-zero
139 code otherwise.
140
142 systemd(1), systemd-nspawn(1), chroot(2), namespaces(7)
143
144
145
146systemd 239 SYSTEMD-DETECT-VIRT(1)