User Tools

Site Tools


linux:apt-key-error

apt errors

apt key error

When apt-get update shows the following error with only debian repositories:

W: There is no public key available for the following key IDs:

The simple fix is to install the debian-archive-keyring package and repeat the update process

apt-get install debian-archive-keyring
apt-get update

For google chrome repository and error:

W: There is no public key available for the following key IDs:
1397BC53640DB551

The fix is to:

wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

For other NO_PUBKEY errors, make a note of the ID, then use

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEY

For OpenSuse repositories it might be required to delete, redownload and reinsert the keys similar to the following examples:

sudo rm /usr/share/keyrings/obs-onedrive.gpg
sudo apt-key --keyring /etc/apt/trusted.gpg del 876D807E
wget -nv https://download.opensuse.org/repositories/home:npreining:/debian-ubuntu-onedrive/xUbuntu_22.04/Release.key -O Release.key
sudo apt-key add - < Release.key
sudo apt-key export 876D807E | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/onedrive.gpg
sudo apt-key --keyring /etc/apt/trusted.gpg del 876D807E
sudo vi /etc/apt/sources.list.d/onedrive.list 
sudo apt-get update


sudo apt-key --keyring /etc/apt/trusted.gpg del 4C70D8B5
wget -nv http://download.opensuse.org/repositories/graphics:/darktable/xUbuntu_22.04/Release.key -O Release.key
sudo apt-key add - < Release.key
sudo apt-key export 4C70D8B5 | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/onedrive.gpg
sudo apt-key --keyring /etc/apt/trusted.gpg del 4C70D8B5
sudo apt-get update

not configured yet

In case of dpkg dependency errors of a package that isn't configured yet, trigger configuration manually.
Example error:

 dpkg: dependency problems prevent processing triggers for libglib2.0-0:i386:
 libglib2.0-0:i386 depends on libc6 (>= 2.28); however:
  Package libc6:i386 is not configured yet.
sudo dpkg --configure -a 

apt-key deprecated

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

Find the repository causing the error. Note that the apt-key output does not contain the url but descriptions and it might be difficult to find the relevant entry.

sudo apt-key list | grep -B 2 -i something

Once the entry is found, use the last 2 blocks of 4 characters of the key id to export it and then create a separate gpg file fir it:

sudo apt-key export 12345678 | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/name-of-file.gpg

Finally, the old key id can be removed from the trusted.gpg file:

sudo apt-key --keyring /etc/apt/trusted.gpg del 12345678

see this for newer and secure method:
https://stackoverflow.com/questions/68992799/warning-apt-key-is-deprecated-manage-keyring-files-in-trusted-gpg-d-instead/71384057#71384057

apt fastest mirror

apt-get now supports a 'mirror' method that will automatically select a good mirror based on your location. Adding the following at the top of /etc/apt/sources.list file will pick the best mirror:

Follow this with:

vi /etc/apt/sources.list

Adjust for the appropriate ubuntu distribution.

deb mirror://mirrors.ubuntu.com/mirrors.txt focal main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt focal-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt focal-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt focal-security main restricted universe multiverse

Do an update for apt to get/select the best mirror before any installs:

apt-get update
linux/apt-key-error.txt · Last modified: 2024/08/19 10:35 by Wulf Rajek