简体   繁体   中英

W: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details

I have installed gazebo on my ubuntu 22.04 LTS following the steps in https://classic.gazebosim.org/tutorials?tut=install_ubuntu via their alternative installation. I am getting the following error when I try to update the packages using sudo apt update

W: http://packages.osrfoundation.org/gazebo/ubuntu-stable/dists/jammy/InRelease : Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

I have tried deleting the key from apt-key list but it gave me additional warning about unable to very the key, since the public key was missing. Is there a way for fixing this warning?

I have referred the a similar solution at Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead but couldn't solve the problem.

cd /etc/apt

Followed by:

sudo cp trusted.gpg trusted.gpg.d

Now run a sudo apt update The error shouldn't be showing again

You can convert your keys from the old apt-key tool to the new apt trusted keys format.

First, you should search for your key ID.

Try apt-key list gazebo , if only ones return, it will be easy. Simply run this command.

apt-key export gazebo | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/gazebo-key.gpg

and that warning will go away

Additionally, you can specify the key file in the source definition. But by default, apt will check all valid keys.

Check this site for an example

https://tecadmin.net/resolved-key-is-stored-in-legacy-trusted-gpg-keyring/

Recently, I have came across a blog post, which listed different methods to solve this issue in a more general approach. I have used the third one listed in here . The method is simple but a forceful one, but it worked for me. I would like to quote the words in the blog post

It is a forceful method because we are not converting keys but instead directly moving legacy keys to a trusted folder, , it may be not a wise idea still if you are not finding any other quick way for your Legacy key hen here is the one to use:

simple navigate to the key listing folder by using cd command and then use a cp command. you can use the code snippet given below(taken from the blog post).

cd /etc/apt
sudo cp trusted.gpg trusted.gpg.d

Other possible solutions are also listed in the same and you can check those too!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM