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, in │
36       │          │                    │ combination with    │
37       │          │                    │ QEMU. Not used for  │
38       │          │                    │ other virtualizers  │
39       │          │                    │ using the KVM       │
40       │          │                    │ interfaces, such as │
41       │          │                    │ Oracle VirtualBox   │
42       │          │                    │ or Amazon EC2       │
43       │          │                    │ Nitro, see below.   │
44       │          ├────────────────────┼─────────────────────┤
45       │          │ amazon             │ Amazon EC2 Nitro    │
46       │          │                    │ using Linux KVM     │
47       │          ├────────────────────┼─────────────────────┤
48       │          │ zvm                │ s390 z/VM           │
49       │          ├────────────────────┼─────────────────────┤
50       │          │ vmware             │ VMware Workstation  │
51       │          │                    │ or Server, and      │
52       │          │                    │ related products    │
53       │          ├────────────────────┼─────────────────────┤
54       │          │ microsoft          │ Hyper-V, also known │
55       │          │                    │ as Viridian or      │
56       │          │                    │ Windows Server      │
57       │          │                    │ Virtualization      │
58       │          ├────────────────────┼─────────────────────┤
59       │          │ oracle             │ Oracle VM           │
60       │          │                    │ VirtualBox          │
61       │          │                    │ (historically       │
62       │          │                    │ marketed by innotek │
63       │          │                    │ and Sun             │
64       │          │                    │ Microsystems), for  │
65       │          │                    │ legacy and KVM      │
66       │          │                    │ hypervisor          │
67       │          ├────────────────────┼─────────────────────┤
68       │          │ powervm            │ IBM PowerVM         │
69       │          │                    │ hypervisor — comes  │
70       │          │                    │ as firmware with    │
71       │          │                    │ some IBM POWER      │
72       │          │                    │ servers             │
73       │          ├────────────────────┼─────────────────────┤
74       │          │ xen                │ Xen hypervisor      │
75       │          │                    │ (only domU, not     │
76       │          │                    │ dom0)               │
77       │          ├────────────────────┼─────────────────────┤
78       │          │ bochs              │ Bochs Emulator      │
79       │          ├────────────────────┼─────────────────────┤
80       │          │ uml                │ User-mode Linux     │
81       │          ├────────────────────┼─────────────────────┤
82       │          │ parallels          │ Parallels Desktop,  │
83       │          │                    │ Parallels Server    │
84       │          ├────────────────────┼─────────────────────┤
85       │          │ bhyve              │ bhyve, FreeBSD      │
86       │          │                    │ hypervisor          │
87       │          ├────────────────────┼─────────────────────┤
88       │          │ qnx                │ QNX hypervisor      │
89       ├──────────┼────────────────────┼─────────────────────┤
90acrnACRN hypervisor[1] │                     │
91       ├──────────┼────────────────────┼─────────────────────┤
92       │Container │ openvz             │ OpenVZ/Virtuozzo    │
93       │          ├────────────────────┼─────────────────────┤
94       │          │ lxc                │ Linux container     │
95       │          │                    │ implementation by   │
96       │          │                    │ LXC                 │
97       │          ├────────────────────┼─────────────────────┤
98       │          │ lxc-libvirt        │ Linux container     │
99       │          │                    │ implementation by   │
100       │          │                    │ libvirt             │
101       │          ├────────────────────┼─────────────────────┤
102       │          │ systemd-nspawn     │ systemd's minimal   │
103       │          │                    │ container           │
104       │          │                    │ implementation, see │
105       │          │                    │ systemd-nspawn(1)
106       │          ├────────────────────┼─────────────────────┤
107       │          │ docker             │ Docker container    │
108       │          │                    │ manager             │
109       │          ├────────────────────┼─────────────────────┤
110       │          │ podmanPodman[2] container │
111       │          │                    │ manager             │
112       │          ├────────────────────┼─────────────────────┤
113       │          │ rkt                │ rkt app container   │
114       │          │                    │ runtime             │
115       │          ├────────────────────┼─────────────────────┤
116       │          │ wslWindows Subsystem   
117       │          │                    │ for Linux[3]        │
118       │          ├────────────────────┼─────────────────────┤
119       │          │ prootproot[4] userspace  │
120       │          │                    │ chroot/bind mount   │
121       │          │                    │ emulation           │
122       │          ├────────────────────┼─────────────────────┤
123       │          │ pouchPouch[5] Container  │
124       │          │                    │ Engine              │
125       └──────────┴────────────────────┴─────────────────────┘
126
127       If multiple virtualization solutions are used, only the "innermost" is
128       detected and identified. That means if both machine and container
129       virtualization are used in conjunction, only the latter will be
130       identified (unless --vm is passed).
131
132       Windows Subsystem for Linux is not a Linux container, but an
133       environment for running Linux userspace applications on top of the
134       Windows kernel using a Linux-compatible interface. WSL is categorized
135       as a container for practical purposes. Multiple WSL environments share
136       the same kernel and services should generally behave like when being
137       run in a container.
138

OPTIONS

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

EXIT STATUS

174       If a virtualization technology is detected, 0 is returned, a non-zero
175       code otherwise.
176

SEE ALSO

178       systemd(1), systemd-nspawn(1), chroot(2), namespaces(7)
179

NOTES

181        1. ACRN hypervisor
182           https://projectacrn.org
183
184        2. Podman
185           https://podman.io
186
187        3. Windows Subsystem for Linux
188           https://docs.microsoft.com/en-us/windows/wsl/about
189
190        4. proot
191           https://proot-me.github.io/
192
193        5. Pouch
194           https://github.com/alibaba/pouch
195
196
197
198systemd 249                                             SYSTEMD-DETECT-VIRT(1)
Impressum