I am unable to generate a gpg key through the keyring program

9,685

Solution 1

For me, deleting the .gnugpg folder helped:

sudo rm -rf ~/.gnugpg

Solution 2

Permissions might be wrong after you ran gpg from root, making it impossible to modify one/some of the files as ordinary user "joey".

find ~/.gnupg -type d -exec sudo chown joey:joey {} \; -exec chmod 700 {} \;
find ~/.gnupg -type f -exec sudo chown joey:joey {} \; -exec chmod 600 {} \;

In case case you don't want to delete any existing keys, this will be helpful.

Share:
9,685

Related videos on Youtube

Wayne Len
Author by

Wayne Len

Updated on September 18, 2022

Comments

  • Wayne Len
    Wayne Len over 1 year

    Whenever I try to generate a gpg key through the system's GPG program, it asks for my name, email, and password then everything except for the GPG program's main window disappears.

    Upon using gpg key-gen

    gpg: can't open `/home/jesse/.gnupg/random_seed': Permission denied
    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: WARNING: some OpenPGP programs can't handle a DSA key with this digest size
    +++++++++++++++..++++++++++...+++++++++++++++.+++++..+++++.+++++.++++++++++.+++++++++++++++..+++++.++++++++++++++++++++.++++++++++++++++++++++++++++++.+++++.+++++.+++++...+++++>+++++...+++++++++++++++++++++++++..+++++++++++++++>.+++++>+++++................................................................................................................................................................................................................................................................................>.+++++.................................................................................................................+++++
    
    Not enough random bytes available.  Please do some other work to give
    the OS a chance to collect more entropy! (Need 300 more bytes)
    gpg: no writable public keyring found: eof
    Key generation failed: eof
    gpg: note: random_seed file not updated
    
  • Wayne Len
    Wayne Len about 8 years
    That is what eventually worked for me. I must have forgotten to come back and put the answer here. Thank you for your response.
  • Danny van der Knaap
    Danny van der Knaap over 6 years
    This didn't worked for me on 17.10
  • Pablo Bianchi
    Pablo Bianchi almost 5 years
    Sockets present on that location also should be owned by $USER:$USER? You can just use $USER:$USER, your current user.