0

I added a new GPG key using this command:

curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
   --dearmor

The file is appearing in /usr/share/keyrings/mongodb-server-7.0.gpg but when I run sudo apt-key list, there is no entry for it, and it is giving an error while running apt update. How do I fix this?

muru
  • 197,895
  • 55
  • 485
  • 740
khateeb
  • 111
  • 1
    Since you have already downloaded the key, you need to follow the part starting from "At this point, nothing has changed and apt doesn't know the key exists" in https://askubuntu.com/a/1307181/158442 – muru Aug 17 '23 at 07:52
  • @muru, thanks that worked. Although my key is in /usr/share/keyrings/ and not /etc/apt/keyrings/. Will this not be a problem? – khateeb Aug 17 '23 at 08:07
  • 1
    It's not likely, but packages can install files in /usr/share, so your keyring might conflict if some package somehow adds a file with the exact same path, but again, not likely to happen. – muru Aug 17 '23 at 08:10

0 Answers0