0

I'm running a very basic debian 9 OS inside Virtualbox, I haven't installed any paravirtualization | guest additions, regardless that I get Virtualization: oracle. Why? isn't it supposed the OS should not be aware if it's running on real or virtual hardware?

  • "isn't it supposed the OS should not be aware if it's running on real or virtual hardware?" Why shouldn't it be aware? – muru Oct 23 '18 at 04:15
  • @muru because I just installed the OS and nothing else –  Oct 23 '18 at 04:23
  • 2
    Ok, so? That doesn't answer why the OS shouldn't be aware of what it's running on. – muru Oct 23 '18 at 04:24
  • How would the guest additions ever know that it was running in VirtualBox? Any program can determine this the same way. – Michael Hampton Oct 23 '18 at 05:01

1 Answers1

4

Detecting most actual virtualization solutions is not exactly difficult.

The Linux kernel can detect at least VMware, HyperV, Xen and KVM: look for a message like Hypervisor detected: <virtualization type> in dmesg output.

At least VMware and HyperV can be detected with the signature information they add into the results of the cpuid processor opcode, so they can be detected at a very low level. Looking at the outputs of dmidecode and/or lspci is another quick way to detect many forms of virtualization.

For practical reasons, most virtualization solutions present a set of system components to the VM that are known to be simple and well-supported. This often leads to combinations that would not make sense in actual physical hardware: for example, if you see an Intel ICH8M SATA controller and a Intel PIIX3 ISA bridge on the same system, that's a pretty dead giveaway: both of those are supposed to be devices integrated into the system chipset, but they belong to very different chipsets so they would never both exist on the same physical system.

Also, if you see parts belonging to a system chipset that were used with the original Pentium II chips with clockspeeds measured in two-digit MHz values, and yet the processor claims a multi-GHz speed, you know there has to be some virtualization going on.

See also: Easy way to determine virtualization technology

systemd includes features designed for controlling VMs and containers, so its main library probably also includes a set of virtualization detection routines. You can also use them with systemd-detect-virt command.

telcoM
  • 96,466