Why is vTPM Essential for Virtual Machines Today?
If you are running a lab or a virtualization system, you’ve likely struggled with Windows 11 hardware requirements. While we can use registry bypass tricks for standard installations, bypassing security in a corporate environment is a significant mistake. To deploy BitLocker, Credential Guard, or Windows Hello, virtual machines must have a vTPM (Virtual Trusted Platform Module).
In my own Homelab system with 12 virtual machines running 24/7, TPM emulation helps the virtual environment reach 99% parity with physical hardware. This article focuses on swtpm, the most popular open-source TPM emulator for KVM and Proxmox today.
Comparing TPM Options for Virtual Machines
Before typing any commands, you need to understand why swtpm has become the gold standard over other methods.
1. TPM Passthrough (Direct Hardware Attachment)
This method connects the physical TPM chip on the motherboard directly to the VM. While it sounds the most secure, it is actually very restrictive. Each TPM chip can usually only be assigned to a single VM. More importantly, Live Migration will be disabled because the destination node lacks the corresponding TPM chip to take over.
2. Software Emulated TPM (swtpm)
This is a software solution that creates a virtual TPM chip. Sensitive data is stored in a state file on the host’s disk. This approach is extremely flexible. You can take snapshots, perform backups, or move virtual machines between servers in a cluster without any obstacles.
Quick Comparison Table:
- Flexibility: swtpm (Very High) | Passthrough (Low)
- Migration Capability: swtpm (Well-supported) | Passthrough (Impossible)
- Complexity: swtpm (Easy to configure) | Passthrough (Hardware-dependent)
Implementing vTPM on Proxmox VE
On Proxmox (versions 7.x and 8.x), vTPM is built directly into the GUI. You no longer need to dive deep into the command line.
Implementation Steps:
- Shut down the Windows VM you want to configure.
- Go to Hardware -> Add -> TPM State.
- Select Storage: Choose the same partition as the VM’s hard drive (e.g., Ceph or LVM-Thin). This ensures that when you move the VM, the TPM file moves with it, preventing the loss of encryption keys.
Always select version v2.0. Windows 11 will refuse to recognize older versions like v1.2.
# Check the configuration file to ensure vTPM is active
cat /etc/pve/qmu-server/101.conf
# The result will show the line: tpmstate: local-lvm:vm-101-tpmstate,version=v2.0
Manually Configuring vTPM on KVM/Libvirt
For those using Ubuntu Server or Debian, the swtpm package is often not included by default. A common error is forgetting to install the package, which causes virt-manager to hide the TPM option.
Install Required Packages:
sudo apt update
sudo apt install swtpm swtpm-tools libvirt-daemon-system -y
Edit VM XML Configuration:
Use the command virsh edit <vm_name>. You need to add the following code block inside the <devices> tag. Be sure to use the tpm-tis model for the best compatibility with Windows.
<tpm model='tpm-tis'>
<backend type='emulator' version='2.0'/>
</tpm>
After saving, Libvirt will automatically initialize a separate swtpm instance each time the virtual machine starts. The socket files are typically located at /var/lib/libvirt/swtpm/.
Activating BitLocker and Critical Considerations
Once the VM recognizes the TPM, enabling BitLocker works just like on a physical machine. However, if Windows displays the error “This device cannot use a TPM,” check the VM’s BIOS. vTPM 2.0 requires OVMF (UEFI) instead of traditional SeaBIOS.
Data Warning: The tpmstate file is the key to decrypting the drive. If you accidentally delete this file or reinstall the host without a backup, the data in the VM will be permanently lost. Losing the tpmstate file means the disk is permanently locked unless you have the BitLocker Recovery Key.
Practical Advice
The swtpm technology is now very stable. Even for lab VMs, I always recommend enabling vTPM and UEFI from the start. This habit keeps you ready to test security features like LUKS on Linux or BitLocker on Windows at any time.
Don’t forget to set up a regular backup schedule. In Proxmox, the default backup feature includes the TPM state file, giving you peace of mind in case of hardware failure.

