SYSTEMD-DETECT-VIRT(1)
๐ธ systemd-detect-virt(1) ๐ธ
okay bestie, welcome to the systemd-detect-virt manual page ๐ this one's the little detective that tells you if you're living inside a VM or a container. it's iconic, it's useful, and yes we're reading the whole thing together. grab a snack ๐
โจ NAME โจ
systemd-detect-virt โ figure out if you're running inside a virtualized environment ๐ต๏ธโ๏ธ
โจ SYNOPSIS โจ
systemd-detect-virt [OPTIONS...]
โจ DESCRIPTION โจ
systemd-detect-virt detects execution in a virtualized environment. it IDs the virtualization technology and can tell full machine virtualization apart from container virtualization โ two very different vibes, bestie.
here's the deal on how it talks back to you: systemd-detect-virt exits with a return value of 0 (success) if a virtualization technology is detected, and non-zero (error) otherwise. that's your vibe check right there โจ
by default, any type of virtualization gets detected, and the options --container and --vm are how you narrow down which types of virtualization you're willing to hear about.
when it runs without --quiet, it prints a short identifier for the detected virtualization technology. these are the technologies it currently knows about:
๐ฆ Table 1. Known virtualization technologies (both VM, i.e. full hardware virtualization, and container, i.e. shared kernel virtualization)
๐ VM
qemuโ QEMU software virtualization, without KVMkvmโ Linux KVM kernel virtual machine, in combination with QEMU. Not used for other virtualizers using the KVM interfaces, such as Oracle VirtualBox or Amazon EC2 Nitro, see below.amazonโ Amazon EC2 Nitro using Linux KVMzvmโ s390 z/VMvmwareโ VMware Workstation or Server, and related productsmicrosoftโ Hyper-V, also known as Viridian or Windows Server Virtualizationoracleโ Oracle VM VirtualBox (historically marketed by innotek and Sun Microsystems), for legacy and KVM hypervisorpowervmโ IBM PowerVM hypervisor โ comes as firmware with some IBM POWER serversxenโ Xen hypervisor (only domU, not dom0)bochsโ Bochs Emulatorumlโ User-mode Linuxparallelsโ Parallels Desktop, Parallels Serverbhyveโ bhyve, FreeBSD hypervisorqnxโ QNX hypervisoracrnโ ACRN hypervisor[1]appleโ Apple virtualization framework[2]sreโ LMHS SRE hypervisor[3]googleโ Google Compute Engine[4]
๐ Container
openvzโ OpenVZ/Virtuozzolxcโ Linux container implementation by LXClxc-libvirtโ Linux container implementation by libvirtsystemd-nspawnโ systemd's minimal container implementation, seesystemd-nspawn(1)dockerโ Docker container managerpodmanโ Podman[5] container managerrktโ rkt app container runtimewslโ Windows Subsystem for Linux[6]prootโ proot[7] userspace chroot/bind mount emulationpouchโ Pouch[8] Container Engine
๐ heads up: if multiple virtualization solutions are used, only the "innermost" is detected and identified. That means if both machine and container virtualization are used in conjunction, only the latter will be identified (unless --vm is passed). innermost wins, no cap.
Windows Subsystem for Linux is not a Linux container, bestie โ it's an environment for running Linux userspace applications on top of the Windows kernel using a Linux-compatible interface. WSL is categorized as a container for practical purposes. Multiple WSL environments share the same kernel and services should generally behave like when being run in a container. slay, but make it kernel-sharing ๐
when it runs with --cvm, instead of printing the virtualization technology, it will display the confidential virtual machine technology, if any. the following technologies are currently identified:
...so yeah, that's Table 1 energy. And here's its sister, the confidential-compute lineup ๐
๐ Table 2. Known confidential virtualization technologies ๐
Not every arch has every flavor, bestie โ here's the whole roster, grouped by architecture:
- x86_64:
sevโ AMD Secure Encrypted Virtualizationsev-esโ AMD Secure Encrypted Virtualization - Encrypted Statesev-snpโ AMD Secure Encrypted Virtualization - Secure Nested Pagingtdxโ Intel Trust Domain Extensions
- s390x:
protvirtโ IBM Protected Virtualization (Secure Execution)
- arm64:
ccaโ Arm Confidential Compute Architecture
โจ OPTIONS โจ
Okay so here's everything it understands, and yes you're gonna want to know all of it:
-c,--containerโ container-only mode, periodt. It detects only container virtualization, aka shared-kernel virtualization. Nothing else.-v,--vmโ hardware virtualization only. If it's not a real VM, it's not interested.-r,--chrootโ detects whether it got invoked inside achroot(2)environment. Heads up: in this mode it prints nothing โ the return value is the whole story, telling you whether the process was invoked in achroot()environment or not.
Added in version 228.
--private-usersโ detects whether it got invoked in a user namespace. Same deal: no output written, the return value is what tells you whether the process was invoked inside a user namespace or not. Want the lore? Go readuser_namespaces(7).
Added in version 232.
--cvmโ detects whether it got invoked in a confidential virtual machine. And bestie, listen carefully: you can use this result to turn off features that shouldn't be used in confidential VMs, but it must not be used to release security-sensitive information. That kind of info only gets released after attestation of the confidential environment. No shortcuts. ๐ซ
Added in version 254.
-q,--quietโ shuts up the virtualization technology identifier output. ๐คซ--listโ spits out every currently known and detectable container and VM environment. A whole menu of vibes.
Added in version 239.
--list-cvmโ spits out all currently known and detectable confidential virtualization technologies. โจ
Added in version 254.
-h,--helpโ short help text, then it dips. ๐--versionโ short version string, then it dips. ๐
๐ EXIT STATUS ๐
If a virtualization technology is detected, 0 comes back. Anything non-zero means nope, nothing found. That's the entire vibe check, fr fr.
๐ SEE ALSO ๐
Go read these when you're done here, iykyk:
๐ NOTES ๐
The footnotes, preserved in all their glory, links and all ๐
- ACRN hypervisor โ https://projectacrn.org
- Apple virtualization framework โ https://developer.apple.com/documentation/virtualization
- LMHS SRE hypervisor โ https://www.lockheedmartin.com/en-us/products/Hardened-Security-for-Intel-Processors.html
- Google Compute Engine โ https://cloud.google.com/compute
- Podman โ https://podman.io
- Windows Subsystem for Linux โ https://docs.microsoft.com/en-us/windows/wsl/about
- proot โ https://proot-me.github.io/
- Pouch โ https://github.com/alibaba/pouch
aaaand that's a wrap, bestie ๐ซถ this whole thing is from systemd 262.1, the man page for SYSTEMD-DETECT-VIRT(1) โ go detect some virt, you absolute icon ๐๐
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms