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">
6 This file is part of systemd.
8 Copyright 2010 Lennart Poettering
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.
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.
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/>.
24 <refentry id=
"systemd-detect-virt"
25 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
28 <title>systemd-detect-virt
</title>
29 <productname>systemd
</productname>
33 <contrib>Developer
</contrib>
34 <firstname>Lennart
</firstname>
35 <surname>Poettering
</surname>
36 <email>lennart@poettering.net
</email>
42 <refentrytitle>systemd-detect-virt
</refentrytitle>
43 <manvolnum>1</manvolnum>
47 <refname>systemd-detect-virt
</refname>
48 <refpurpose>Detect execution in a virtualized environment
</refpurpose>
53 <command>systemd-detect-virt
<arg choice=
"opt" rep=
"repeat">OPTIONS
</arg></command>
58 <title>Description
</title>
60 <para><command>systemd-detect-virt
</command> detects execution in
61 a virtualized environment. It identifies the virtualization
62 technology and can distinguish full machine virtualization from
63 container virtualization.
<filename>systemd-detect-virt
</filename>
64 exits with a return value of
0 (success) if a virtualization
65 technology is detected, and non-zero (error) otherwise. By default,
66 any type of virtualization is detected, and the options
67 <option>--container
</option> and
<option>--vm
</option> can be used
68 to limit what types of virtualization are detected.
</para>
70 <para>When executed without
<option>--quiet
</option> will print a
71 short identifier for the detected virtualization technology. The
72 following technologies are currently identified:
</para>
75 <title>Known virtualization technologies (both
76 VM, i.e. full hardware virtualization,
77 and container, i.e. shared kernel virtualization)
</title>
78 <tgroup cols='
3' align='left' colsep='
1' rowsep='
1'
>
79 <colspec colname=
"type" />
80 <colspec colname=
"id" />
81 <colspec colname=
"product" />
86 <entry>Product
</entry>
91 <entry valign=
"top" morerows=
"10">VM
</entry>
92 <entry><varname>qemu
</varname></entry>
93 <entry>QEMU software virtualization
</entry>
97 <entry><varname>kvm
</varname></entry>
98 <entry>Linux KVM kernel virtual machine
</entry>
102 <entry><varname>zvm
</varname></entry>
103 <entry>s390 z/VM
</entry>
107 <entry><varname>vmware
</varname></entry>
108 <entry>VMware Workstation or Server, and related products
</entry>
112 <entry><varname>microsoft
</varname></entry>
113 <entry>Hyper-V, also known as Viridian or Windows Server Virtualization
</entry>
117 <entry><varname>oracle
</varname></entry>
118 <entry>Oracle VM VirtualBox (historically marketed by innotek and Sun Microsystems)
</entry>
122 <entry><varname>xen
</varname></entry>
123 <entry>Xen hypervisor (only domU, not dom0)
</entry>
127 <entry><varname>bochs
</varname></entry>
128 <entry>Bochs Emulator
</entry>
132 <entry><varname>uml
</varname></entry>
133 <entry>User-mode Linux
</entry>
137 <entry><varname>parallels
</varname></entry>
138 <entry>Parallels Desktop, Parallels Server
</entry>
142 <entry><varname>bhyve
</varname></entry>
143 <entry>bhyve, FreeBSD hypervisor
</entry>
147 <entry valign=
"top" morerows=
"5">Container
</entry>
148 <entry><varname>openvz
</varname></entry>
149 <entry>OpenVZ/Virtuozzo
</entry>
153 <entry><varname>lxc
</varname></entry>
154 <entry>Linux container implementation by LXC
</entry>
158 <entry><varname>lxc-libvirt
</varname></entry>
159 <entry>Linux container implementation by libvirt
</entry>
163 <entry><varname>systemd-nspawn
</varname></entry>
164 <entry>systemd's minimal container implementation, see
<citerefentry><refentrytitle>systemd-nspawn
</refentrytitle><manvolnum>1</manvolnum></citerefentry></entry>
168 <entry><varname>docker
</varname></entry>
169 <entry>Docker container manager
</entry>
173 <entry><varname>rkt
</varname></entry>
174 <entry>rkt app container runtime
</entry>
180 <para>If multiple virtualization solutions are used, only the
181 "innermost" is detected and identified. That means if both
182 machine and container virtualization are used in
183 conjunction, only the latter will be identified (unless
184 <option>--vm
</option> is passed).
</para>
188 <title>Options
</title>
190 <para>The following options are understood:
</para>
194 <term><option>-c
</option></term>
195 <term><option>--container
</option></term>
197 <listitem><para>Only detects container virtualization (i.e.
198 shared kernel virtualization).
</para></listitem>
202 <term><option>-v
</option></term>
203 <term><option>--vm
</option></term>
205 <listitem><para>Only detects hardware virtualization).
</para></listitem>
209 <term><option>-r
</option></term>
210 <term><option>--chroot
</option></term>
212 <listitem><para>Detect whether invoked in a
213 <citerefentry><refentrytitle>chroot
</refentrytitle><manvolnum>2</manvolnum></citerefentry>
214 environment. In this mode, no output is written, but the return
215 value indicates whether the process was invoked in a
216 <function>chroot()
</function>
217 environment or not.
</para></listitem>
221 <term><option>-q
</option></term>
222 <term><option>--quiet
</option></term>
224 <listitem><para>Suppress output of the virtualization
225 technology identifier.
</para></listitem>
228 <xi:include href=
"standard-options.xml" xpointer=
"help" />
229 <xi:include href=
"standard-options.xml" xpointer=
"version" />
235 <title>Exit status
</title>
237 <para>If a virtualization technology is detected,
0 is returned, a
238 non-zero code otherwise.
</para>
242 <title>See Also
</title>
244 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
245 <citerefentry><refentrytitle>systemd-nspawn
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
246 <citerefentry><refentrytitle>chroot
</refentrytitle><manvolnum>2</manvolnum></citerefentry>