mysqldebiangnupgapt

apt-get update for mysql fails with errors NO_PUBKEY and EXPKEYSIG on Debian 11.5


I've been all over the web and am caught in a loop here. I have seen other posts about this but have not found any solutions.
So this is the cycle. I try to run apt-get update and it says:

root@linode (apt ): apt-get update
Hit:1 http://repo.mysql.com/apt/debian jessie InRelease
Hit:2 https://packages.sury.org/php bullseye InRelease                                                                             
Hit:3 https://deb.nodesource.com/node_14.x bullseye InRelease                                                                      
Hit:4 http://httpredir.debian.org/debian bullseye InRelease                                                                        
Err:1 http://repo.mysql.com/apt/debian jessie InRelease                                          
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8C718D3B5072E1F5
Hit:5 http://apt-longview.linode.com bullseye InRelease                                          
Hit:6 http://httpredir.debian.org/debian bullseye-updates InRelease
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.mysql.com/apt/debian jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8C718D3B5072E1F5
W: Failed to fetch http://repo.mysql.com/apt/debian/dists/jessie/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8C718D3B5072E1F5
W: Some index files failed to download. They have been ignored, or old ones used instead.

So I do this:

root@linode (apt ):  gpg --keyserver keyring.debian.org  --recv-keys 8C718D3B5072E1F5
root@linode (apt ):  gpg --export 8C718D3B5072E1F5 | sudo apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
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.mysql.com/apt/debian jessie InRelease: The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <mysql-build@oss.oracle.com>
W: Failed to fetch http://repo.mysql.com/apt/debian/dists/jessie/InRelease  The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <mysql-build@oss.oracle.com>

How do I update this key so I can update my mysql installation?

I'm on debian 11.5 Thank you so much, this is driving me insane.


Solution

  • You still seem to have the "jessie" (Debian 8) repositories for mysql in there. I'd suggest trying to move on to the adequate repository for your current Distribution of "bullseye" (Debian 11).

    Other than that there were some successes to stay on the EOL version, but you should definitely look into moving to a more current state unless you are forced to stay with the old version.

    You could achieve that by changing your /etc/apt/sources.list and editing the sources for mysql to the provider or version you wish. The problem is that the signingkeys have been replaced (as per the link above). Regarding gpg keys, I usually curl them to /usr/share/keyrings/ and then update the /etc/apt/sources.list or /etc/apt/sources.list.d/[...] accordingly. This should be a good reference altough it being another piece of Software.