{
    "mode": "man",
    "parameter": "systemd-detect-virt",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/systemd-detect-virt/1/json",
    "generated": "2026-06-03T00:34:56Z",
    "synopsis": "systemd-detect-virt [OPTIONS...]",
    "sections": {
        "NAME": {
            "content": "systemd-detect-virt - Detect execution in a virtualized environment\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "systemd-detect-virt [OPTIONS...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "systemd-detect-virt detects execution in a virtualized environment. It identifies the\nvirtualization technology and can distinguish full machine virtualization from container\nvirtualization.  systemd-detect-virt exits with a return value of 0 (success) if a\nvirtualization technology is detected, and non-zero (error) otherwise. By default, any type\nof virtualization is detected, and the options --container and --vm can be used to limit what\ntypes of virtualization are detected.\n\nWhen executed without --quiet will print a short identifier for the detected virtualization\ntechnology. The following technologies are currently identified:\n",
            "subsections": [
                {
                    "name": "Table 1. Known virtualization technologies (both VM, i.e. full hardware virtualization, and",
                    "content": ""
                },
                {
                    "name": "container, i.e. shared kernel virtualization)",
                    "content": "┌──────────┬────────────────────┬───────────────────────────┐\n│Type      │ ID                 │ Product                   │\n├──────────┼────────────────────┼───────────────────────────┤\n│VM        │ qemu               │ QEMU software             │\n│          │                    │ virtualization, without   │\n│          │                    │ KVM                       │\n│          ├────────────────────┼───────────────────────────┤\n│          │ kvm                │ Linux KVM kernel virtual  │\n│          │                    │ machine, in combination   │\n│          │                    │ with QEMU. Not used for   │\n│          │                    │ other virtualizers using  │\n│          │                    │ the KVM interfaces, such  │\n│          │                    │ as Oracle VirtualBox or   │\n│          │                    │ Amazon EC2 Nitro, see     │\n│          │                    │ below.                    │\n│          ├────────────────────┼───────────────────────────┤\n│          │ amazon             │ Amazon EC2 Nitro using    │\n│          │                    │ Linux KVM                 │\n│          ├────────────────────┼───────────────────────────┤\n│          │ zvm                │ s390 z/VM                 │\n│          ├────────────────────┼───────────────────────────┤\n│          │ vmware             │ VMware Workstation or     │\n│          │                    │ Server, and related       │\n│          │                    │ products                  │\n│          ├────────────────────┼───────────────────────────┤\n│          │ microsoft          │ Hyper-V, also known as    │\n│          │                    │ Viridian or Windows       │\n│          │                    │ Server Virtualization     │\n│          ├────────────────────┼───────────────────────────┤\n│          │ oracle             │ Oracle VM VirtualBox      │\n│          │                    │ (historically marketed by │\n│          │                    │ innotek and Sun           │\n│          │                    │ Microsystems), for legacy │\n│          │                    │ and KVM hypervisor        │\n│          ├────────────────────┼───────────────────────────┤\n│          │ powervm            │ IBM PowerVM hypervisor —  │\n│          │                    │ comes as firmware with    │\n│          │                    │ some IBM POWER servers    │\n│          ├────────────────────┼───────────────────────────┤\n│          │ xen                │ Xen hypervisor (only      │\n│          │                    │ domU, not dom0)           │\n│          ├────────────────────┼───────────────────────────┤\n│          │ bochs              │ Bochs Emulator            │\n│          ├────────────────────┼───────────────────────────┤\n│          │ uml                │ User-mode Linux           │\n│          ├────────────────────┼───────────────────────────┤\n│          │ parallels          │ Parallels Desktop,        │\n│          │                    │ Parallels Server          │\n│          ├────────────────────┼───────────────────────────┤\n│          │ bhyve              │ bhyve, FreeBSD hypervisor │\n│          ├────────────────────┼───────────────────────────┤\n│          │ qnx                │ QNX hypervisor            │\n├──────────┼────────────────────┼───────────────────────────┤\n│acrn      │ ACRN hypervisor[1] │                           │\n├──────────┼────────────────────┼───────────────────────────┤\n│Container │ openvz             │ OpenVZ/Virtuozzo          │\n│          ├────────────────────┼───────────────────────────┤\n│          │ lxc                │ Linux container           │\n│          │                    │ implementation by LXC     │\n│          ├────────────────────┼───────────────────────────┤\n│          │ lxc-libvirt        │ Linux container           │\n│          │                    │ implementation by libvirt │\n│          ├────────────────────┼───────────────────────────┤\n│          │ systemd-nspawn     │ systemd's minimal         │\n│          │                    │ container implementation, │\n│          │                    │ see systemd-nspawn(1)     │\n│          ├────────────────────┼───────────────────────────┤\n│          │ docker             │ Docker container manager  │\n│          ├────────────────────┼───────────────────────────┤\n│          │ podman             │ Podman[2] container       │\n│          │                    │ manager                   │\n│          ├────────────────────┼───────────────────────────┤\n│          │ rkt                │ rkt app container runtime │\n│          ├────────────────────┼───────────────────────────┤\n│          │ wsl                │ Windows Subsystem for     │\n│          │                    │ Linux[3]                  │\n│          ├────────────────────┼───────────────────────────┤\n│          │ proot              │ proot[4] userspace        │\n│          │                    │ chroot/bind mount         │\n│          │                    │ emulation                 │\n│          ├────────────────────┼───────────────────────────┤\n│          │ pouch              │ Pouch[5] Container Engine │\n└──────────┴────────────────────┴───────────────────────────┘\n\nIf multiple virtualization solutions are used, only the \"innermost\" is detected and\nidentified. That means if both machine and container virtualization are used in conjunction,\nonly the latter will be identified (unless --vm is passed).\n\nWindows Subsystem for Linux is not a Linux container, but an environment for running Linux\nuserspace applications on top of the Windows kernel using a Linux-compatible interface. WSL\nis categorized as a container for practical purposes. Multiple WSL environments share the\nsame kernel and services should generally behave like when being run in a container.\n"
                }
            ]
        },
        "OPTIONS": {
            "content": "The following options are understood:\n",
            "subsections": [
                {
                    "name": "-c --container",
                    "content": "Only detects container virtualization (i.e. shared kernel virtualization).\n",
                    "flag": "-c",
                    "long": "--container"
                },
                {
                    "name": "-v --vm",
                    "content": "Only detects hardware virtualization.\n",
                    "flag": "-v",
                    "long": "--vm"
                },
                {
                    "name": "-r --chroot",
                    "content": "Detect whether invoked in a chroot(2) environment. In this mode, no output is written,\nbut the return value indicates whether the process was invoked in a chroot() environment\nor not.\n",
                    "flag": "-r",
                    "long": "--chroot"
                },
                {
                    "name": "--private-users",
                    "content": "Detect whether invoked in a user namespace. In this mode, no output is written, but the\nreturn value indicates whether the process was invoked inside of a user namespace or not.\nSee usernamespaces(7) for more information.\n",
                    "long": "--private-users"
                },
                {
                    "name": "-q --quiet",
                    "content": "Suppress output of the virtualization technology identifier.\n",
                    "flag": "-q",
                    "long": "--quiet"
                },
                {
                    "name": "--list",
                    "content": "Output all currently known and detectable container and VM environments.\n",
                    "long": "--list"
                },
                {
                    "name": "-h --help",
                    "content": "Print a short help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "--version",
                    "content": "Print a short version string and exit.\n",
                    "long": "--version"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "If a virtualization technology is detected, 0 is returned, a non-zero code otherwise.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "systemd(1), systemd-nspawn(1), chroot(2), namespaces(7)\n",
            "subsections": []
        },
        "NOTES": {
            "content": "1. ACRN hypervisor\nhttps://projectacrn.org\n\n2. Podman\nhttps://podman.io\n\n3. Windows Subsystem for Linux\nhttps://docs.microsoft.com/en-us/windows/wsl/about\n\n4. proot\nhttps://proot-me.github.io/\n\n5. Pouch\nhttps://github.com/alibaba/pouch\n\n\n\nsystemd 249                                                                   SYSTEMD-DETECT-VIRT(1)",
            "subsections": []
        }
    },
    "summary": "systemd-detect-virt - Detect execution in a virtualized environment",
    "flags": [
        {
            "flag": "-c",
            "long": "--container",
            "arg": null,
            "description": "Only detects container virtualization (i.e. shared kernel virtualization)."
        },
        {
            "flag": "-v",
            "long": "--vm",
            "arg": null,
            "description": "Only detects hardware virtualization."
        },
        {
            "flag": "-r",
            "long": "--chroot",
            "arg": null,
            "description": "Detect whether invoked in a chroot(2) environment. In this mode, no output is written, but the return value indicates whether the process was invoked in a chroot() environment or not."
        },
        {
            "flag": "",
            "long": "--private-users",
            "arg": null,
            "description": "Detect whether invoked in a user namespace. In this mode, no output is written, but the return value indicates whether the process was invoked inside of a user namespace or not. See usernamespaces(7) for more information."
        },
        {
            "flag": "-q",
            "long": "--quiet",
            "arg": null,
            "description": "Suppress output of the virtualization technology identifier."
        },
        {
            "flag": "",
            "long": "--list",
            "arg": null,
            "description": "Output all currently known and detectable container and VM environments."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Print a short help text and exit."
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "Print a short version string and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "systemd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
        },
        {
            "name": "systemd-nspawn",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd-nspawn/1/json"
        },
        {
            "name": "chroot",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/chroot/2/json"
        },
        {
            "name": "namespaces",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/namespaces/7/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Detect execution in a virtualized environment.",
        "examples": [
            {
                "description": "List detectable virtualization technologies",
                "command": "systemd-detect-virt --list"
            },
            {
                "description": "Detect virtualization, print the result and return a zero status code when running in a VM or a container, and a non-zero code otherwise",
                "command": "systemd-detect-virt"
            },
            {
                "description": "Silently check without printing anything",
                "command": "systemd-detect-virt {{-q|--quiet}}"
            },
            {
                "description": "Only detect container virtualization",
                "command": "systemd-detect-virt {{-c|--container}}"
            },
            {
                "description": "Only detect hardware virtualization",
                "command": "systemd-detect-virt {{-v|--vm}}"
            },
            {
                "description": "Detect whether in a `chroot` environment",
                "command": "systemd-detect-virt {{-r|--chroot}}"
            }
        ]
    }
}