Note
In “earlier” days you could easily add missing GPG keys with a command like:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D68FA50FEA312927
BUT most modern distributions will tell you
apt-key is deprecated. manage keyring files in trusted.gpg.d instead
So you should stop using it and use gpg directly ,
-
you might export the old keys by issuing
apt-key list
and then using the last 8 characters like thissudo apt-key export 3A798D29 | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/mysql-key.gpg
-
For external GPG Pubkeys ( new repos e.g. ) from now on add them like this :
KEYRING=/usr/share/keyrings/yourpackagename.gpg curl -fsSL https://server.lan/key-path-to-download | gpg --dearmor | sudo tee "$KEYRING" >/dev/null
Error indicators
Obviously apt/apt-get update will output
apt-get update fails with Unknown error executing apt-key
,
Errors you might face when trying to manually run apt-key
look like:
/usr/bin/apt-key: 710: touch: Too many levels of symbolic links
Solutions for failing apt-key
Hint: if your system or package registry is heavily damaged , you might manually search for the .deb
packages and install them
Solution 1: Coreutils reinstallation
If you see /usr/bin/touch
exists but not /bin/touch
,
Installing the latter using sudo apt-get install --reinstall coreutils
might help.
Solution 2: GPG reinstallation
Your GPG installation might be updated or outdated
sudo apt reinstall gpg
sudo ldconfig $(which /usr/bin/gpg)
References
info | resource |
---|---|
2022-04-28 @ stackoverflow.com → | gnupg - W: GPG error: Unknown error executing apt-key - Stack Overflow |
2022-03-17 @ unix.stackexchange.com → | linux - apt-get gpg error when i try to update - Unix & Linux Stack Exchange |
2021-11-15 @ unix.stackexchange.com → | apt key - I am suddenly getting " Unknown error executing apt-key" when attempting to update my system - Unix & Linux Stack Exchange |