Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#995814: socket /run/pcscd/pcscd.comm immediately removed upon start

247 views
Skip to first unread message

Philipp Marek

unread,
Oct 6, 2021, 8:00:03 AM10/6/21
to
Package: pcscd
Version: 1.9.4-1
Severity: normal
X-Debbugs-Cc: phi...@marek.priv.at

I noticed that 1.9.4-1 removes the /run/pcscd/pcscd.comm socket after
starting up; at least, after a "systemctl restart" I can see pcscd
having that socket open (via "lsof"), but it doesn't exist in the
filesystem - and so client services (like "p11tool --list-tokens")
don't see any hardware tokens.


-- System Information:
Debian Release: bookworm/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.14.0-2-amd64 (SMP w/8 CPU threads)
Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8), LANGUAGE=de_AT:de
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Ludovic Rousseau

unread,
Oct 6, 2021, 10:10:02 AM10/6/21
to
Le 06/10/2021 à 13:50, Philipp Marek a écrit :
> Package: pcscd
> Version: 1.9.4-1
> Severity: normal
> X-Debbugs-Cc: phi...@marek.priv.at
>
> I noticed that 1.9.4-1 removes the /run/pcscd/pcscd.comm socket after
> starting up; at least, after a "systemctl restart" I can see pcscd
> having that socket open (via "lsof"), but it doesn't exist in the
> filesystem - and so client services (like "p11tool --list-tokens")
> don't see any hardware tokens.

I can reproduce the problem if I use "sudo systemctl restart pcscd".
You should NOT do that.

If you really need to restart pcscd you should do something like:
$ systemctl stop pcscd.service
$ systemctl stop pcscd.socket
$ systemctl start pcscd.socket

See https://ludovicrousseau.blogspot.com/2011/11/pcscd-auto-start-using-systemd.html

Why do you want to restart pcscd?

Bye

--
Dr. Ludovic Rousseau

Philipp Marek

unread,
Oct 6, 2021, 10:30:03 AM10/6/21
to
Hi Ludovic,

thank you for the quick answer!


> I can reproduce the problem if I use "sudo systemctl restart pcscd".
> You should NOT do that.
>
> If you really need to restart pcscd you should do something like:
> $ systemctl stop pcscd.service
> $ systemctl stop pcscd.socket
> $ systemctl start pcscd.socket
>
> See
> https://ludovicrousseau.blogspot.com/2011/11/pcscd-auto-start-using-systemd.html

Thanks for the information... perhaps the socket should depend on pcscd
and so
be restarted along with it?


> Why do you want to restart pcscd?

When switching between package versions.


Do I read you correctly that the default Debian package doesn't
restart pcscd upon installing a new version?


That would explain why I needed the last month to debug a problem...
my pcscd was updated on 2021-08-31, but seems to have been running
the old binary until I rebooted -
at which point my VPN didn't work anymore, and the recently (2 weeks)
installed packages didn't offer any clue about the offending package...



Please set the socket as a dependency, so that a simple "restart" works
as expected (by me, at least ;)


Thanks!

Ludovic Rousseau

unread,
Oct 7, 2021, 5:10:02 PM10/7/21
to
Le 06/10/2021 à 16:12, Philipp Marek a écrit :
> Thanks for the information... perhaps the socket should depend on pcscd and so
> be restarted along with it?

Good idea.
I will have a look.

>> Why do you want to restart pcscd?
>
> When switching between package versions.
>
>
> Do I read you correctly that the default Debian package doesn't
> restart pcscd upon installing a new version?

Exact.
My idea was to NOT break already running applications. But it looks like it is more problematic.

pcscd should also be restarted after a driver is installed so pcscd rescan the driver directory.

> That would explain why I needed the last month to debug a problem...
> my pcscd was updated on 2021-08-31, but seems to have been running
> the old binary until I rebooted -
> at which point my VPN didn't work anymore, and the recently (2 weeks)
> installed packages didn't offer any clue about the offending package...

Sorry.

> Please set the socket as a dependency, so that a simple "restart" works
> as expected (by me, at least ;)

I will look at this.

Thanks for the feedback.

Philipp Marek

unread,
Oct 19, 2021, 2:10:03 AM10/19/21
to

>> Do I read you correctly that the default Debian package doesn't
>> restart pcscd upon installing a new version?
>
> Exact.
> My idea was to NOT break already running applications. But it looks
> like it is more problematic.
>
> pcscd should also be restarted after a driver is installed so pcscd
> rescan the driver directory.

Yeah, right!


