Installing TPM TSS2 on Ubuntu

This guide provides concise steps to check for TPM availability and install TPM TSS2 on an Ubuntu system (tested with Ubuntu 22.04 LTS).
1. Check for TPM Device
Ensure that a TPM device is available on your system:
ls /dev/tpm*
If /dev/tpm0
exists, a TPM device is present. If not, verify in your BIOS/UEFI settings that TPM is enabled.
2. Prepare the System
Update the system:
sudo apt update && sudo apt upgrade -y
3. Install TPM-TSS2 and TPM2 Tools
Install the TPM packages:
sudo apt install -y tpm2-tools
If you need the TPM resource manager daemon, install it with:
sudo apt install -y tpm2-abrmd
4. Enable the TPM Service
If you installed the TPM daemon, enable and start the service:
sudo systemctl enable tpm2-abrmd.service
sudo systemctl start tpm2-abrmd.service
5. Add user to tss group
Now you need to add your user to the tss group. This allows you to use the TPM daemon.
sudo usermod -aG tss $(whoami)
Afterwards refresh you environment.
newgrp tss
6. Verify the Installation
Test the installation by generating random data:
tpm2_getrandom --hex 8
If the output displays random hex values, TPM is functioning correctly.
With these steps, TPM TSS2 should be successfully installed and ready to use on your Ubuntu system.