Bug 138266

Summary: Creating/Importing of keys fails
Product: [Fedora] Fedora Reporter: Holger Eilhard <holger>
Component: gnupgAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED CURRENTRELEASE QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.4.1-3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-07 18:11:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Holger Eilhard 2004-11-06 21:03:58 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041020
Firefox/0.10.1

Description of problem:
Creating/Importing keys for a fresh created user fails. This might be
ok for importing keys but not for creating (via --gen-key).

$ gpg --gen-key
gpg (GnuPG) 1.2.6; Copyright (C) 2004 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

gpg: failed to create temporary file
`/home/testuser/.gnupg/.#lk0xf7005188.wks-nb-he.wame.de.4054': No such
file or directory
gpg: keyblock resource `/home/testuser/.gnupg/secring.gpg': general error
gpg: failed to create temporary file
`/home/testuser/.gnupg/.#lk0xf7005188.wks-nb-he.wame.de.4054': No such
file or directory
gpg: keyblock resource `/home/testuser/.gnupg/pubring.gpg': general error
Please select what kind of key you want:
   (1) DSA and ElGamal (default)
   (2) DSA (sign only)
   (4) RSA (sign only)
Your selection?
DSA keypair will have 1024 bits.
About to generate a new ELG-E keypair.
              minimum keysize is  768 bits
              default keysize is 1024 bits
    highest suggested keysize is 2048 bits
What keysize do you want? (1024)
Requested keysize is 1024 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct (y/n)? y

You need a User-ID to identify your key; the software constructs the
user id
from Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <heinrichh>"

Real name: Test Test
Email address: test
Comment: Test!
You selected this USER-ID:
    "Test Test (Test!) <test>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.

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.
+++++++++++++++++++++++++..+++++.++++++++++++++++++++++++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++++++++++++++++++++++>.+++++.+++++................+++++
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: no writable public keyring found: eof
Key generation failed: eof
gpg: can't create `/home/testuser/.gnupg/random_seed': No such file or
directory

$ gpg --import /usr/share/doc/fedora-release-3/RPM-GPG-KEY-fedora
gpg: failed to create temporary file
`/home/testuser/.gnupg/.#lk0xf7005188.wks-nb-he.wame.de.4105': No such
file or directory
gpg: keyblock resource `/home/testuser/.gnupg/secring.gpg': general error
gpg: failed to create temporary file
`/home/testuser/.gnupg/.#lk0xf7005188.wks-nb-he.wame.de.4105': No such
file or directory
gpg: keyblock resource `/home/testuser/.gnupg/pubring.gpg': general error
gpg: no writable keyring found: eof
gpg: error reading
`/usr/share/doc/fedora-release-3/RPM-GPG-KEY-fedora': general error
gpg: import from `/usr/share/doc/fedora-release-3/RPM-GPG-KEY-fedora'
failed: general error
gpg: Total number processed: 0

Version-Release number of selected component (if applicable):
gnupg-1.2.6-2

How reproducible:
Always

Steps to Reproduce:
1. Create a new user (or delete ~/.gnupg).
2. try to create a new key (gpg --gen-key)


Additional info:

Creating ~/.gnupg before calling gpg --gen-key does the trick. :)

Comment 1 Robert Scheck 2004-11-07 22:58:44 UTC
I would say, this is more a user-dependent problem rather a real bug.

Comment 2 Thomas Vander Stichele 2004-11-19 09:49:49 UTC
Robert, I disagree.   If a program needs a directory to work
correctly, it should either tell you that it's missing the directory
and that it is YOUR job to create it, or it should create it itself.

I'd suggest it creates it itself.  I don't see why the program
couldn't do it.  So it's a real bug.

Comment 3 Nalin Dahyabhai 2005-09-07 18:11:04 UTC
This was fixed in FC4, so marking as fixed in current release.