Home | News | Download | Packages | Forum | Wiki | Github

Gen gpg key

(Richard DW Redcroft) #1


Having a little trouble generating a gpg key. I have gpgme installed, and im running the following command

gpg2 --full-gen-key

but it timesout

gpg: agent_genkey failed: Timeout Key generation failed: Timeout

running gpg-agent
gpg-agent[9266]: gpg-agent running and available

i also have dbus running incase that matters.


Sounds like insufficient entropy. Try doing other work for a while, to let the random number generator gather entropy from system events.

Or use rngd from the rng-tools package to collect entropy from more sources. The Arch wiki article on it may be helpful—just mentally substitute the systemd stuff with equivalent sv commands.

(Richard DW Redcroft) #3

Hey thanks,
I thought it might have been due to entropy and spent the last couple of hours trying to diagnose insufficient entorpy. Turns out that pinentry wasnt working so i couldnt enter a passphrase input. Adding the following to my profile worked

“export GPG_TTY=$(tty)”

atleast i think thats what fixed it, i tried various things


It’s the agent. Your command works without one, as tested:

rm -rf ~/.gnupg
gpg2 --full-gen-key

For entropy install KeePassXC and use its generator dialog to see metrics improve as you type.

Options for gnupg such as --no-tty and --pinentry-mode are worth a look.

To tweak environment vars, use dedicated agent and gnupg confs, not user login confs.