in How To

How to: Cosa fare se si presenta l’errore KEYEXPIRED nell’aggiornamento Ubuntu/Debian Linux

Aggiornare un sistema Ubuntu Linux da riga di comando è molto semplice. Si utilizza il comando “ape-get update & ape-get upgrade” e il sistema fa praticamente tutto da sé.

Occorre ovviamente fare estrema attenzione nella fase di aggiornamento ed assicurarsi che le modifiche non rendano il sistema inutilizzabile. E’ sempre opportuno fare un backup del sistema prima di procedere.

A volte capita che durante l’aggiornamento del sistema Linux qualcosa non vada a buon fine.

Un errore che spesso si presenta è KEYEXPIRED dovuto al fatto che la chiave del repository utilizzato per installare un pacchetto sia scaduto.

Hit:1 http://it.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://it.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:3 http://it.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease [23.9 kB]
Get:5 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Ign:6 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 InRelease
Get:7 https://deb.nodesource.com/node_9.x xenial InRelease [4,622 B]
Get:8 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release [3,457 B]
Get:9 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release.gpg [801 B]
Err:9 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release.gpg
The following signatures were invalid: KEYEXPIRED 1578250443
Get:10 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages [58.4 kB]
Get:11 http://it.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1,140 kB]
Get:12 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main i386 Packages [58.2 kB]
Get:13 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [863 kB]
Get:14 http://it.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [918 kB]
Get:15 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages [660 kB]
Get:16 http://it.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [797 kB]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [491 kB]
Get:18 http://it.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [721 kB]
Get:19 http://security.ubuntu.com/ubuntu xenial-security/universe i386 Packages [422 kB]
Fetched 6,487 kB in 1s (3,924 kB/s)
Reading package lists… Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release: The following signatures were invalid: KEYEXPIRED 1578250443
W: Failed to fetch http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.4/Release.gpg The following signatures were invalid: KEYEXPIRED 1578250443
W: Some index files failed to download. They have been ignored, or old ones used instead.

In particolare questo è il messaggio che indica in dettaglio il problema

The following signatures were invalid: KEYEXPIRED 1578250443

Come risolvere il problema

apt-key list

f.lanciotti@servizi-collaudo:~$ sudo apt-key list

/etc/apt/trusted.gpg

——————–

pub   1024D/437D05B5 2004-09-12

uid                  Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>

sub   2048g/79164387 2004-09-12

pub   4096R/C0B21F32 2012-05-11

uid                  Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>

pub   4096R/EFE21092 2012-05-11

uid                  Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>

pub   1024D/FBB75451 2004-12-30

uid                  Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>

pub   4096R/68576280 2014-06-13

uid                  NodeSource <gpg@nodesource.com>

sub   4096R/AA01DA2C 2014-06-13

pub   4096R/A15703C6 2016-01-11 [expired: 2020-01-05]

uid                  MongoDB 3.4 Release Signing Key <packaging@mongodb.com>

/etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg

——————————————–

pub   1024R/E5267A6C 2009-01-26

uid                  Launchpad PPA for Ondřej Surý

In questo caso la riga che indica la chiave del pacchetto scaduto è A15703C6 chiave rilasciata l’11 Novembre 2016 e scaduta il 05 maggio 2020

pub 4096R/A15703C6 2016-01-11 [expired: 2020-01-05]
uid MongoDB 3.4 Release Signing Key packaging@mongodb.com

A questo punto sarà sufficiente prendere nota della chiave e utilizzare il comando

apt-key adv –keyserver keys.gnupg.net –recv-keys <chiave> per aggiornala

apt-key adv –keyserver keys.gnupg.net –recv-keys A15703C6

l’esito sarà

Executing: /tmp/tmp.Mr3CvohlXA/gpg.1.sh –keyserver
keys.gnupg.net
–recv-keys
A15703C6
gpg: requesting key A15703C6 from hkp server keys.gnupg.net
gpg: key A15703C6: public key “Totally Legit Signing Key mallory@example.org” imported
gpg: key A15703C6: “MongoDB 3.4 Release Signing Key packaging@mongodb.com” 1 new signature
gpg: Total number processed: 2
gpg: imported: 1 (RSA: 1)
gpg: new signatures: 1

A questo punto si potrà procedere con l’aggiornamento sicuri del fatto che il repository utilizzato sia valido. Si pùò aggiornare il sistema utilizzando apt-get update.

apt-get update

Ign:1 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 InRelease
Hit:2 http://it.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release [3,457 B]
Hit:4 http://it.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:5 http://it.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease [23.9 kB]
Get:7 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release.gpg [801 B]
Get:8 https://deb.nodesource.com/node_9.x xenial InRelease [4,622 B]
Get:9 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages [58.8 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:11 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4/multiverse amd64 Packages [16.4 kB]
Get:12 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main i386 Packages [58.5 kB]
Get:13 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4/multiverse arm64 Packages [16.4 kB]
Fetched 292 kB in 0s (359 kB/s)
Reading package lists… Done

Ora il comando si è concluso senza errori e si potrà procedere con

apt-upgrade

Buon update!

Scrivi un commento

Commento