Please disable your ad blocker.

The only ads on this site are discreet (sidebar on desktop, below the content on mobile).
They do not interfere with reading and may even offer you benefits (discounts, free months…).

Fix GPG key error when adding a PPA with apt-key

Since Ubuntu 22.04 and derivative distributions such as Linux Mint 21, adding a PPA using the command sudo add-apt-repository ppa:lutris-team/lutris triggers the following error: Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). during each sudo apt update.

Here are two methods to fix the problem:

Method for EACH problematic PPA

For this example, I will use the Lutris PPA.

  1. Open the terminal
  2. List the GPG keys:
    sudo apt-key list
    Which gives, for Lutris:
    pub rsa4096 2019-03-23 [SC]
    82D9 6E43 0A1F 1C0F 0502  747E 37B9 0EDD 4E3E FAE4
    uid [ unknown] Launchpad PPA for lutris
  3. Export the GPG key (using only the last 8 characters of the ID):
    sudo apt-key export 4E3EFAE4 | sudo gpg --dearmour -o ~/Desktop/lutris-keyring.gpg
  4. Remove all keys related to the Lutris PPA to avoid duplicates:
    sudo apt-key del 4E3EFAE4
  5. Copy the file ~/Desktop/lutris-keyring.gpg to the correct location:
    sudo cp ~/Desktop/lutris-keyring.gpg /etc/apt/trusted.gpg.d
  6. sudo apt update should no longer display any errors.

Global method (to do once)

  1. Open the terminal and type the following:
    cd /etc/apt
        sudo cp trusted.gpg trusted.gpg.d
        sudo apt update
  2. The issue is fixed 😊