Ubuntu の open /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1: No such file or directory エラーを修正する方法

問題

Ubuntu 26.04 以降で、TPM ベースの SSH 鍵を使用して SSH ホストに接続しようとすると、次のエラーが表示されます。

tpm2_pkcs11_error.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 22

解決策

Ubuntu 24.04 と 26.04 の間で、libtpm2-pkcs11-1 パッケージが更新され、ライブラリファイルが移動 されました。変更前:

old_pkcs11_path.txt
/usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1

変更後:

new_pkcs11_path.txt
/usr/lib/x86_64-linux-gnu/pkcs11/libtpm2_pkcs11.so

そのため、SSH 設定(通常は ~/.ssh/config または /etc/ssh/ssh_config)を編集し、PKCS11 プロバイダライブラリへのパスを新しいパスに変更する必要があります。

例えば、これを:

ssh_config_example_old
Host myserver
    HostName myserver.mydomain.com
    PasswordAuthentication no
    PKCS11Provider /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1

次のように変更します。

ssh_config_example
Host myserver
    HostName myserver.mydomain.com
    PasswordAuthentication no
    PKCS11Provider /usr/lib/x86_64-linux-gnu/pkcs11/libtpm2_pkcs11.so

同じカテゴリの類似記事をチェック: Linux