'snap create-key' errors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Triaged
|
Medium
|
Unassigned |
Bug Description
While trying to follow:
https:/
I get an error when trying to run 'snap create-key':
```
$ snap create-key
Passphrase:
Confirm passphrase:
error: /usr/bin/gpg --batch --gen-key failed: exit status 2 ("gpg: lookup_hashtable failed: Unknown system error\ngpg: trustdb: searching trust record failed: Unknown system error\ngpg: Error: The trustdb is corrupted.\ngpg: You may try to re-create the trustdb using the commands:\ngpg: cd ~/.gnupg\ngpg: gpg --export-ownertrust > otrust.tmp\ngpg: rm trustdb.gpg\ngpg: gpg --import-ownertrust < otrust.tmp\ngpg: If that does not work, please consult the manual\n")
```
Following the poorly formatted instructions in the error message doesn't work for me, but I suspect perhaps snapd doesn't actually use my `.gnupg` in $HOME? In any case, my ~/.gnupg/ setup seems to be working fine, and without any corruption.
Additionally, before running 'snap create-key', the 'snap keys' command returned an empty list, but did not error. After running the above command, 'snap keys' now prints the same gpg error message.
My snap version is:
```
snap 2.26.14
snapd 2.26.14
series 16
ubuntu 17.04
kernel 4.10.0-26-generic
```
Any hints as to how I can fix this?
description: | updated |
Changed in snapd: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Update:
I realised after posting this bug that of course I need to set GNUPGHOME to ~/.snap/gnupg/ before running the comments that gpg suggests to fix the database. Once I'd done that the 'snap keys' command seemed happy again.
I'm unblocked, but it seems like there's some way in which snapd's gpg database can become corrupted.