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.

Thanks Vincent. Unfortunately I tried to do that, but the error simply returned with the update.

Hello,

Any updates on this issue so far? We’ve encountered the exact same issue while trying to upgrade from Ubuntu Focal mongodb 4.4 to mongodb 5.0. Followed steps as per the documentation and tried fixes from other forums but to no avail.

Martin,
Is it possible to know what version are you ugrading to upon receiving said error? Also what mongodb are you using? Enterprise or community?

Thank you,
Jeric

I’m not really trying to update Mongo at all. Simply running the standard apt update and apt upgrade to keep all packages up to date. In order to do that, I have had to remove the reference to the Mongo repo because of the expired key. Exactly where that leaves the Unifi controller (that relies on an old version of Mongo) I don’t know.

Hi Jeric,

It’s been a while and since then, but TP-Link Omada SDN has been upgraded to 7.14 so I can start researching the upgrade path. My plan is to go all the way to 7.0 since Omada SDN 7.14 supports that now and gives me the most durable deploy for the time being.

I guess I’m using CE version of mongodb?
This are my installed mongodb packages on Ubuntu Jammy:

ii mongodb-database-tools 100.9.4 amd64 mongodb-database-tools package provides tools for working with the MongoDB server:
ii mongodb-org 4.4.29 amd64 MongoDB open source document-oriented database system (metapackage)
ii mongodb-org-database-tools-extra 4.4.29 amd64 Extra MongoDB database tools
ii mongodb-org-mongos 4.4.29 amd64 MongoDB sharded cluster query router
ii mongodb-org-server 4.4.29 amd64 MongoDB database server
ii mongodb-org-shell 4.4.29 amd64 MongoDB shell client
ii mongodb-org-tools 4.4.29 amd64 MongoDB tools

The error is in the first post of this mail thread:

Err:12 [Link to 4.4Release.gpg]
The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 656408E390CFB1F5

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: [Link to 4.4 Release]: The following si
gnatures couldn’t be verified because the public key is not available: NO_PUBKEY 656408E390CFB1F5
W: Failed to fetch [Link to 4.4 Release.gpg] The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 656408E390CFB1F5
W: Some index files failed to download. They have been ignored, or old ones used instead.

Best regards,
Martin

Hello,

Upon testing on a virtual machine I was able to install mongodb 4.4 without encountering that error being able to upgrade up to 5.0. I am trying to replicate the error so that we could fix it on our production mongodb. Any additional updates as to what might be causing that error?

Thank you,
Jeric

Your suggestion of
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 656408E390CFB1F5
worked for me but I did not run
sudo apt-key del 656408E390CFB1F5
Maybe by chance that is the fix