How to fix  error "Key is stored in legacy trusted.gpg keyring"

Here we will learn how to solve the error "key is stored in legacy trusted.gpg keyring" on Ubuntu, not only for one package or application but for all cases, you need to follow the pattern while solving this issue.

For this case we will use the following error, this is for Slack package:

https://packagecloud.io/slacktechnologies/slack/debian/dists/jessie/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

As I mentioned above, this solution is not only for Slack, just follow the pattern and make adjustments for your package.



Use command below in the terminal:

apt-key list

You will get results depending what you have installed in your system, for Slack in results I have this:

pub   rsa4096 2016-02-18 [SCEA]
      DB08 5A08 CA13 B8AC B917  E0F6 D938 EC0D 0386 51BD
uid           [ unknown] https://packagecloud.io/slacktechnologies/slack (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>

Pay attention to last 8 digits and letters, you will need this in the command written below.

sudo apt-key export 038651BD | sudo gpg --dearmour -o /usr/share/keyrings/slack.gpg

This way we exported the key to the slack.gpg, one more step is done, let's move forward with next command, this way you will edit slack.list file:

sudo nano /etc/apt/sources.list.d/slack.list

Change line:

deb https://packagecloud.io/slacktechnologies/slack/debian/ jessie main


deb [arch=amd64 signed-by=/usr/share/keyrings/slack.gpg] https://packagecloud.io/slacktechnologies/slack/debian/ jessie main

If you don't know name of the file you need to edit, go to the directory /usr/share/keyrings/ and find name of the file. You can do this with command below:

cd /usr/share/keyrings/

ls -l

There will we listed file names, find name of your application, and edit this file.


That's it, you solved this issue. While updating repositories error will not show up again. Repeat the procedure for all applications where an error appears. 

Author: Aleksandar Vranešević
Published: 10-28-2023
Updated: 11-17-2023