How to Update an Expired APT Key
From time to time, you may get the errors similar to the following:
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://download.opensuse.org/repositories/shells:/fish:/release:/2/Debian_9.0 Release: The following signatures were invalid: EXPKEYSIG 2CE2AC08D880C8E4 shells:fish OBS Project <shells:fish@build.opensuse.org>
W: Failed to fetch http://download.opensuse.org/repositories/shells:/fish:/release:/2/Debian_9.0/Release.gpg The following signatures were invalid: EXPKEYSIG 2CE2AC08D880C8E4 shells:fish OBS Project <shells:fish@build.opensuse.org>
W: Some index files failed to download. They have been ignored, or old ones used instead.
Annoying, but all you have to do is update the GPG key used to verify the repository.
apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys 2CE2AC08D880C8E4
If the process fails like this
Executing: /tmp/apt-key-gpghome.n03xI0fka1/gpg.1.sh --keyserver hkp://keys.gnupg.net --recv-keys 2CE2AC08D880C8E4
gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/run/user/0/gnupg/d.549f8zc4pi8zi784a4kbmbj7/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr
install dirmngr
:
apt-get install dirmngr
Afterwards it will work:
Executing: /tmp/apt-key-gpghome.uRaRhbxXhg/gpg.1.sh --keyserver hkp://keys.gnupg.net --recv-keys 2CE2AC08D880C8E4
gpg: key 2CE2AC08D880C8E4: "shells:fish OBS Project <shells:fish@build.opensuse.org>" 2 new signatures
gpg: Total number processed: 1
gpg: new signatures: 2