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