~/.gnugpg 中的文件意外损坏,现在当我生成新密钥时出现此错误:
gpg:agent_genkey 失败:没有此文件或目录 密钥生成失败:没有此文件或目录
我该如何重新创建基本文件?
以下是减去敏感数据的完整输出:
gpg --default-new-key-algo rsa4096 --gen-key
gpg (GnuPG) 2.4.4; Copyright (C) 2024 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
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: Fred Bloggs
Email address: [email protected]
You selected this USER-ID:
"Fred Bloggs <[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: agent_genkey failed: No such file or directory
Key generation failed: No such file or directory
答案1
问题已解决。我发现了一个错误。由于某种原因,当您第二次运行 gpg 时,它会寻找特定的语言环境。如果您的语言环境是 EN_AU 和 en_US,那么它缺少 gpg 想要的文件。但我搜索后发现 en_UK 有该文件。因此,我将机器的语言环境更改为 UK,删除 .gnupg 目录后,一切正常。我正在向 GPG 提出这个错误。
我通过运行 strace 发现了这个错误,并能看到哪些文件丢失并导致了错误。