How to fix Ubuntu open /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1: No such file or directory
Problem
In Ubuntu 26.04 or later, when you want to connect to a SSH host using a TPM-based SSH key, you see the following error:
example.txt
lib_contains_symbol: open /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1: No such file or directory
provider /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1 is not a PKCS11 library
Received disconnect from 100.64.0.132 port 22:2: Too many authentication failures
Disconnected from 10.1.2.3 port 22Solution
Between Ubuntu 24.04 and 26.04, the package libtpm2-pkcs11-1 was updated and hence, the library file was moved from
example.sh
/usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1to
example.sh
usr/lib/x86_64-linux-gnu/pkcs11/libtpm2_pkcs11.soHence, you need to edit your SSH configuration (typically in ~/.ssh/config or in /etc/ssh/ssh_config) and change the path to the PKCS11 provider library to the new path.
For example, change this:
ssh_config_example_old
Host myserver
HostName myserver.mydomain.com
PasswordAuthentication no
PKCS11Provider /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1to
ssh_config_example
Host myserver
HostName myserver.mydomain.com
PasswordAuthentication no
PKCS11Provider /usr/lib/x86_64-linux-gnu/pkcs11/libtpm2_pkcs11.soCheck out similar posts by category:
Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow