2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering This file is part of systemd.
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering Copyright 2010 Lennart Poettering
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering systemd is free software; you can redistribute it and/or modify it
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering under the terms of the GNU Lesser General Public License as published by
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering (at your option) any later version.
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering systemd is distributed in the hope that it will be useful, but
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering Lesser General Public License for more details.
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering You should have received a copy of the GNU Lesser General Public License
2c4ff63406c80839c6c8e838c1279934a0bc150eLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
dfdebb1b925332352966804303b2516a6506a429Zbigniew Jędrzejewski-Szmek<refentry id="systemd-detect-virt"
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek xmlns:xi="http://www.w3.org/2001/XInclude">
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <title>systemd-detect-virt</title>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <productname>systemd</productname>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <email>lennart@poettering.net</email>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <refentrytitle>systemd-detect-virt</refentrytitle>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <refname>systemd-detect-virt</refname>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <refpurpose>Detect execution in a virtualized environment</refpurpose>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <refsynopsisdiv>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <command>systemd-detect-virt <arg choice="opt" rep="repeat">OPTIONS</arg></command>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek </refsynopsisdiv>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <para><command>systemd-detect-virt</command> detects execution in
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek a virtualized environment. It identifies the virtualization
9c5baa43ae5cd22a16fd056e3c40815c90d008cdJan Engelhardt technology and can distinguish full machine virtualization from
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek container virtualization. <filename>systemd-detect-virt</filename>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek exits with a return value of 0 (success) if a virtualization
b938cb902c3b5bca807a94b277672c64d6767886Jan Engelhardt technology is detected, and non-zero (error) otherwise. By default,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek any type of virtualization is detected, and the options
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <option>--container</option> and <option>--vm</option> can be used
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek to limit what types of virtualization are detected.</para>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <para>When executed without <option>--quiet</option> will print a
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek short identifier for the detected virtualization technology. The
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek following technologies are currently identified:</para>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <title>Known virtualization technologies (both
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek VM, i.e. full hardware virtualization,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek and container, i.e. shared kernel virtualization)</title>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <tgroup cols='3' align='left' colsep='1' rowsep='1'>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>qemu</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>QEMU software virtualization</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>kvm</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>Linux KVM kernel virtual machine</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>zvm</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>vmware</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>VMware Workstation or Server, and related products</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>microsoft</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>Hyper-V, also known as Viridian or Windows Server Virtualization</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>oracle</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>Oracle VM VirtualBox (historically marketed by innotek and Sun Microsystems)</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>xen</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>Xen hypervisor (only domU, not dom0)</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>bochs</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>uml</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>parallels</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>Parallels Desktop, Parallels Server</entry>
055a100d2ed2a750081d35ac97fc373f9aa01e22Jan Engelhardt <entry valign="top" morerows="5">Container</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>openvz</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>lxc</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>Linux container implementation by LXC</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>lxc-libvirt</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>Linux container implementation by libvirt</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>systemd-nspawn</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>systemd's minimal container implementation, see <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>docker</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>Docker container manager</entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry><varname>rkt</varname></entry>
6d0c987d213f8b199a31c9bb7439d3b49a000068Zbigniew Jędrzejewski-Szmek <entry>rkt app container runtime</entry>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <para>If multiple virtualization solutions are used, only the
9c5baa43ae5cd22a16fd056e3c40815c90d008cdJan Engelhardt "innermost" is detected and identified. That means if both
9c5baa43ae5cd22a16fd056e3c40815c90d008cdJan Engelhardt machine and container virtualization are used in
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek conjunction, only the latter will be identified (unless
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <option>--vm</option> is passed).</para>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <para>The following options are understood:</para>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <term><option>-c</option></term>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <term><option>--container</option></term>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <listitem><para>Only detects container virtualization (i.e.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek shared kernel virtualization).</para></listitem>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <term><option>-v</option></term>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <term><option>--vm</option></term>
9c5baa43ae5cd22a16fd056e3c40815c90d008cdJan Engelhardt <listitem><para>Only detects hardware virtualization).</para></listitem>
d21be5ff9177b25064f6e933e91f2c19a7190c19Lennart Poettering <varlistentry>
d21be5ff9177b25064f6e933e91f2c19a7190c19Lennart Poettering <listitem><para>Detect whether invoked in a
d21be5ff9177b25064f6e933e91f2c19a7190c19Lennart Poettering <citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
b938cb902c3b5bca807a94b277672c64d6767886Jan Engelhardt environment. In this mode, no output is written, but the return
d21be5ff9177b25064f6e933e91f2c19a7190c19Lennart Poettering value indicates whether the process was invoked in a
d21be5ff9177b25064f6e933e91f2c19a7190c19Lennart Poettering </varlistentry>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <term><option>-q</option></term>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <term><option>--quiet</option></term>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <listitem><para>Suppress output of the virtualization
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek technology identifier.</para></listitem>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <xi:include href="standard-options.xml" xpointer="help" />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <xi:include href="standard-options.xml" xpointer="version" />
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <para>If a virtualization technology is detected, 0 is returned, a
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek non-zero code otherwise.</para>
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
d21be5ff9177b25064f6e933e91f2c19a7190c19Lennart Poettering <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
d21be5ff9177b25064f6e933e91f2c19a7190c19Lennart Poettering <citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry>