Arch Linux (x86_64 GNU/Linux 3.17.3-1-ARCH), and the shell is zsh.
I will list the output that is clearly exposing a bug first, then
explain how I got to that state:
/home/colin% gpg --delete-key "Colin Keenan"
gpg (GnuPG) 2.0.26; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gpg: there is a secret key for public key "Colin Keenan"!
gpg: use option "--delete-secret-keys" to delete it first.
/home/colin% gpg --delete-secret-key "Colin Keenan"
gpg (GnuPG) 2.0.26; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gpg: key "Colin Keenan" not found: Unknown system error
gpg: Colin Keenan: delete key failed: Unknown system error
So, you see the problem: --delete-key fails because there is a secret
key, and --delete-secret-key fails because the secret key is not found
due to an unknown system error!
Here is how I got to that state:
After setting up gpg.conf (attached), I created a new key (not as
root, as user 'colin')
gpg --gen-key
Then, I'm not sure what I did, but I ended up having the key listed
twice when I doing 'gpg --list-public-keys colin'. 'colin' matches my
email address colinnkeenan@gmail.com. It is the exact same key, uid,
fingerprint, etc. listed both as the first key and the last key.
My bug is not about the duplicate entry, it's about what has happened
now that I've tried to remove the duplicate entry. My plan was to
change the uid of the first of the duplicates so that I could refer to
it alone, and delete it. Here is what I did:
- add another uid to one of the duplicates:
/home/colin% gpg --edit-key colin
gpg (GnuPG) 2.0.26; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Secret key is available.
pub 4096R/0940E3F9 created: 2014-11-18 expires: 2015-11-18 usage:
SC
trust: ultimate validity: ultimate
sub 4096R/EDA19F9C created: 2014-11-18 expires: 2015-11-18 usage:
E
[ultimate] (1). Colin Keenan <colinnkeenan@gmail.com>
[ultimate] (2) [jpeg image of size 6283]
gpg> adduid
Real name: Colin N Keenan
Email address: colinnkeenan@gmail.com
Comment:
You selected this USER-ID:
"Colin N Keenan <colinnkeenan@gmail.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a passphrase to unlock the secret key for
user: "Colin Keenan <colinnkeenan@gmail.com>"
4096-bit RSA key, ID 0940E3F9, created 2014-11-18
pub 4096R/0940E3F9 created: 2014-11-18 expires: 2015-11-18 usage:
SC
trust: ultimate validity: ultimate
sub 4096R/EDA19F9C created: 2014-11-18 expires: 2015-11-18 usage:
E
[ultimate] (1) Colin Keenan <colinnkeenan@gmail.com>
[ultimate] (2) [jpeg image of size 6283]
[ unknown] (3). Colin N Keenan <colinnkeenan@gmail.com>
gpg> save
- remove the uid that is duplicated
/home/colin% gpg --edit-key "Colin N Keenan"
gpg (GnuPG) 2.0.26; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Secret key is available.
pub 4096R/0940E3F9 created: 2014-11-18 expires: 2015-11-18 usage:
SC
trust: ultimate validity: ultimate
sub 4096R/EDA19F9C created: 2014-11-18 expires: 2015-11-18 usage:
E
[ultimate] (1). Colin N Keenan <colinnkeenan@gmail.com>
[ultimate] (2) Colin Keenan <colinnkeenan@gmail.com>
[ultimate] (3) [jpeg image of size 6283]
gpg> 2
pub 4096R/0940E3F9 created: 2014-11-18 expires: 2015-11-18 usage:
SC
trust: ultimate validity: ultimate
sub 4096R/EDA19F9C created: 2014-11-18 expires: 2015-11-18 usage:
E
[ultimate] (1). Colin N Keenan <colinnkeenan@gmail.com>
[ultimate] (2)* Colin Keenan <colinnkeenan@gmail.com>
[ultimate] (3) [jpeg image of size 6283]
gpg> deluid
Really remove this user ID? (y/N) y
pub 4096R/0940E3F9 created: 2014-11-18 expires: 2015-11-18 usage:
SC
trust: ultimate validity: ultimate
sub 4096R/EDA19F9C created: 2014-11-18 expires: 2015-11-18 usage:
E
[ultimate] (1). Colin N Keenan <colinnkeenan@gmail.com>
[ultimate] (2) [jpeg image of size 6283]
gpg> quit
Save changes? (y/N) y
- Try to delete the key with uid "Colin Keenan", keeping the one with
"Colin N Keenan"
/home/colin% gpg --delete-key "Colin Keenan"
gpg (GnuPG) 2.0.26; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gpg: there is a secret key for public key "Colin Keenan"!
gpg: use option "--delete-secret-keys" to delete it first.
/home/colin% gpg --delete-secret-key "Colin Keenan"
gpg (GnuPG) 2.0.26; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gpg: key "Colin Keenan" not found: Unknown system error
gpg: Colin Keenan: delete key failed: Unknown system error
And, that's the bug. I can't delete it because gpg says there is a
secret key but it can't find it.