]>
Commit | Line | Data |
---|---|---|
2c4ff634 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
2c4ff634 | 5 | |
dfdebb1b | 6 | <refentry id="systemd-detect-virt" |
6d0c987d | 7 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
798d3a52 ZJS |
8 | |
9 | <refentryinfo> | |
10 | <title>systemd-detect-virt</title> | |
11 | <productname>systemd</productname> | |
798d3a52 ZJS |
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> | |
299a34c1 ZJS |
26 | <command>systemd-detect-virt</command> |
27 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
798d3a52 ZJS |
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 | |
9c5baa43 | 36 | technology and can distinguish full machine virtualization from |
798d3a52 ZJS |
37 | container virtualization. <filename>systemd-detect-virt</filename> |
38 | exits with a return value of 0 (success) if a virtualization | |
b938cb90 | 39 | technology is detected, and non-zero (error) otherwise. By default, |
798d3a52 ZJS |
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> | |
6d0c987d ZJS |
58 | <entry>Type</entry> |
59 | <entry>ID</entry> | |
60 | <entry>Product</entry> | |
798d3a52 ZJS |
61 | </row> |
62 | </thead> | |
63 | <tbody> | |
64 | <row> | |
90fb1f09 | 65 | <entry valign="top" morerows="12">VM</entry> |
6d0c987d | 66 | <entry><varname>qemu</varname></entry> |
5f1c788c | 67 | <entry>QEMU software virtualization, without KVM</entry> |
798d3a52 ZJS |
68 | </row> |
69 | ||
70 | <row> | |
6d0c987d | 71 | <entry><varname>kvm</varname></entry> |
d225fedb | 72 | <entry>Linux KVM kernel virtual machine, with whatever software, except Oracle Virtualbox</entry> |
798d3a52 ZJS |
73 | </row> |
74 | ||
75 | <row> | |
6d0c987d ZJS |
76 | <entry><varname>zvm</varname></entry> |
77 | <entry>s390 z/VM</entry> | |
798d3a52 ZJS |
78 | </row> |
79 | ||
80 | <row> | |
6d0c987d ZJS |
81 | <entry><varname>vmware</varname></entry> |
82 | <entry>VMware Workstation or Server, and related products</entry> | |
798d3a52 ZJS |
83 | </row> |
84 | ||
85 | <row> | |
6d0c987d ZJS |
86 | <entry><varname>microsoft</varname></entry> |
87 | <entry>Hyper-V, also known as Viridian or Windows Server Virtualization</entry> | |
798d3a52 ZJS |
88 | </row> |
89 | ||
90 | <row> | |
6d0c987d | 91 | <entry><varname>oracle</varname></entry> |
d225fedb | 92 | <entry>Oracle VM VirtualBox (historically marketed by innotek and Sun Microsystems), for legacy and KVM hypervisor</entry> |
798d3a52 ZJS |
93 | </row> |
94 | ||
95 | <row> | |
6d0c987d ZJS |
96 | <entry><varname>xen</varname></entry> |
97 | <entry>Xen hypervisor (only domU, not dom0)</entry> | |
798d3a52 ZJS |
98 | </row> |
99 | ||
100 | <row> | |
6d0c987d ZJS |
101 | <entry><varname>bochs</varname></entry> |
102 | <entry>Bochs Emulator</entry> | |
798d3a52 ZJS |
103 | </row> |
104 | ||
105 | <row> | |
6d0c987d ZJS |
106 | <entry><varname>uml</varname></entry> |
107 | <entry>User-mode Linux</entry> | |
798d3a52 ZJS |
108 | </row> |
109 | ||
d84248eb | 110 | <row> |
6d0c987d ZJS |
111 | <entry><varname>parallels</varname></entry> |
112 | <entry>Parallels Desktop, Parallels Server</entry> | |
d84248eb EV |
113 | </row> |
114 | ||
1fdf07f5 | 115 | <row> |
aa0c3427 LBS |
116 | <entry><varname>bhyve</varname></entry> |
117 | <entry>bhyve, FreeBSD hypervisor</entry> | |
1fdf07f5 SL |
118 | </row> |
119 | ||
120 | <row> | |
121 | <entry><varname>qnx</varname></entry> | |
122 | <entry>QNX hypervisor</entry> | |
aa0c3427 LBS |
123 | </row> |
124 | ||
0f0e30ad RB |
125 | <row> |
126 | <entry><varname>acrn</varname></entry> | |
127 | <entry><ulink url="https://projectacrn.org">ACRN hypervisor</ulink></entry> | |
128 | </row> | |
129 | ||
798d3a52 | 130 | <row> |
90fb1f09 | 131 | <entry valign="top" morerows="7">Container</entry> |
6d0c987d ZJS |
132 | <entry><varname>openvz</varname></entry> |
133 | <entry>OpenVZ/Virtuozzo</entry> | |
798d3a52 ZJS |
134 | </row> |
135 | ||
136 | <row> | |
6d0c987d ZJS |
137 | <entry><varname>lxc</varname></entry> |
138 | <entry>Linux container implementation by LXC</entry> | |
798d3a52 ZJS |
139 | </row> |
140 | ||
141 | <row> | |
6d0c987d ZJS |
142 | <entry><varname>lxc-libvirt</varname></entry> |
143 | <entry>Linux container implementation by libvirt</entry> | |
798d3a52 ZJS |
144 | </row> |
145 | ||
146 | <row> | |
6d0c987d ZJS |
147 | <entry><varname>systemd-nspawn</varname></entry> |
148 | <entry>systemd's minimal container implementation, see <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry></entry> | |
798d3a52 ZJS |
149 | </row> |
150 | ||
151 | <row> | |
6d0c987d ZJS |
152 | <entry><varname>docker</varname></entry> |
153 | <entry>Docker container manager</entry> | |
798d3a52 | 154 | </row> |
9fb16425 | 155 | |
90fb1f09 ZJS |
156 | <row> |
157 | <entry><varname>podman</varname></entry> | |
158 | <entry><ulink url="https://podman.io">Podman</ulink> container manager</entry> | |
159 | </row> | |
160 | ||
9fb16425 | 161 | <row> |
6d0c987d ZJS |
162 | <entry><varname>rkt</varname></entry> |
163 | <entry>rkt app container runtime</entry> | |
9fb16425 | 164 | </row> |
6c8a2c67 BR |
165 | |
166 | <row> | |
167 | <entry><varname>wsl</varname></entry> | |
168 | <entry><ulink url="https://docs.microsoft.com/en-us/windows/wsl/about">Windows Subsystem for Linux</ulink></entry> | |
169 | </row> | |
80cc3e3e CD |
170 | |
171 | <row> | |
172 | <entry><varname>proot</varname></entry> | |
173 | <entry><ulink url="https://proot-me.github.io/">proot</ulink> userspace chroot/bind mount emulation</entry> | |
174 | </row> | |
798d3a52 ZJS |
175 | </tbody> |
176 | </tgroup> | |
177 | </table> | |
178 | ||
179 | <para>If multiple virtualization solutions are used, only the | |
9c5baa43 JE |
180 | "innermost" is detected and identified. That means if both |
181 | machine and container virtualization are used in | |
798d3a52 ZJS |
182 | conjunction, only the latter will be identified (unless |
183 | <option>--vm</option> is passed).</para> | |
6c8a2c67 BR |
184 | <para> Windows Subsystem for Linux is not a Linux container, |
185 | but an environment for running Linux userspace applications on | |
186 | top of the Windows kernel using a Linux-compatible interface. | |
187 | WSL is categorized as a container for practical purposes. | |
188 | Multiple WSL environments share the same kernel and services | |
189 | should generally behave like when being run in a container.</para> | |
798d3a52 ZJS |
190 | </refsect1> |
191 | ||
192 | <refsect1> | |
193 | <title>Options</title> | |
194 | ||
195 | <para>The following options are understood:</para> | |
196 | ||
197 | <variablelist> | |
198 | <varlistentry> | |
199 | <term><option>-c</option></term> | |
200 | <term><option>--container</option></term> | |
201 | ||
202 | <listitem><para>Only detects container virtualization (i.e. | |
203 | shared kernel virtualization).</para></listitem> | |
204 | </varlistentry> | |
205 | ||
206 | <varlistentry> | |
207 | <term><option>-v</option></term> | |
208 | <term><option>--vm</option></term> | |
209 | ||
4ee17545 | 210 | <listitem><para>Only detects hardware virtualization.</para></listitem> |
798d3a52 ZJS |
211 | </varlistentry> |
212 | ||
d21be5ff LP |
213 | <varlistentry> |
214 | <term><option>-r</option></term> | |
215 | <term><option>--chroot</option></term> | |
216 | ||
217 | <listitem><para>Detect whether invoked in a | |
218 | <citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
b938cb90 | 219 | environment. In this mode, no output is written, but the return |
d21be5ff LP |
220 | value indicates whether the process was invoked in a |
221 | <function>chroot()</function> | |
222 | environment or not.</para></listitem> | |
223 | </varlistentry> | |
224 | ||
299a34c1 ZJS |
225 | <varlistentry> |
226 | <term><option>--private-users</option></term> | |
227 | ||
228 | <listitem><para>Detect whether invoked in a user namespace. In this mode, no | |
229 | output is written, but the return value indicates whether the process was invoked | |
230 | inside of a user namespace or not. See | |
231 | <citerefentry project='man-pages'><refentrytitle>user_namespaces</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
232 | for more information.</para></listitem> | |
233 | </varlistentry> | |
234 | ||
798d3a52 ZJS |
235 | <varlistentry> |
236 | <term><option>-q</option></term> | |
237 | <term><option>--quiet</option></term> | |
238 | ||
239 | <listitem><para>Suppress output of the virtualization | |
240 | technology identifier.</para></listitem> | |
241 | </varlistentry> | |
242 | ||
39824629 LP |
243 | <varlistentry> |
244 | <term><option>--list</option></term> | |
245 | ||
246 | <listitem><para>Output all currently known and detectable container and VM environments.</para></listitem> | |
247 | </varlistentry> | |
248 | ||
798d3a52 ZJS |
249 | <xi:include href="standard-options.xml" xpointer="help" /> |
250 | <xi:include href="standard-options.xml" xpointer="version" /> | |
251 | </variablelist> | |
252 | ||
253 | </refsect1> | |
254 | ||
255 | <refsect1> | |
256 | <title>Exit status</title> | |
257 | ||
258 | <para>If a virtualization technology is detected, 0 is returned, a | |
259 | non-zero code otherwise.</para> | |
260 | </refsect1> | |
261 | ||
262 | <refsect1> | |
263 | <title>See Also</title> | |
264 | <para> | |
265 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
d21be5ff | 266 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
299a34c1 ZJS |
267 | <citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry>, |
268 | <citerefentry project='man-pages'><refentrytitle>namespaces</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
798d3a52 ZJS |
269 | </para> |
270 | </refsect1> | |
2c4ff634 LP |
271 | |
272 | </refentry> |