Skip to content

Commit b2ba655

Browse files
pcscd.service: add missing Requires=polkit.service
"Since v2.0.1, PCSCD uses polkit by default. After an upgrade to a pcscd version 2.0.1 and newer, I run in problems with the polkit dependency during shutdown. My own service uses pcscd for smartcard communication. During shutdown of my service, a last command is sent to the card. My service is a systemd service just as pcscd and polkit are. My systemd config refers to pcscd via Requires=pcscd.service in its systemd config file. When in shutdown state, systemd terminates all services. Terminated of pcscd is blocked until my service is terminated due to the Requires condition. However, my last smartcard communication fails due to early termination of polkit (and prevention of re-activating it) with the following error: systemd[1]: polkit.service: Deactivated successfully. ... dbus-daemon[499]: [system] Activating via systemd: service name='org.freedesktop.PolicyKit1' unit='polkit.service' requested by ':1.750' (uid=0 pid=31251 comm="/usr/sbin/pcscd --foreground --auto-exit --debug") dbus-daemon[499]: [system] Activation via systemd failed for unit 'polkit.service': Refusing activation, D-Bus is shutting down. pcscd[31251]: 00005785 /usr/src/debug/pcsc-lite/2.0.3/src/auth.c:92:IsClientAuthorized() polkit_authority_get_sync failed: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Refusing activation, D-Bus is shutting down. ... pcscd[31251]: 00000014 /usr/src/debug/pcsc-lite/2.0.3/src/winscard_svc.c:355:ContextThread() Rejected unauthorized PC/SC client I can prevent this error by adding a Requires=polkit.service to pcscd's systemd service configuration." Thanks to Jan Grieb for the bug report and the solution. "Polkit.service dependency not reflected in pcscd.service.in #227" Closes: #227
1 parent ba9ca37 commit b2ba655

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

etc/pcscd.service.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[Unit]
22
Description=PC/SC Smart Card Daemon
33
Requires=pcscd.socket
4+
@requires_polkit@
45
Documentation=man:pcscd(8)
56

67
[Service]

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ if get_option('polkit')
123123
polkit_dep = dependency('polkit-gobject-1')
124124
pcscd_dep += polkit_dep
125125
conf_data.set('HAVE_POLKIT', true)
126+
confgen_data.set('requires_polkit', 'Requires=polkit.service')
126127
features += 'polkit'
127128
endif
128129

0 commit comments

Comments
 (0)