1SYSTEMD-DETECT-VIRT(1)        systemd-detect-virt       SYSTEMD-DETECT-VIRT(1)
2
3
4

NAME

6       systemd-detect-virt - Detect execution in a virtualized environment
7

SYNOPSIS

9       systemd-detect-virt [OPTIONS...]
10

DESCRIPTION

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       ┌──────────┬────────────────┬─────────────────────┐
28Type      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       │          │ powervm        │ IBM PowerVM         │
61       │          │                │ hypervisor — comes  │
62       │          │                │ as firmware with    │
63       │          │                │ some IBM POWER      │
64       │          │                │ servers             │
65       │          ├────────────────┼─────────────────────┤
66       │          │ xen            │ Xen hypervisor      │
67       │          │                │ (only domU, not     │
68       │          │                │ dom0)               │
69       │          ├────────────────┼─────────────────────┤
70       │          │ bochs          │ Bochs Emulator      │
71       │          ├────────────────┼─────────────────────┤
72       │          │ uml            │ User-mode Linux     │
73       │          ├────────────────┼─────────────────────┤
74       │          │ parallels      │ Parallels Desktop,  │
75       │          │                │ Parallels Server    │
76       │          ├────────────────┼─────────────────────┤
77       │          │ bhyve          │ bhyve, FreeBSD      │
78       │          │                │ hypervisor          │
79       │          ├────────────────┼─────────────────────┤
80       │          │ qnx            │ QNX hypervisor      │
81       │          ├────────────────┼─────────────────────┤
82       │          │ acrnACRN hypervisor[1]  │
83       ├──────────┼────────────────┼─────────────────────┤
84       │Container │ openvz         │ OpenVZ/Virtuozzo    │
85       │          ├────────────────┼─────────────────────┤
86       │          │ lxc            │ Linux container     │
87       │          │                │ implementation by   │
88       │          │                │ LXC                 │
89       │          ├────────────────┼─────────────────────┤
90       │          │ lxc-libvirt    │ Linux container     │
91       │          │                │ implementation by   │
92       │          │                │ libvirt             │
93       │          ├────────────────┼─────────────────────┤
94       │          │ systemd-nspawn │ systemd's minimal   │
95       │          │                │ container           │
96       │          │                │ implementation, see │
97       │          │                │ systemd-nspawn(1)
98       │          ├────────────────┼─────────────────────┤
99       │          │ docker         │ Docker container    │
100       │          │                │ manager             │
101       │          ├────────────────┼─────────────────────┤
102       │          │ podmanPodman[2] container │
103       │          │                │ manager             │
104       │          ├────────────────┼─────────────────────┤
105       │          │ rkt            │ rkt app container   │
106       │          │                │ runtime             │
107       │          ├────────────────┼─────────────────────┤
108       │          │ wslWindows Subsystem   
109       │          │                │ for Linux[3]        │
110       │          ├────────────────┼─────────────────────┤
111       │          │ prootproot[4] userspace  │
112       │          │                │ chroot/bind mount   │
113       │          │                │ emulation           │
114       │          ├────────────────┼─────────────────────┤
115       │          │ pouchPouch[5] Container  │
116       │          │                │ Engine              │
117       └──────────┴────────────────┴─────────────────────┘
118
119       If multiple virtualization solutions are used, only the "innermost" is
120       detected and identified. That means if both machine and container
121       virtualization are used in conjunction, only the latter will be
122       identified (unless --vm is passed).
123
124       Windows Subsystem for Linux is not a Linux container, but an
125       environment for running Linux userspace applications on top of the
126       Windows kernel using a Linux-compatible interface. WSL is categorized
127       as a container for practical purposes. Multiple WSL environments share
128       the same kernel and services should generally behave like when being
129       run in a container.
130

OPTIONS

132       The following options are understood:
133
134       -c, --container
135           Only detects container virtualization (i.e. shared kernel
136           virtualization).
137
138       -v, --vm
139           Only detects hardware virtualization.
140
141       -r, --chroot
142           Detect whether invoked in a chroot(2) environment. In this mode, no
143           output is written, but the return value indicates whether the
144           process was invoked in a chroot() environment or not.
145
146       --private-users
147           Detect whether invoked in a user namespace. In this mode, no output
148           is written, but the return value indicates whether the process was
149           invoked inside of a user namespace or not. See user_namespaces(7)
150           for more information.
151
152       -q, --quiet
153           Suppress output of the virtualization technology identifier.
154
155       --list
156           Output all currently known and detectable container and VM
157           environments.
158
159       -h, --help
160           Print a short help text and exit.
161
162       --version
163           Print a short version string and exit.
164

EXIT STATUS

166       If a virtualization technology is detected, 0 is returned, a non-zero
167       code otherwise.
168

SEE ALSO

170       systemd(1), systemd-nspawn(1), chroot(2), namespaces(7)
171

NOTES

173        1. ACRN hypervisor
174           https://projectacrn.org
175
176        2. Podman
177           https://podman.io
178
179        3. Windows Subsystem for Linux
180           https://docs.microsoft.com/en-us/windows/wsl/about
181
182        4. proot
183           https://proot-me.github.io/
184
185        5. Pouch
186           https://github.com/alibaba/pouch
187
188
189
190systemd 248                                             SYSTEMD-DETECT-VIRT(1)
Impressum