Today I did full fresh installation of Ubuntu 22.04 to migrate to new 2T NVME disk from Samsung as I had disk space issues with my old 500G drive.
After installation I noticed that I cannot use my Yubikey for ssh auth as documented here.
I tried to add Yubikey as auth source and it failed with pretty weird error:
ssh-add -s /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so
Enter passphrase for PKCS#11:
Could not add card "/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so": agent refused operation
This error can mean literally anything.
I've tried running ssh agent manually in foreground mode:
ssh-agent -d
And after that I saw error which sounds like "no available slots".
So I back to guide as I suspected that my Yubikey died and I've sued following command:
sudo ykman list --serials
WARNING: PC/SC not available. Smart card (CCID) protocols will not function.
ERROR: Unable to list devices for connection
1232134323
That's interesting and this error lead me to this bug and I got fix:
sudo systemctl start pcscd
After that it worked just fine.
As long term fix you need to enable automatic start on machine boot:
sudo systemctl enable pcscd
Sadly it's known Ubuntu bug.