problem importing gpg keys "Fatal: can't create directory '/home/hazrpg/~/.gnupg': No such file or directory

Bug #1852210 reported by Hassan Williamson
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
seahorse (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

There is a problem when importing a GPG private key from a backup, the error message says the File or Directory does not exist - and it looks like its because of the way it's trying to access it.

Here's the exact error (verbose as its displayed):

Import failed: Fatal: can't create directory '/home/hazrpg/~/.gnupg': No such file or directory

It looks like its trying to access ~/.gnupg and at the same time trying to put that in the /home/hazrpg/ directory (hazrpg being my username). It should be one or the other, so its probably a simple fix.

Steps to reproduce:

1) Open up seahorse.
2) Click on "File" -> "Import...".
3) Select any valid GPG key file (public, private, etc).
4) Verify its valid with the "Data to be imported:" section and then click on "Import".
5) Error message shows in red below the "Data to be imported:" section with the above message.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: seahorse 3.20.0-5
ProcVersionSignature: Ubuntu 4.15.0-66.75-generic 4.15.18
Uname: Linux 4.15.0-66-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.9
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Tue Nov 12 11:38:18 2019
InstallationDate: Installed on 2019-03-05 (252 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: seahorse
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Hassan Williamson (hazrpg) wrote :
Revision history for this message
Hassan Williamson (hazrpg) wrote :

Interesting, a PGP key can't be created either. I'll attach what happens when I try to.

Steps to reproduce:

1) Open seahorse.
2) Click on GnuPG keys.
3) Click on the + sign.
4) Select PGP key and click on continue.
5) Type in a Full Name and E-mail address.
6) Click Create.
7) Enter in a passphrase to protect the key.
8) Error message says "Couldn't generate PGP key" in the title, "No agent running" in the body and a "Close" button is displayed.

Revision history for this message
Hassan Williamson (hazrpg) wrote :
Revision history for this message
Hassan Williamson (hazrpg) wrote :

Further information...

Putting all the files into .gnupg folder didn't work even after a reboot (even though it was a direct backup of this directory).

However, when I then tried to generate a new one in the terminal using the following:

gpg --gen-key

And following the steps there, it created a key successfully AND when opening seahorse again... the old key was discovered too!

I've attached a screenshot of this too - the highlighted one is the new one and I've censored the email address from the new one because I don't want it being public.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in seahorse (Ubuntu):
status: New → Confirmed
Revision history for this message
James Atayi (dabayi) wrote :

The error messages “Import failed: Fatal: can't create directory '/home/username/~/.gnupg': No such file or directory” and "Couldn't generate PGP key" only come for me when trying to import or create a key from LibreOffice Writer Version: 6.0.7.3, Build ID: 1:6.0.7-0ubuntu0.18.04.10
I am using Ubuntu Version: 18.04.4 LTS (Bionic Beaver)

From LibreOffice:
File -> Digital Signatures -> Digital Signatures …
Create a new GPG Key ends with: "Couldn't generate PGP key"
Import an existing GPG Key ends with: “Import failed: Fatal: can't create directory '/home/username/~/.gnupg': No such file or directory”

When started from LibreOffice Writer there is no GPG key available. But I already created one GPG Key that is available when I start from the applications manager.

From the application’s manager.

I can easily create and export a new GPG key when I start the application from the Applications manager. And the created GPG keys are visible in the GUI

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.