我很难在我的gpg系统上使用gpg-agent(实际上是D1)。更准确地说,我使用以下方法:
gpg --version | head -n2
gpg (GnuPG) 2.2.27
libgcrypt 1.8.8
uname -v
#1 SMP Debian 5.10.46-4 (2021-08-03)
lsb_release -a 2> /dev/null
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye我已经三个月没有重新启动我的机器了。在此期间,我能够毫无困难地使用gpg (加密、解密、签名、验证、密钥管理)。在过去的几个月里,我做了多次更新,这些更新都没有给我带来任何问题(另外,我正在使用needrestart)。在过去的3个月里,我没有在相关的配置文件(我知道,是~/.gnupg/gpg.conf,~/.gnupg/gpg-agent.conf,~/.gnupg/dirmngr.conf)中做任何改变。
今天,我重新启动了我的机器,突然之间,我无法使用我的gpg-agent做任何事情,其中涉及秘密密钥。当gpg -k [1]和gpg --search-keys DEADBEEF导致结果时,gpg -K和gpg -d /PATH/TO/ENCRYPTED/FILE也会无限期挂起。同样,gpg-connect-agent reloadagent /bye和gpgconf --kill gpg-agent以及systemctl --user start gpg-agent也会导致绞刑。同样,我的系统单元文件也没有脱离接触网:
systemctl --user cat gpg-agent | grep -Ev '^#|^我知道其他人已经描述过这个问题(例如,请参阅这里,但是所提到的解决方案(pkill -9 gpg-agent)并不适用于我,因为尽管没有运行包含字符串gpg (read:gpg-agent)的其他进程,但这种情况正在发生。ps -ef | grep gpg && echo " " && gpg --verbose --debug-level guru -K
MYUSERNAME 59248 59247 0 17:17 pts/1 00:00:00 grep --color=auto gpg
gpg: enabled debug flags: packet mpi crypto filter iobuf memory cache memstat trust hashing ipc clock lookup extprog
gpg: DBG: [not enabled in the source] start
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search_reset
gpg: DBG: keydb_search: reset (hd=0x000055c04a474cd0)
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search 0: FIRST
gpg: DBG: keydb_search: searching keybox (resource 0 of 1)
gpg: DBG: keydb_search: searched keybox (resource 0 of 1) => Success
gpg: DBG: [not enabled in the source] keydb_search leave (found)
gpg: DBG: [not enabled in the source] keydb_get_keybock enter
gpg: DBG: parse_packet(iob=1): type=6 length=51 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=12 length=12 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=13 length=19 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=12 length=12 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=2 length=150 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=12 length=6 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=2 length=150 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=12 length=6 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=14 length=56 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=2 length=126 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=12 length=6 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=14 length=51 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=2 length=245 (parse.../../g10/keydb.c.1242)
gpg: DBG: parse_packet(iob=1): type=12 length=6 (parse.../../g10/keydb.c.1242)
gpg: DBG: iobuf-1.0: underflow: buffer size: 924; still buffered: 0 => space for 924 bytes
gpg: DBG: iobuf-1.0: close '?'
<<< HERE HANGING INDEFINITELY >>>
^C
gpg: signal Interrupt caught ... exiting另外,我的变量GPG_AGENT_INFO和GPG_TTY也设置好了。echo -e "$GPG_AGENT_INFO\n$GPG_TTY"
/run/user/1000/gnupg/S.gpg-agent:0:1
/dev/pts/1重新启动。什么都没改变。有什么想法吗?edit1:重新安装gpg、gpg-agent和dirmngr并不能解决这个问题。另外,删除文件~/.gnupg/gpg.conf、~/.gnupg/gpg-agent.conf和~/.gnupg/dirmngr.conf并不能解决这个问题。edit2:同时,我从PureOS Amber升级到Debian Stable (Bullseye),重新安装了gpg、gpg-agent、dirmngr和libgcrypt20的新版本(并更改了上面的文本以反映新版本),但问题仍然存在。从技术上讲,gpg -k也是挂起的,但我认为这是因为我在with-secret的gpg.conf-file中使用了选项标记。在评论完之后,这个问题就消失了。
[Unit]
Description = gpg-agent (password store for gpg-keys)
[Service]
Type = forking
ExecStart = /usr/bin/gpg-agent --daemon
ExecStop = /usr/bin/gpg-connect-agent /bye
Restart = on-abort
[Install]
WantedBy = default.target我知道其他人已经描述过这个问题(例如,请参阅C18,但是所提到的解决方案(D19)并不适用于我,因为尽管没有运行包含字符串D20 (read:D21)的其他进程,但这种情况正在发生。
A22
另外,我的变量GPG_AGENT_INFO和GPG_TTY也设置好了。
A23
重新启动。什么都没改变。有什么想法吗?
edit1:重新安装D24、D25和D26并不能解决这个问题。另外,删除文件D27、D28和D29并不能解决这个问题。
edit2:同时,我从D30升级到D31,重新安装了D32、D33、D34和D35的新版本(并更改了上面的文本以反映新版本),但问题仍然存在。
从技术上讲,D36也是挂起的,但我认为这是因为我在D37的D38-file中使用了选项标记。在评论完之后,这个问题就消失了。
发布于 2021-09-18 22:21:51
我终于找到了解决办法,尽管我不确定我是否明白。
不知何故,由gpg-agent启动的systemd版本才是问题所在。当执行systemctl --user mask gpg-agent然后手动重新启动gpg-agent时,问题就消失了。我将尝试理解为什么会出现这种情况,然后在这里编写一个更新。
发布于 2021-09-14 15:45:23
通常,如果您reinstall gnupg,这个问题将得到解决。除非问题的原因是别的原因。
https://unix.stackexchange.com/questions/668976
复制相似问题