Invalid signature on ubuntu focal mongo 4.4 repo

I just tried to upgrade the packages on my ubuntu focal based server and got these repo signature errors:

Err:12 MongoDB Repositories focal/mongodb-org/4.4 Release.gpg
The following signatures were invalid: EXPKEYSIG 656408E390CFB1F5 MongoDB 4.4 Release Signing Key <packaging@mongodb.com>

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: MongoDB Repositories focal/mongodb-org/4.4 Release: The following signatures were invalid: EXPKEYSIG 656408E390CFB1F5 MongoDB 4.4 Release Signing Key <packaging@mongodb.com>
W: Failed to fetch https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/4.4/Release.gpg The following signatures were invalid: EXPKEYSIG 656408E390CFB1F5 MongoDB 4.4 Release Signing Key <packaging@mongodb.com>
W: Some index files failed to download. They have been ignored, or old ones used instead.

Please fix.

Best regards,
Martin

1 Like

hi Martin, i’ve this issue since this morning, do you find some solutions since ?

Hello Martin,

The error you’re encountering indicates that the GPG key for the MongoDB repository has expired. To fix this, you will need to update the expired key. Here’s a short guide on how to do it:

Remove the Old Key: First, remove the expired key using the following command:
sudo apt-key del 656408E390CFB1F5

Add the New Key: Then, add the new key from the MongoDB key server:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 656408E390CFB1F5

Update the Package List: After adding the new key, update the package list:
sudo apt-get update

This should resolve the signature errors and allow you to upgrade your packages. Bold the relevant parts of the response to make it easy to read for the user.