libcbor.so.0.6 not found

· 192 words · 1 minute read

If you upgraded from Ubuntu 20.04 LTS to 22.04 LTS, and you’re no longer able to ssh-add -K because you’re getting this error:

$ ssh-add -K
Enter PIN for authenticator: 
/usr/lib/openssh/ssh-sk-helper: error while loading shared libraries:
  libcbor.so.0.6: cannot open shared object file: No such file or directory

then you might try this:

$ ldd /usr/lib/openssh/ssh-sk-helper
	linux-vdso.so.1 (0x00007ffd985a9000)
	libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007feca56be000)
	libfido2.so.1 => /usr/local/lib/libfido2.so.1 (0x00007feca567a000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feca5452000)
	libcbor.so.0.6 => not found

… which will lead to this:

$ dpkg -S libcbor.so.0.6
dpkg-query: no path found matching pattern *libcbor.so.0.6*

… which will lead to this if you jump up one level in the ldd hierarchy:

$ dpkg -S /usr/local/lib/libfido2.so.1
dpkg-query: no path found matching pattern /usr/local/lib/libfido2.so.1

… which will cause you to find this page telling you that you must have once installed libfido2-1 and libfido2-dev, but they were somehow orphaned from their Debian package, causing them to not get upgraded, or you manually installed them without a Debian package to begin with. This means they’ve been shadowing the up-to-date shared libraries in /usr/lib/x86_64-linux-gnu/.

Solution (for me):

$ sudo mv /usr/local/lib/libfido2* /tmp/
$ ldd /usr/lib/openssh/ssh-sk-helper

and confirm everything looks good again.