Empty keyring after upgrade to Ubuntu 18.04 :/

Ingo Klöcker kloecker at kde.org
Thu Jul 26 21:00:44 CEST 2018


On Donnerstag, 26. Juli 2018 17:17:58 CEST Franek Wiertara wrote:
> > On 26 Jul 2018, at 11:50, Paul M Furley <paul at paulfurley.com> wrote:
> > I upgraded from Ubuntu 16.04 LTS to Ubuntu 18.04 LTS and restored my
> > `.gnupg` directory from a backup disk.
> > 
> > Now gpg doesn't see any keys... `gpg --list-keys` just exists with no
> > output.
> > 
> > I've attached the strace output of `strace gpg --list-keys`, and here's
> > the output of `tree .gnupg/`:
> > 
> > ```
> > /home/paul/.gnupg
> > ├── crls.d
> > │   └── DIR.txt
> > ├── gpg-agent.conf
> > ├── gpg-agent-info-xps
> > ├── gpg.conf
> > ├── hkps.pool.sks-keyservers.net.pem
> > ├── openpgp-revocs.d
> > │   └── [REDACTED x2].rev
> > ├── private-keys-v1.d
> > │   └── [REDACTED x8].key
> > ├── pubring.gpg
> > ├── pubring.kbx
> > ├── random_seed
> > ├── S.dirmngr
> > ├── secring.gpg
> > ├── S.gpg-agent
> > ├── sshcontrol
> > └── trustdb.gpg

"tree .gnupg" does not list hidden files, but I guess there is a file named 
.gpg-v21-migrated in your .gnupg.


> Is it possible the two Ubuntu distributions you mentioned ship different
> versions of gnupg?

Yes. In Ubuntu 18.04, gpg is actually GnuPG 2.x (according to the release 
notes).


> I am asking about it because gnupg v. 2.0 and earlier
> and gnupg v. 2.1.x and later have different ways of storing keys. I don’t
> know the details because i started using gpg from version 2.1.x but this
> might be where you could start to investigate the issue.

gpg1 stored your private keys in secring.gpg and the public keys in 
pubring.gpg. gpg2 uses the private-keys-v1.d folder for private keys and 
pubring.kbx for public keys.

When gpg2 is run for the first time, then gpg2 migrates all old keys to the 
new locations. Maybe you ran gpg(2) after the upgrade before you restored your 
.gnupg folder. To re-run the migration remove the file .gpg-v21-migrated in 
your .gnupg and then run gpg.


Regards,
Ingo






More information about the Gnupg-users mailing list