(Resolved) Key is stored in legacy trusted.gpg Keyring

Channel: Linux
Abstract: the Debian developers have updated the policy of using GPG keys. The Ubuntu 22.04 and Debian 11 prompted to manage OpenPGP as keyring files instead. T

To enhance the security of your system, the Debian developers have updated the policy of using GPG keys. The Ubuntu 22.04 and Debian 11 prompted to manage OpenPGP as keyring files instead.

  1. The first step is to find out the key id. You can list all the existing keys under trusted.gpg with the following command.
    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 2011-10-13 [SC]
          B97B 0AFC AA1A 47F0 44F2  44A0 7FCC 7D46 ACCC 4CF8
    uid           [ unknown] PostgreSQL Debian Repository
    
  2. I need to fix issue for the PostgreSQL repository. So copy the last 8 characters of the key ID and export it with the following command.
    sudo apt-key export ACCC4CF8 | sudo gpg --dearmour -o /usr/share/keyrings/pgdg.gpg 
    
  3. Now edit the Apt repository configuration file like: /etc/apt/sources.list.d/pgdg.list. Add the singed-by tag with the above exported key file, like:
    deb [arch=amd64 signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main
    
  4. Now you can delete the key from trusted.gpg:
    sudo apt-key del ACCC4CF8 
    

Hopefully, this quick how-to tutorial helps you to resolve your issues. You can also follow the same instructions to resolve similar issues in other repositories.

Ref From: tecadmin

Related articles