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

Bug#1001155: Fails to update when service is masked

137 views
Skip to first unread message

Yuri D'Elia

unread,
Dec 5, 2021, 7:20:03 AM12/5/21
to
Package: pcscd
Version: 1.9.5-1
Severity: normal

Errors were encountered while processing:
pcscd
E: Sub-process /usr/bin/dpkg returned an error code (1)
Setting up pcscd (1.9.5-1) ...
Failed to restart pcscd.service: Unit pcscd.socket is masked.
invoke-rc.d: initscript pcscd, action "restart" failed.
○ pcscd.service - PC/SC Smart Card Daemon
Loaded: loaded (/lib/systemd/system/pcscd.service; indirect; vendor preset: enabled)
Active: inactive (dead)
Docs: man:pcscd(8)

I consider this a bug.

During an upgrade, if the service isn't started, the upgrade script
shouldn't fail trying to restart it.

-- System Information:
Debian Release: bookworm/sid
APT prefers unstable
APT policy: (900, 'unstable'), (800, 'experimental'), (500, 'unstable-debug')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.15.0-2-amd64 (SMP w/8 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages pcscd depends on:
ii init-system-helpers 1.60
ii libc6 2.33-0experimental2
ii libccid [pcsc-ifd-handler] 1.4.36-2
ii libpcsclite1 1.9.5-1
ii libsystemd0 249.7-1
ii libudev1 249.7-1
ii lsb-base 11.1.0

pcscd recommends no packages.

Versions of packages pcscd suggests:
ii systemd 249.7-1

Ludovic Rousseau

unread,
Dec 5, 2021, 10:40:03 AM12/5/21
to
On Sun, 5 Dec 2021 13:09:01 +0100 Yuri D'Elia <wav...@thregr.org> wrote:
> Package: pcscd
> Version: 1.9.5-1
> Severity: normal
>
> Errors were encountered while processing:
> pcscd
> E: Sub-process /usr/bin/dpkg returned an error code (1)
> Setting up pcscd (1.9.5-1) ...
> Failed to restart pcscd.service: Unit pcscd.socket is masked.
> invoke-rc.d: initscript pcscd, action "restart" failed.
> ○ pcscd.service - PC/SC Smart Card Daemon
> Loaded: loaded (/lib/systemd/system/pcscd.service; indirect; vendor preset: enabled)
> Active: inactive (dead)
> Docs: man:pcscd(8)
>
> I consider this a bug.
>
> During an upgrade, if the service isn't started, the upgrade script
> shouldn't fail trying to restart it.

I can't reproduce this problem.

I have masked both pcscd.socket and pcscd.service:
$ systemctl status pcscd.socket
○ pcscd.socket
Loaded: masked (Reason: Unit pcscd.socket is masked.)
Active: inactive (dead)
$ systemctl status pcscd.service
○ pcscd.service
Loaded: masked (Reason: Unit pcscd.service is masked.)
Active: inactive (dead)

But restart works fine (no restart and no error):
$ sudo invoke-rc.d pcscd restart
$

I can also reinstall the package with no error:
$ sudo dpkg -i pcscd_1.9.5-1_amd64.deb
(Lecture de la base de données... 261489 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de pcscd_1.9.5-1_amd64.deb ...
Dépaquetage de pcscd (1.9.5-1) sur (1.9.5-1) ...
Paramétrage de pcscd (1.9.5-1) ...
Traitement des actions différées (« triggers ») pour man-db (2.9.4-2) ...


I note I get the same error if I use service(8) instead of invoke-rc.d(8) to
restart pcscd:
$ sudo service pcscd restart
Failed to restart pcscd.service: Unit pcscd.service is masked.


Have you modified invoke-rc.d configuration or something like that?
What do you get if you run "sudo invoke-rc.d pcscd restart"?

Thanks

Ludovic Rousseau

unread,
Dec 11, 2021, 10:00:04 AM12/11/21
to
Hello Yuri,

I got no answer to my questions.
Since I can't reproduce the problem I can fix it. Your help is needed.

Thanks
--
Dr. Ludovic Rousseau

Yuri D'Elia

unread,
Dec 11, 2021, 11:00:03 AM12/11/21
to
On Sat, Dec 11 2021, Ludovic Rousseau wrote:
> Hello Yuri,
>
> I got no answer to my questions.

Sorry about that, didn't get anything.

>> I note I get the same error if I use service(8) instead of
>> invoke-rc.d(8) to
>> restart pcscd:
>> $ sudo service pcscd restart
>> Failed to restart pcscd.service: Unit pcscd.service is masked.
>> Have you modified invoke-rc.d configuration or something like that?

No

>> What do you get if you run "sudo invoke-rc.d pcscd restart"?

# invoke-rc.d pcscd restart
Failed to restart pcscd.service: Unit pcscd.socket is masked.
invoke-rc.d: initscript pcscd, action "restart" failed.
○ pcscd.service - PC/SC Smart Card Daemon
Loaded: loaded (/lib/systemd/system/pcscd.service; indirect; vendor preset: enabled)
Active: inactive (dead)
Docs: man:pcscd(8)

but I just noticed reading now the error above I effectively masked the
socket without masking the service :/

My bad.

I had to install pcscd to use a smart-card reader once in a while,
however I noticed that having pcscd running and/or starting anything
using pkcs11 was taking _seconds_. I didn't want to remove the service,
however I probably disabled socket by tabbing one-too-many times.

Ludovic Rousseau

unread,
Dec 11, 2021, 11:20:03 AM12/11/21
to
Le 11/12/2021 à 16:36, Yuri D'Elia a écrit :
> On Sat, Dec 11 2021, Ludovic Rousseau wrote:

>>> What do you get if you run "sudo invoke-rc.d pcscd restart"?
>
> # invoke-rc.d pcscd restart
> Failed to restart pcscd.service: Unit pcscd.socket is masked.
> invoke-rc.d: initscript pcscd, action "restart" failed.
> ○ pcscd.service - PC/SC Smart Card Daemon
> Loaded: loaded (/lib/systemd/system/pcscd.service; indirect; vendor preset: enabled)
> Active: inactive (dead)
> Docs: man:pcscd(8)
>
> but I just noticed reading now the error above I effectively masked the
> socket without masking the service :/

If you mask both the socket and the service (or just the service) then you do not have any problem. Exact?
If yes, may I close this bug report?

> My bad.

No problem.

> I had to install pcscd to use a smart-card reader once in a while,
> however I noticed that having pcscd running and/or starting anything
> using pkcs11 was taking _seconds_. I didn't want to remove the service,
> however I probably disabled socket by tabbing one-too-many times.

You may want to discuss this performance issue on the MUSCLE mailing list
https://lists.infradead.org/mailman/listinfo/pcsclite-muscle

Bye

--
Dr. Ludovic Rousseau

Yuri D'Elia

unread,
Dec 11, 2021, 11:20:04 AM12/11/21
to
On Sat, Dec 11 2021, Ludovic Rousseau wrote:
> If you mask both the socket and the service (or just the service) then
> you do not have any problem. Exact?
> If yes, may I close this bug report?

Yes, thank you.

Uwe Kleine-König

unread,
Dec 20, 2021, 5:30:04 PM12/20/21
to
Package: pcscd
Version: 1.9.5-1
Followup-For: Bug #1001155

Hello,

I just encountered the same problem. Digging into it (and before having
found this bug in the BTS) I saw the postinst script of pcscd restarts
the daemon twice. Once explicitly in debian/pcscd.postinst:

case "$1" in
configure|reconfigure)
# restart pcscd (PCSC daemon)
invoke-rc.d pcscd restart
;;

and again later added by dh_installinit/13.5.2:

if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/pcscd" ]; then
update-rc.d pcscd defaults >/dev/null
invoke-rc.d --skip-systemd-native pcscd restart || exit 1
fi
fi

Even if you consider it a bug to mask pcscd.socket but not pcscd.service
(I disagree BTW), I still ask you to remove the explicit call to
invoke-rc.d pcscd restart, as the snippet added by dh_installinit should
serve the same purpose and this doesn't fail with pcscd.socket masked.

The latter invocation of invoke-rc.d is also better as it honors policy
9.3.3 "Maintainer scripts for packages including init scripts must use
update-rc.d [...]." So keeping the status quo might even justify a
serious severity for this bug.

(Note: There is one relevant difference, where I'm unsure if the snippet
added by dh_installinit is better: The explicit call also triggers for
$1 == reconfigure.)

Best regards
Uwe

Ludovic Rousseau

unread,
Dec 22, 2021, 3:10:03 PM12/22/21
to
On Mon, 20 Dec 2021 23:21:39 +0100 =?utf-8?q?Uwe_Kleine-K=C3=B6nig?=
<ukle...@debian.org> wrote:
> Hello,

Hello Uwe,

> I just encountered the same problem. Digging into it (and before having
> found this bug in the BTS) I saw the postinst script of pcscd restarts
> the daemon twice. Once explicitly in debian/pcscd.postinst:
>
> case "$1" in
> configure|reconfigure)
> # restart pcscd (PCSC daemon)
> invoke-rc.d pcscd restart
> ;;
>
> and again later added by dh_installinit/13.5.2:
>
> if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
> if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/pcscd" ]; then
> update-rc.d pcscd defaults >/dev/null
> invoke-rc.d --skip-systemd-native pcscd restart || exit 1
> fi
> fi

