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