Recently I've noticed some issues when running apt
where the system will warn me of a keyring deprecation:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
8 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: https://packages.microsoft.com/repos/edge/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://download.sublimetext.com/apt/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
This doesn't stop me from performing the update, but I would much rather not see this when updating my system. How are we supposed to store trusted GPG keys going forward?
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:Open Terminal (if it's not already open)
List existing keys:
From here, we can export a key:
Note: The
BE1229CF
value comes from the last 8 characters of thepub
code.The following message will likely appear:
Now we can update our apt source file for the repository (e.g.,
/etc/apt/sources.list.d/microsoft.list
), adding asigned-by
tag:Update
apt
to confirm the message is gone:Remove the original signature:
This can be done with each of the warning messages. Once done,
apt
will no longer complain.try this
The easy way to fix these warning messages generated by
sudo apt update
...Note: These warning messages can be generated by any enabled repo or ppa in
Software & Updates
"Other Software" tab.Example fix:
For this warning message with
sudo apt update
...We look in
sudo apt-key list
and find this entry for xbmc...Then we convert this entry to a .gpg file, using the last 8 numeric characters from above...
Repeat the above commands for each warning message generated by
sudo apt update
.Note: Partially taken from the accepted answers here and here.
Considering all the good suggestions provided, I've crafted a helper oneliner to automate the process for all keys:
I solved it with some commands like below.
Solved, Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg) on metasploit install