GPG 密钥未生成:gpg 中的 agent_genkey 正在寻找某些文件

GPG 密钥未生成:gpg 中的 agent_genkey 正在寻找某些文件

我在我的 mac 上生成 gpg 密钥时遇到问题( 10.15.7 Catalina)。它显示一些错误,表明正在agent_genkey查找某些不可用的文件。以下是其中的调试信息:

% gpg --gen-key -vvvvv   
gpg (GnuPG) 2.3.1; Copyright (C) 2021 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: using character set 'utf-8'
gpg: Note: RFC4880bis features are enabled.
gpg: directory '/Users/test/.gnupg' created
gpg: keybox '/Users/test/.gnupg/pubring.kbx' created
Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: test name
Email address: [email protected]
You selected this USER-ID:
    "test name <[email protected]>"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? O
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: no running gpg-agent - starting '/usr/local/Cellar/gnupg/2.3.1/bin/gpg-agent'
gpg: waiting for the agent to come up ... (5s)
gpg: connection to the agent established
gpg: pinentry launched (12023 curses 1.1.1 /dev/ttys002 xterm-256color - ? 502/20 0)
gpg: agent_genkey failed: No such file or directory
Key generation failed: No such file or directory

gpg 版本是2.3.1,git 版本是2.30.0

% gpg --version
gpg (GnuPG) 2.3.1
libgcrypt 1.9.3

我尝试过各种帖子中给出的建议:例如删除主目录(~/.gnupg)、停止gpg-agent、重新安装gpg软件包(使用brew)。

大约 1 个月前它就起作用了。之前的钥匙有一些问题。因此,我必须删除所有这些并生成新的,这就是问题开始的地方。在重新安装之前, gpg key 的生成超时。我运行了dd命令来帮助生成随机性。但这也不起作用。

答案1

这个问题这被称为预期行为,原因是缺乏与终端相关的设备文件的所有权。例如,当以普通用户身份启动终端,但运行gpg命令时,可能会发生这种情况通过susudo.

而不是chmod在里面做疯狂的特技/dev这条评论演示了使用的快速修复tmux。基本上只需在会话gpg中运行相同的命令tmuxtmux即可处理正确的设备文件所有权。

相关内容