如何解决我在日志中发现的这个错误:
set 04 09:56:37 hostname gpg-agent[PID]: can't connect to the daemon /usr/lib/gnupg/scdaemon: IPC connect call failed
set 04 09:56:38 hostname gpg-agent[PID]: can't connect to the daemon /usr/lib/gnupg/scdaemon: IPC connect call failed
set 04 09:56:39 hostname gpg-agent[PID]: can't connect to the daemon /usr/lib/gnupg/scdaemon: IPC connect call failed
set 04 09:56:40 hostname gpg-agent[PID]: can't connect to the daemon /usr/lib/gnupg/scdaemon: IPC connect call failed
Ubuntu版本:
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble
我检查了引用的文件,它丢失了:
$ ls -al /usr/lib/gnupg/scdaemon
ls: cannot access '/usr/lib/gnupg/scdaemon': No such file or directory
然后我查看
gpg-agent
手册。我发现了这个:
--scdaemon-program filename Use program filename as the Smartcard daemon. The default is installation dependent and can be shown with the gpgconf command.
和
--disable-scdaemon Do not make use of the scdaemon tool. This option has the effect of disabling the ability to do smartcard operations. Note, that enabling this option at runtime does not kill an already forked scdaemon.
因为我不使用任何智能卡硬件,所以不需要任何 scdaemon。
$ systemctl --user --full edit gpg-agent.service
将
--disable-scdaemon
添加到 ExecStart
:
[Unit]
Description=GnuPG cryptographic agent and passphrase cache
Documentation=man:gpg-agent(1)
Requires=gpg-agent.socket
[Service]
ExecStart=/usr/bin/gpg-agent --supervised --disable-scdaemon
ExecReload=/usr/bin/gpgconf --reload gpg-agent
重新加载配置:
$ systemctl --user reload gpg-agent.service
重启服务:
$ systemctl --user restart gpg-agent.service
最终如果
restart
没有响应:
$ killall -9 gpg-agent
systemctl 将使用新选项重新启动代理。