i want to remove a repository but every time i get the error "Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8))." ive tried updating apt-key and apt-get just to be sure but didnt solve the problem. please help.

like this command $ sudo apt-key del 7D8D08F6 .


2 Answers 2


The answer is in the notice: Manage keyring files in trusted.gpg.d instead


cd /etc/apt/trusted.gpg.d/
rm {file}

where {file} needs to be replaced by the filename (7D8D08F6?) you want removed.

  • 1
    Could you please check? This information is probably outdated or misleading. I found this here. Moritz Bunkus (mkvtoolnix) also updated his repositories with these new instructions, he is usually quick and careful. Using signed-by= for each repo makes sense. Cloud-Init still uses apt-key though.
    – LiveWireBT
    Feb 28, 2021 at 21:25

You first need to find the keychain where the key with id 7D8D08F6 is stored:

for f in /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d/*.{asc,gpg}; do
  $(gpg --list-keys --keyid-format short --no-default-keyring --keyring $f | fgrep -iq 7D8D08F6) && echo "Key 7D8D08F6 in $f"

and then delete this keyring:

sudo rm /etc/apt/trusted.gpg.d/<KEYRING>.gpg
  • 1
    Important: User gpg with absolute paths as shown in the example. Otherwise keyrings would be searched in your ~/.gnupg directory.
    – Hrobky
    Feb 2, 2021 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.