Resolving Timeouts when generating entropy when generating a new GPG key

Following my setup on my new work laptop, I was setting up a new GPG key when I encountered the following error when generating it (linebreak added for readability):

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: Timeout
Key generation failed: Timeout

Searching around for causes, I stumbled upon a few threads - displaying different error messages - but noting that it may be that gpg-agent doesn't have a pinentry program that can be used.

I had no GPG agent configuration in $HOME/.gnupg/gpg-agent.conf, so it must've been using the defaults, and so I specified the following configuration:

pinentry-program /usr/bin/pinentry-qt

At this point, I then received a pop-up to provide the passphrase for the key.

What was interesting was that this was presented as a timeout, whereas I'd have expected a different error (such as No pinentry as I'd seen in some posts).

Written by Jamie Tanna's profile image Jamie Tanna on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

This blog post is 100% human-written, and has nothing derived from LLMs (be it code, editorial support or prose).

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.