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