'snap create-key' errors

Bug #1707481 reported by Thomi Richards
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Triaged
Medium
Unassigned

Bug Description

While trying to follow:

https://tutorials.ubuntu.com/tutorial/create-your-own-core-image#3

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
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

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.

Michael Vogt (mvo)
Changed in snapd:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.