1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
'\" t
.TH "SYSTEMD\-DETECT\-VIRT" "1" "" "systemd 255" "systemd-detect-virt"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd-detect-virt \- Detect execution in a virtualized environment
.SH "SYNOPSIS"
.HP \w'\fBsystemd\-detect\-virt\fR\ 'u
\fBsystemd\-detect\-virt\fR [OPTIONS...]
.SH "DESCRIPTION"
.PP
\fBsystemd\-detect\-virt\fR
detects execution in a virtualized environment\&. It identifies the virtualization technology and can distinguish full machine virtualization from container virtualization\&.
systemd\-detect\-virt
exits with a return value of 0 (success) if a virtualization technology is detected, and non\-zero (error) otherwise\&. By default, any type of virtualization is detected, and the options
\fB\-\-container\fR
and
\fB\-\-vm\fR
can be used to limit what types of virtualization are detected\&.
.PP
When executed without
\fB\-\-quiet\fR
will print a short identifier for the detected virtualization technology\&. The following technologies are currently identified:
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.B Table\ \&1.\ \&Known virtualization technologies (both VM, i\&.e\&. full hardware virtualization, and container, i\&.e\&. shared kernel virtualization)
.TS
allbox tab(:);
lB lB lB.
T{
Type
T}:T{
ID
T}:T{
Product
T}
.T&
lt l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
l l l
lt l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l
^ l l.
T{
VM
T}:T{
\fIqemu\fR
T}:T{
QEMU software virtualization, without KVM
T}
:T{
\fIkvm\fR
T}:T{
Linux KVM kernel virtual machine, in combination with QEMU\&. Not used for other virtualizers using the KVM interfaces, such as Oracle VirtualBox or Amazon EC2 Nitro, see below\&.
T}
:T{
\fIamazon\fR
T}:T{
Amazon EC2 Nitro using Linux KVM
T}
:T{
\fIzvm\fR
T}:T{
s390 z/VM
T}
:T{
\fIvmware\fR
T}:T{
VMware Workstation or Server, and related products
T}
:T{
\fImicrosoft\fR
T}:T{
Hyper\-V, also known as Viridian or Windows Server Virtualization
T}
:T{
\fIoracle\fR
T}:T{
Oracle VM VirtualBox (historically marketed by innotek and Sun Microsystems), for legacy and KVM hypervisor
T}
:T{
\fIpowervm\fR
T}:T{
IBM PowerVM hypervisor \(em comes as firmware with some IBM POWER servers
T}
:T{
\fIxen\fR
T}:T{
Xen hypervisor (only domU, not dom0)
T}
:T{
\fIbochs\fR
T}:T{
Bochs Emulator
T}
:T{
\fIuml\fR
T}:T{
User\-mode Linux
T}
:T{
\fIparallels\fR
T}:T{
Parallels Desktop, Parallels Server
T}
:T{
\fIbhyve\fR
T}:T{
bhyve, FreeBSD hypervisor
T}
:T{
\fIqnx\fR
T}:T{
QNX hypervisor
T}
:T{
\fIacrn\fR
T}:T{
\m[blue]\fBACRN hypervisor\fR\m[]\&\s-2\u[1]\d\s+2
T}
:T{
\fIapple\fR
T}:T{
\m[blue]\fBApple virtualization framework\fR\m[]\&\s-2\u[2]\d\s+2
T}
:T{
\fIsre\fR
T}:T{
\m[blue]\fBLMHS SRE hypervisor\fR\m[]\&\s-2\u[3]\d\s+2
T}
T{
\fIgoogle\fR
T}:T{
\m[blue]\fBGoogle Compute Engine\fR\m[]\&\s-2\u[4]\d\s+2
T}:T{
\ \&
T}
T{
Container
T}:T{
\fIopenvz\fR
T}:T{
OpenVZ/Virtuozzo
T}
:T{
\fIlxc\fR
T}:T{
Linux container implementation by LXC
T}
:T{
\fIlxc\-libvirt\fR
T}:T{
Linux container implementation by libvirt
T}
:T{
\fIsystemd\-nspawn\fR
T}:T{
systemd\*(Aqs minimal container implementation, see \fBsystemd-nspawn\fR(1)
T}
:T{
\fIdocker\fR
T}:T{
Docker container manager
T}
:T{
\fIpodman\fR
T}:T{
\m[blue]\fBPodman\fR\m[]\&\s-2\u[5]\d\s+2 container manager
T}
:T{
\fIrkt\fR
T}:T{
rkt app container runtime
T}
:T{
\fIwsl\fR
T}:T{
\m[blue]\fBWindows Subsystem for Linux\fR\m[]\&\s-2\u[6]\d\s+2
T}
:T{
\fIproot\fR
T}:T{
\m[blue]\fBproot\fR\m[]\&\s-2\u[7]\d\s+2 userspace chroot/bind mount emulation
T}
:T{
\fIpouch\fR
T}:T{
\m[blue]\fBPouch\fR\m[]\&\s-2\u[8]\d\s+2 Container Engine
T}
.TE
.sp 1
.PP
If multiple virtualization solutions are used, only the "innermost" is detected and identified\&. That means if both machine and container virtualization are used in conjunction, only the latter will be identified (unless
\fB\-\-vm\fR
is passed)\&.
.PP
Windows Subsystem for Linux is not a Linux container, but an environment for running Linux userspace applications on top of the Windows kernel using a Linux\-compatible interface\&. WSL is categorized as a container for practical purposes\&. Multiple WSL environments share the same kernel and services should generally behave like when being run in a container\&.
.SH "OPTIONS"
.PP
The following options are understood:
.PP
\fB\-c\fR, \fB\-\-container\fR
.RS 4
Only detects container virtualization (i\&.e\&. shared kernel virtualization)\&.
.RE
.PP
\fB\-v\fR, \fB\-\-vm\fR
.RS 4
Only detects hardware virtualization\&.
.RE
.PP
\fB\-r\fR, \fB\-\-chroot\fR
.RS 4
Detect whether invoked in a
\fBchroot\fR(2)
environment\&. In this mode, no output is written, but the return value indicates whether the process was invoked in a
\fBchroot()\fR
environment or not\&.
.sp
Added in version 228\&.
.RE
.PP
\fB\-\-private\-users\fR
.RS 4
Detect whether invoked in a user namespace\&. In this mode, no output is written, but the return value indicates whether the process was invoked inside of a user namespace or not\&. See
\fBuser_namespaces\fR(7)
for more information\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-cvm\fR
.RS 4
Detect whether invoked in a confidential virtual machine\&. The result of this detection may be used to disable features that should not be used in confidential VMs\&. It must not be used to release security sensitive information\&. The latter must only be released after attestation of the confidential environment\&.
.sp
Added in version 254\&.
.RE
.PP
\fB\-q\fR, \fB\-\-quiet\fR
.RS 4
Suppress output of the virtualization technology identifier\&.
.RE
.PP
\fB\-\-list\fR
.RS 4
Output all currently known and detectable container and VM environments\&.
.sp
Added in version 239\&.
.RE
.PP
\fB\-\-list\-cvm\fR
.RS 4
Output all currently known and detectable confidential virtualization technologies\&.
.sp
Added in version 254\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Print a short help text and exit\&.
.RE
.PP
\fB\-\-version\fR
.RS 4
Print a short version string and exit\&.
.RE
.SH "EXIT STATUS"
.PP
If a virtualization technology is detected, 0 is returned, a non\-zero code otherwise\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemd-nspawn\fR(1),
\fBchroot\fR(2),
\fBnamespaces\fR(7)
.SH "NOTES"
.IP " 1." 4
ACRN hypervisor
.RS 4
\%https://projectacrn.org
.RE
.IP " 2." 4
Apple virtualization framework
.RS 4
\%https://developer.apple.com/documentation/virtualization
.RE
.IP " 3." 4
LMHS SRE hypervisor
.RS 4
\%https://www.lockheedmartin.com/en-us/products/Hardened-Security-for-Intel-Processors.html
.RE
.IP " 4." 4
Google Compute Engine
.RS 4
\%https://cloud.google.com/compute
.RE
.IP " 5." 4
Podman
.RS 4
\%https://podman.io
.RE
.IP " 6." 4
Windows Subsystem for Linux
.RS 4
\%https://docs.microsoft.com/en-us/windows/wsl/about
.RE
.IP " 7." 4
proot
.RS 4
\%https://proot-me.github.io/
.RE
.IP " 8." 4
Pouch
.RS 4
\%https://github.com/alibaba/pouch
.RE
|