'snap create-key' errors

Bug #1707481 reported by Thomi Richards on 2017-07-30
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

While trying to follow:


I get an error when trying to run 'snap create-key':

$ snap create-key
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?

Thomi Richards (thomir) on 2017-07-30
description: updated
Thomi Richards (thomir) wrote :


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) on 2018-01-02
Changed in snapd:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers