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