When I log in with my (usb) yubikey 4 inserted, I can run
gpg --card-status and it gives the expected result. If I remove the yubikey and run
gpg --card-status it, correctly, tells me that there is no such device.
However, If I re-insert the yubikey, gpg still can't find it. Restarting
scdaemon does not fix the problem. I have discovered that restarting dbus does fix the problem and in fact after dbus has been restarted once, I can then add and remove the yubikey without any further problems.
How can I determine the difference between the intial dbus (after login) session and the 2nd (after restart) session to work out what the problem is with the first session?
My login session is an i3 wm running under arch linux.