Question

After Upgrade get warrning on sudo update

After update to Ubuntu 22.04 running apt update && apt upgrade will produce the following warning:

W: https://repos.insights.digitalocean.com/apt/do-agent/dists/main/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

what can i do


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @rant,

One way to resolve this is to export the GPG key from the deprecated keyring and store it in /usr/share/keyrings. Fortunately, it’s not too difficult.

List existing key

  1. sudo apt-key list

From here, you’ll see the error of the you’ve given and right after it the contents of the file /etc/apt/trusted.gpg.

You’ll need to export the key from there use the following syntax to convert it into a GPG key and save it under the Trusted.gpg.d folder:

  1. sudo apt-key export last-8-copied-digits| sudo gpg –dearmour -o /usr/share/keyrings/key-name.gpg

Where the last-8-copied-digits would be replaced by the last 8 digits of the pub key. Additionally, the /usr/share/keyrings/key-name.gpg file - key-name.gpg should be replaced with the name of the problematic key. Let’s say it was about MySQL. The file will be called mysql-key.gpg. In your case, it should be about Do-agent.

Now we can update our apt source file for the repository (e.g., https://repos.insights.digitalocean.com/apt/do-agent/dists/main/InRelease), adding a signed-by tag:

deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://repos.insights.digitalocean.com/apt/do-agent/dists/main/InRelease stable main

Hope that helps!