Mongo db 4.0 GPG key expired for ubuntu 18.04

GPG error: MongoDB Repositories bionic/mongodb-org/4.0 Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 68818C72E52529D4
E: The repository ‘MongoDB Repositories bionic/mongodb-org/4.0 Release’ is not signed.

MongoDB 4.0 is EoL software(April 2022), as well as Ubuntu 18.04(June 2023)

Looking at JIRA this is not something that MongoDB plans on fixing.

its happening in Ubuntu 20.04 also , and I am currently using mongodb 3.6 , i want to upgrade it to mongodb 5.0 , how can I do it then ??

The deb files can be downloaded directly from the release archive and they can be installed via dpkg -i

The other other workaround would be to explicitly trust the 4.0 repo, do this only on the 4.0 repo(or other unsupported / expired repo key) if you choose to use this option.

Add the trusted=yes option to the repo definition, read man 5 sources.list to understand this option and its implications.
echo "deb [ arch=amd64,arm64 trusted=yes ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list

Hello Chris,

Can you give a more detailed way as to how install via dpkg -i using release archives. I’ve found documentation using the tgz file do we follow said documentation but none whatsoever that uses dpkg -i. Thank you attached is the link using tarball to install mongo (https://www.mongodb.com/docs/v4.4/tutorial/install-mongodb-on-ubuntu-tarball/)

Thank you,
Jeric

After downloading the new packages from the archive:
image

dpkg does not resolve dependencies, instead use apt install with the path to the package(s), if they are in the current directory you can use ./ for the path. apt install will resolve any dependencies.

Following this topic the command below would install 4.0 over 3.6.

sudo apt install ./mongodb-org-server_4.0.28_amd64.deb ./mongodb-org-shell_4.0.28_amd64.deb ./mongodb-org-tools_4.0.28_amd64.deb 

At the recommended point in the upgrade guide to restart MongoDB:

systemctl restart mongod

Otherwise follow the upgrade procedures as there are a few compatibility changes, removal of MONGODB-CR ,Replica SetProtocol Version 0 and Master-Slave replication. As well as deprecation of MMAPv1 databases.

Hi Chris,

Thank you for this worked fine, on my virtual machine. Just some questions before trying this out on our live version of mongo. If I follow steps on the upgrade procedure we would retain all our data right?

Also, Could it be that the EOL for mongo 4.4 for Ubuntu 20.04 are causing the NO_PUBKEY error?

Thank you,
Jeric

The data is not modified during the upgrade. That said it is always prudent to ensure a recent backup has completed successfully as a fallback.

No, if a repo was implicitly trusted it may show that Warning/Error. The gpg keys for the 4.2 and 4.4 are still valid.