You are here: Home / Journal / Fixing Flatpak public key error

Fixing Flatpak public key error

I had a pretty grim time recently trying to fix a “Flatpak public key error” on Ubuntu 20.04 LTS. Well KDE Neon to be more precise, but it’s underlying operating system is Ubuntu. I had been attempting a “user” mode installation of an application via Flatpak with no success. I installed Flatpak in the normal way. I opened a standard UNIX terminal application e.g. Konsole and typed…

sudo apt install flatpak

This appeared to install perfectly. I could install applications at a “system” level without problem. However, when I attempted to install at a user level, I kept getting “GPG errors”. For example, when I ran the following command in a terminal window…

flatpak install Fourier --user

It returned the following error message…

"An error was encountered searching remote ‘flathub’ for ‘Fourier’: 
Unable to load summary from remote flathub: 
Signature made Tue 01 Feb 2022 17:09:41 using RSA key ID 562702E9E3ED7EE8
Can't check signature: public key not found"

After lots of internet searches and abortive attempts to resolve this, I discovered the problem. Basically, I did not actually have flatpak’s public GPG key. Fortunately the solution is trivially easy.

First you need to download flatpak’s public key file…

wget https://flathub.org/repo/flathub.gpg

This returns something that looks similar to this…

--2022-02-01 17:16:26-- https://flathub.org/repo/flathub.gpg
Resolving flathub.org (flathub.org)... 46.235.231.150, 46.235.230.111, 2a00:1098:82:e::1:1, ...
Connecting to flathub.org (flathub.org)|46.235.231.150|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2844 (2.8K) [application/octet-stream]
Saving to: ‘flathub.gpg’

flathub.gpg 100%[=====================================================>] 2.78K --.-KB/s in 0s
2022-02-01 17:16:26 (457 MB/s) - ‘flathub.gpg’ saved [2844/2844]

Copy and rename the key to correct location(s). If you intend to use flatpak’s “beta” repository then you need to copy a keyfile for that too.

cp flathub.gpg ~/.local/share/flatpak/repo/flathub.trustedkeys.gpg
cp flathub.gpg ~/.local/share/flatpak/repo/flathub-beta.trustedkeys.gpg

Make sure the keyfiles are actually where they should be…

ls -la ~/.local/share/flatpak/repo/*.trustedkeys.gpg

Should return something similar to this…

-rw-rw-r-- 1 garf garf 2844 Feb 1 17:41 
/home/garf/.local/share/flatpak/repo/flathub-beta.trustedkeys.gpg
-rw-rw-r-- 1 garf garf 2844 Feb 1 17:37 
/home/garf/.local/share/flatpak/repo/flathub.trustedkeys.gpg

That’s it! No more Flatpak public key error. You should now be able to install Flatpak applications to your home directory as intended. 🙂

 

2 Comments

  1. I installed some apps with one user, but when trying to install apps on other user I was getting this same issue, super weird.

    Anyways, I was able to fix it using your suggestion, thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *