]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-detect-virt.xml
man: s/dash/mdash/
[thirdparty/systemd.git] / man / systemd-detect-virt.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd-detect-virt"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-detect-virt</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-detect-virt</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-detect-virt</refname>
21 <refpurpose>Detect execution in a virtualized environment</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <cmdsynopsis>
26 <command>systemd-detect-virt</command>
27 <arg choice="opt" rep="repeat">OPTIONS</arg>
28 </cmdsynopsis>
29 </refsynopsisdiv>
30
31 <refsect1>
32 <title>Description</title>
33
34 <para><command>systemd-detect-virt</command> detects execution in
35 a virtualized environment. It identifies the virtualization
36 technology and can distinguish full machine virtualization from
37 container virtualization. <filename>systemd-detect-virt</filename>
38 exits with a return value of 0 (success) if a virtualization
39 technology is detected, and non-zero (error) otherwise. By default,
40 any type of virtualization is detected, and the options
41 <option>--container</option> and <option>--vm</option> can be used
42 to limit what types of virtualization are detected.</para>
43
44 <para>When executed without <option>--quiet</option> will print a
45 short identifier for the detected virtualization technology. The
46 following technologies are currently identified:</para>
47
48 <table>
49 <title>Known virtualization technologies (both
50 VM, i.e. full hardware virtualization,
51 and container, i.e. shared kernel virtualization)</title>
52 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
53 <colspec colname="type" />
54 <colspec colname="id" />
55 <colspec colname="product" />
56 <thead>
57 <row>
58 <entry>Type</entry>
59 <entry>ID</entry>
60 <entry>Product</entry>
61 </row>
62 </thead>
63 <tbody>
64 <row>
65 <entry valign="top" morerows="13">VM</entry>
66 <entry><varname>qemu</varname></entry>
67 <entry>QEMU software virtualization, without KVM</entry>
68 </row>
69
70 <row>
71 <entry><varname>kvm</varname></entry>
72 <entry>Linux KVM kernel virtual machine, with whatever software, except Oracle Virtualbox</entry>
73 </row>
74
75 <row>
76 <entry><varname>zvm</varname></entry>
77 <entry>s390 z/VM</entry>
78 </row>
79
80 <row>
81 <entry><varname>vmware</varname></entry>
82 <entry>VMware Workstation or Server, and related products</entry>
83 </row>
84
85 <row>
86 <entry><varname>microsoft</varname></entry>
87 <entry>Hyper-V, also known as Viridian or Windows Server Virtualization</entry>
88 </row>
89
90 <row>
91 <entry><varname>oracle</varname></entry>
92 <entry>Oracle VM VirtualBox (historically marketed by innotek and Sun Microsystems), for legacy and KVM hypervisor</entry>
93 </row>
94
95 <row>
96 <entry><varname>powervm</varname></entry>
97 <entry>IBM PowerVM hypervisor — comes as firmware with some IBM POWER servers</entry>
98 </row>
99
100 <row>
101 <entry><varname>xen</varname></entry>
102 <entry>Xen hypervisor (only domU, not dom0)</entry>
103 </row>
104
105 <row>
106 <entry><varname>bochs</varname></entry>
107 <entry>Bochs Emulator</entry>
108 </row>
109
110 <row>
111 <entry><varname>uml</varname></entry>
112 <entry>User-mode Linux</entry>
113 </row>
114
115 <row>
116 <entry><varname>parallels</varname></entry>
117 <entry>Parallels Desktop, Parallels Server</entry>
118 </row>
119
120 <row>
121 <entry><varname>bhyve</varname></entry>
122 <entry>bhyve, FreeBSD hypervisor</entry>
123 </row>
124
125 <row>
126 <entry><varname>qnx</varname></entry>
127 <entry>QNX hypervisor</entry>
128 </row>
129
130 <row>
131 <entry><varname>acrn</varname></entry>
132 <entry><ulink url="https://projectacrn.org">ACRN hypervisor</ulink></entry>
133 </row>
134
135 <row>
136 <entry valign="top" morerows="9">Container</entry>
137 <entry><varname>openvz</varname></entry>
138 <entry>OpenVZ/Virtuozzo</entry>
139 </row>
140
141 <row>
142 <entry><varname>lxc</varname></entry>
143 <entry>Linux container implementation by LXC</entry>
144 </row>
145
146 <row>
147 <entry><varname>lxc-libvirt</varname></entry>
148 <entry>Linux container implementation by libvirt</entry>
149 </row>
150
151 <row>
152 <entry><varname>systemd-nspawn</varname></entry>
153 <entry>systemd's minimal container implementation, see <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry></entry>
154 </row>
155
156 <row>
157 <entry><varname>docker</varname></entry>
158 <entry>Docker container manager</entry>
159 </row>
160
161 <row>
162 <entry><varname>podman</varname></entry>
163 <entry><ulink url="https://podman.io">Podman</ulink> container manager</entry>
164 </row>
165
166 <row>
167 <entry><varname>rkt</varname></entry>
168 <entry>rkt app container runtime</entry>
169 </row>
170
171 <row>
172 <entry><varname>wsl</varname></entry>
173 <entry><ulink url="https://docs.microsoft.com/en-us/windows/wsl/about">Windows Subsystem for Linux</ulink></entry>
174 </row>
175
176 <row>
177 <entry><varname>proot</varname></entry>
178 <entry><ulink url="https://proot-me.github.io/">proot</ulink> userspace chroot/bind mount emulation</entry>
179 </row>
180
181 <row>
182 <entry><varname>pouch</varname></entry>
183 <entry><ulink url="https://github.com/alibaba/pouch">Pouch</ulink> Container Engine</entry>
184 </row>
185 </tbody>
186 </tgroup>
187 </table>
188
189 <para>If multiple virtualization solutions are used, only the
190 "innermost" is detected and identified. That means if both
191 machine and container virtualization are used in
192 conjunction, only the latter will be identified (unless
193 <option>--vm</option> is passed).</para>
194 <para> Windows Subsystem for Linux is not a Linux container,
195 but an environment for running Linux userspace applications on
196 top of the Windows kernel using a Linux-compatible interface.
197 WSL is categorized as a container for practical purposes.
198 Multiple WSL environments share the same kernel and services
199 should generally behave like when being run in a container.</para>
200 </refsect1>
201
202 <refsect1>
203 <title>Options</title>
204
205 <para>The following options are understood:</para>
206
207 <variablelist>
208 <varlistentry>
209 <term><option>-c</option></term>
210 <term><option>--container</option></term>
211
212 <listitem><para>Only detects container virtualization (i.e.
213 shared kernel virtualization).</para></listitem>
214 </varlistentry>
215
216 <varlistentry>
217 <term><option>-v</option></term>
218 <term><option>--vm</option></term>
219
220 <listitem><para>Only detects hardware virtualization.</para></listitem>
221 </varlistentry>
222
223 <varlistentry>
224 <term><option>-r</option></term>
225 <term><option>--chroot</option></term>
226
227 <listitem><para>Detect whether invoked in a
228 <citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
229 environment. In this mode, no output is written, but the return
230 value indicates whether the process was invoked in a
231 <function>chroot()</function>
232 environment or not.</para></listitem>
233 </varlistentry>
234
235 <varlistentry>
236 <term><option>--private-users</option></term>
237
238 <listitem><para>Detect whether invoked in a user namespace. In this mode, no
239 output is written, but the return value indicates whether the process was invoked
240 inside of a user namespace or not. See
241 <citerefentry project='man-pages'><refentrytitle>user_namespaces</refentrytitle><manvolnum>7</manvolnum></citerefentry>
242 for more information.</para></listitem>
243 </varlistentry>
244
245 <varlistentry>
246 <term><option>-q</option></term>
247 <term><option>--quiet</option></term>
248
249 <listitem><para>Suppress output of the virtualization
250 technology identifier.</para></listitem>
251 </varlistentry>
252
253 <varlistentry>
254 <term><option>--list</option></term>
255
256 <listitem><para>Output all currently known and detectable container and VM environments.</para></listitem>
257 </varlistentry>
258
259 <xi:include href="standard-options.xml" xpointer="help" />
260 <xi:include href="standard-options.xml" xpointer="version" />
261 </variablelist>
262
263 </refsect1>
264
265 <refsect1>
266 <title>Exit status</title>
267
268 <para>If a virtualization technology is detected, 0 is returned, a
269 non-zero code otherwise.</para>
270 </refsect1>
271
272 <refsect1>
273 <title>See Also</title>
274 <para>
275 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
276 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
277 <citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
278 <citerefentry project='man-pages'><refentrytitle>namespaces</refentrytitle><manvolnum>7</manvolnum></citerefentry>
279 </para>
280 </refsect1>
281
282 </refentry>