The other I was trying to generate GPG key. But It took really a long time. I was running out of time and my patience. The GPG isn’t generated even after I waited for almost an hour. I am not aware of GPG key generation process, and I have never created one before. So I dig a little in Google and found out that I need to generate enough Entropy for GPG key generation process. If you are ever been in this situation, read on. It was not that difficult.
Download Free eBook: “Jump Start GIT ($30 Value, FREE)”
Generate Enough ‘Entropy’ For GPG Key Generation ProcessI entered the following command to create a GPG key:
gpg --gen-keyAnd, I got this message:
[...]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 pinentry
Key generation failed: No pinentry

As you in the above command, it shows there is “no Pinentry” package.
Make sure you have installed pinentry-gtk or pinentry-qt packages.
To install this package on Arch based systems, run:
sudo pacman -S pinentryOn RPM based systems:
sudo yum install pinentryOn DEB based systems:
sudo apt-get install pinentryThen, create or edit gpg-agent.conf file:
sudo nano ~/.gnupg/gpg-agent.confAnd add one of the following lines:
pinentry-program /usr/bin/pinentry-cursesOr,
pinentry-program /usr/bin/pinentry-qt
Save and close the file. Reboot your system to apply the changes.
Now, let us create GPG key:
gpg --gen-keyHere is where I got struck for hours. I ran this command and waited for an hour. It says I don’t have sufficient Entropy and didn’t create the key.
To create enough entropy we need to install a package called “rng-tools” .
On Arch linux and its derivatives, run:
sudo pacman -S rng-toolsOn RHEL and its derivatives, run:
sudo yum install epel-release sudo yum install rng-toolsOn Debian/Ubuntu and derivatives, run:
sudo apt-get install rng-toolsIn case the above package is not available, try to install “rng-utils” instead.
After you installed this utility, run the following command to gain enough Entropy:
sudo rngd -r /dev/urandomRepeat the above command until you got enough Entropy to create a GPG key.
Let us check the amount of bytes of entropy currently available using command:
cat /proc/sys/kernel/random/entropy_avail Sample output:
Now, try to create GPG key again. This time the GPG key generation process will be much faster.
gpg --gen-keyEnter your name and mail ID and press enter.
Enter your passphrase:

Re-enter passphrase:

Success! The GPG key has been created.

That’s all for now. If you find this guide helpful, please share it on your social networks and support us.
Cheers!