The old QGIS key ring qgis-2017.gpg.key is expired and generates a warning during apt update today.

Following the QGIS instructions, I tried to update the key as follows:

wget -O - https://qgis.org/downloads/qgis-2019.gpg.key | gpg --import
gpg --fingerprint 51F523511C7028C3

But instead of the normal output, I get an error:

$ wget -O - https://qgis.org/downloads/qgis-2019.gpg.key | gpg --import
--2019-08-16 18:36:35--  https://qgis.org/downloads/qgis-2019.gpg.key
Resolving qgis.org (qgis.org)...,, 2606:4700:30::681b:8bdc, ...
Connecting to qgis.org (qgis.org)||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1839 (1.8K) [application/pgp-keys]
Saving to: ‘STDOUT’

-                   100%[===================>]   1.80K  --.-KB/s    in 0s      

2019-08-16 18:36:35 (33.3 MB/s) - written to stdout [1839/1839]

gpg: key 51F523511C7028C3: 1 signature not checked due to a missing key
gpg: no writable keyring found: Not found
gpg: error reading '[stdin]': General error
gpg: import from '[stdin]' failed: General error
gpg: Total number processed: 0

How can I fix the error please?

  • what apt repository are you using? The one for "cosmic" still uses the expired 2017 key :-( – Dakatine Aug 19 '19 at 12:25
  • 2
    @Dakatine I am using deb https://qgis.org/debian bionic main in /etc/apt/sources.list. – tinlyx Aug 19 '19 at 23:28
  • thank you. Unfortunately it is not working here on Ubuntu 10.10. – Dakatine Aug 20 '19 at 14:36

Based on old notes, the following seems to work:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 51F523511C7028C3

-- Update --

As of August 2020:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F7E06F06199EF2F2
| improve this answer | |
  • 2
    On Ubuntu 19.04 this also solved the following problem for me. W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: qgis.org/debian disco InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51F523511C7028C3 – Dennis Aug 18 '19 at 20:04
  • On Ubuntu 16.04 (Xenial) this is not working. When I try to update I get "W: Failed to fetch qgis.org/ubuntugis/dists/xenial/InRelease The following signatures were invalid: KEYEXPIRED 1565999960" – Daniel Aug 22 '19 at 14:40

After you have verified the fingerprint you forgot to add the key to apt with:

gpg --export --armor 51F523511C7028C3 | sudo apt-key add -  

Read the QGIS documentation. All the instructions are:

wget -O - https://qgis.org/downloads/qgis-2019.gpg.key | gpg --import
gpg --fingerprint 51F523511C7028C3
gpg --export --armor 51F523511C7028C3 | sudo apt-key add -
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.