>> That would explain why I needed the last month to debug a problem...
>> my pcscd was updated on 2021-08-31, but seems to have been running
>> the old binary until I rebooted -
>> at which point my VPN didn't work anymore, and the recently (2 weeks)
>> installed packages didn't offer any clue about the offending
>> package...
>
> Sorry.

Never mind... I learned a thing or two ;)


> Thanks for the feedback.

You're welcome!


Ph.

Ludovic Rousseau

unread,
Nov 12, 2021, 12:10:03 PM11/12/21
to
Hello Philipp,

Le 19/10/2021 à 08:03, Philipp Marek a écrit :
>
>>> Do I read you correctly that the default Debian package doesn't
>>> restart pcscd upon installing a new version?
>>
>> Exact.
>> My idea was to NOT break already running applications. But it looks
>> like it is more problematic.
>>
>> pcscd should also be restarted after a driver is installed so pcscd
>> rescan the driver directory.
>
> Yeah, right!

I wanted to work on the issue but I am not able to reproduce it any more :-(

Initial status:
$ systemctl status pcscd
● pcscd.service - PC/SC Smart Card Daemon
Loaded: loaded (/lib/systemd/system/pcscd.service; indirect; vendor preset>
Active: active (running) since Fri 2021-11-12 17:35:28 CET; 3min 16s ago
TriggeredBy: ● pcscd.socket
Docs: man:pcscd(8)
Main PID: 2246 (pcscd)
Tasks: 4 (limit: 4650)
Memory: 712.0K
CPU: 3ms
CGroup: /system.slice/pcscd.service
└─2246 /usr/sbin/pcscd --foreground --auto-exit

nov. 12 17:35:28 debian systemd[1]: Started PC/SC Smart Card Daemon.

$ ls -l /var/run/pcscd/
total 4
srw-rw-rw- 1 root root 0 12 nov. 17:32 pcscd.comm
-rw-r--r-- 1 root root 6 12 nov. 17:35 pcscd.pid


pcscd if running with pid=2246
The socket pcscd.comm is present in /var/run/pcscd/

I restart pcscd:

$ sudo systemctl restart pcscd
$ systemctl status pcscd
● pcscd.service - PC/SC Smart Card Daemon
Loaded: loaded (/lib/systemd/system/pcscd.service; indirect; vendor preset>
Active: active (running) since Fri 2021-11-12 17:39:15 CET; 2s ago
TriggeredBy: ● pcscd.socket
Docs: man:pcscd(8)
Main PID: 2644 (pcscd)
Tasks: 3 (limit: 4650)
Memory: 672.0K
CPU: 4ms
CGroup: /system.slice/pcscd.service
└─2644 /usr/sbin/pcscd --foreground --auto-exit

nov. 12 17:39:15 debian systemd[1]: Started PC/SC Smart Card Daemon.

pcscd is now running with pid=2644
So the process HAS BEEN restarted.

$ ls -l /var/run/pcscd/
total 4
srw-rw-rw- 1 root root 0 12 nov. 17:32 pcscd.comm
-rw-r--r-- 1 root root 6 12 nov. 17:39 pcscd.pid

The socket pcscd.comm is still present and has NOT been removed during the restart. The date of creation of the socket file is still the same. So the socket file has NOT been removed and recreated.

The socket /var/run/pcscd/pcscd.comm is removed only if pcscd is NOT started by systemd.

I also tried with "sudo service pcscd restart" but again a new pcscd process is started and the socket is NOT removed.


From the systemd changelog I see that since your initial bug report "Wed, 06 Oct 2021" systemd has been updated in testing.
https://metadata.ftp-master.debian.org/changelogs//main/s/systemd/systemd_249.5-2_changelog
The current version in testing is now 249.5-2.
I guess the previous version was 247.9-4, uploaded in unstable on Fri, 01 Oct 2021.

Can you check if you can reproduce the issue on your system?

>>> That would explain why I needed the last month to debug a problem...
>>> my pcscd was updated on 2021-08-31, but seems to have been running
>>> the old binary until I rebooted -
>>> at which point my VPN didn't work anymore, and the recently (2 weeks)
>>> installed packages didn't offer any clue about the offending package...
>>
>> Sorry.
>
> Never mind... I learned a thing or two ;)

I still plan to restart pcscd on upgrade or when a new version of libccid is installed.

Thanks

--
Dr. Ludovic Rousseau

Philipp Marek

unread,
Nov 14, 2021, 4:00:03 AM11/14/21
to
Yeah, I can't reproduce, too.

Perhaps the systemd update fixed this?
0 new messages