I added the first "restart" by hand in
https://salsa.debian.org/debian/pcsc-lite/-/commit/9bf51b9f1bd362dfce3fb6976aa2ce520487a433
to fix #995814

The second "restart" call is added by dh_installinit as you noted.

My fix is not correct. pcscd WAS already restarted on install or
upgrade. I had not checked myself what Philipp wrote in #995814.
Thanks for the notice.

> Even if you consider it a bug to mask pcscd.socket but not pcscd.service
> (I disagree BTW), I still ask you to remove the explicit call to
> invoke-rc.d pcscd restart, as the snippet added by dh_installinit should
> serve the same purpose and this doesn't fail with pcscd.socket masked.

Done in
https://salsa.debian.org/debian/pcsc-lite/-/commit/935e0eaeaa02fdd1bef30c6f1a93db571a027fbb

> The latter invocation of invoke-rc.d is also better as it honors policy
> 9.3.3 "Maintainer scripts for packages including init scripts must use
> update-rc.d [...]." So keeping the status quo might even justify a
> serious severity for this bug.
>
> (Note: There is one relevant difference, where I'm unsure if the snippet
> added by dh_installinit is better: The explicit call also triggers for
> $1 == reconfigure.)

It should not be a problem to NOT restart pcscd in case of "reconfigure"
because the same pcscd binary was already present. A restart is not
needed in this case.

Thanks for your comments.

Bye
0 new messages