Smart card reader on distrobox

1 week old in using linux for first time in my life and i am struggling with this one issue.

I have bazzite installed. I want to be able to use my usb smart ID card reader to sign documents and log in to government services etc. I quickly understood that everything is separated on bazzite and making application to sign documents work and browser plugin to detect card reader just was not possible. They work on their own but dont interact with each other.

My next step was to try setup distrobox. I am using Ubuntu 24.04 as it was what government necessary applications are originally developed on which led to easy installation and setup.

But problem is that my distrobox cant read USB smart card reader. When I installed pcscd package on host bazzite, it was able to read smart card. Also using distrobox means I can keep bazzite cleaner from all packages, but for some reason I cant figure out why my distrobox ubuntu cant read smart card. Its able to detect USB card reader and other USB devices using lsusb. But package like pcscd doesnt work properly. I guess it has no access to interact with usb devices? For example: pcsc_scan
PC/SC device scanner
V 1.7.1 (c) 2001-2022, Ludovic Rousseau ludovic.rousseau@free.fr
SCardEstablishContext: Access denied.

Is there a way to work around this?
Solution
So I have found solution and everything is running as intended. Even tho was complete nightmare of trial and error until figuring out for someone new to linux. This is how I did it if someone new maybe struggles for something similar:

  1. Have to stop pcscd service on host bazzite cause it interferes and blocks distrobox to interact with smart card: sudo systemctl stop pcscd.socket sudo systemctl disable pcscd.socket sudo systemctl stop pcscd sudo systemctl disable pcscd
  2. Set up new udev rule for smart card in /etc/udev/rules.d/ SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", ATTRS{idProduct}=="xxxx", MODE="0666", GROUP="yourusername"
Replace xxxx with device IDs you can find using lsusb and yourusername with your actuall username

  1. In my experience resetting udev rules like this made whole process more reliable: sudo udevadm control --reload sudo udevadm trigger
  2. Creat ubuntu distrobox and give access to usb and udev rules. Found that ubuntu 22.04 works better then 24.04 as 24.04 changes GID name for some reason which cause some weird mismatch between host bazzite and ubuntu distrobox: distrobox create --name ubuntu \ --image ubuntu:22.04 \ --volume /dev/bus/usb:/dev/bus/usb \ --volume /etc/udev/rules.d/:/etc/udev/rules.d
  3. In distrobox: sudo apt update sudo apt install pcscd pcsc-tools
  4. Launch pcscd service inside distrobox using simply "pcscd" or try "sudo pcscd" if service doesnt work properly. Test with pcsc_scan if everything works.
And wolla, simple as that, but absolutely terrible experience. Reasons why it didnt work looking back seems obvious now, but incredibly hard where to look when encountering these things first time.
Was this page helpful?