You are on page 1of 2

4/25/22, 1:03 PM 21.

10 - apt-key deprecation warning when updating system - Ask Ubuntu

22

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:

0. Open Terminal (if it's not already open)


1. List existing keys:

$ sudo apt-key list

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-
key(8)).

/etc/apt/trusted.gpg

--------------------

pub rsa4096 2017-05-08 [SCEA]

1EDD E2CD FC02 5D17 F6DA 9EC0 ADAE 6AD2 8A8F 901A

uid [ unknown] Sublime HQ Pty Ltd <support@sublimetext.com>

sub rsa4096 2017-05-08 [S]

pub rsa2048 2015-10-28 [SC]

BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF

uid [ unknown] Microsoft (Release signing) <gpgsecurity@microsoft.com>

2. From here, we can export a key:

sudo apt-key export BE1229CF | sudo gpg --dearmour -o


/usr/share/keyrings/microsoft.gpg

Note: The BE1229CF value comes from the last 8 characters of the pub code.

The following message will likely appear:

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-
key(8)).

3. Now we can update our apt source file for the repository
(e.g., /etc/apt/sources.list.d/microsoft.list), adding a signed-by tag:

deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg]


https://packages.microsoft.com/repos/edge/ stable main

4. Update apt to confirm the message is gone:

sudo apt update

...

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

All packages are up-to-date.

W: https://download.sublimetext.com/apt/stable/InRelease: Key is stored in legacy


https://askubuntu.com/questions/1398344/apt-key-deprecation-warning-when-updating-system 1/2
4/25/22, 1:03 PM 21.10 - apt-key deprecation warning when updating system - Ask Ubuntu

trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8)


for details.

5. Remove the original signature:

sudo apt-key del BE1229CF

This can be done with each of the warning messages. Once done, apt will no longer complain.
ShareEditFollowFlag edited yesterday answered Mar 19 at 22:53
holocronweaver matigo
628 1 6 13 12.3k 3 26 52
1 Related Q&A: What commands (exactly) should replace the deprecated apt-key? – Artur Meinild Mar
20 at 13:36 

1 @ArturMeinild this is good to know 👍🏻 –  matigo  Mar 20 at 14:07


3 You should use  /usr/share/keyrings ,
not  /etc/apt/keyrings  - wiki.debian.org/DebianRepository/UseThirdParty – OrangeDog Mar 20 at
15:28

https://askubuntu.com/questions/1398344/apt-key-deprecation-warning-when-updating-system 2/2

You might also like