Cannot update due to key errors

Hi,
I’m wondering if anyone could help.
When running sudo pacman -Syu I get a bunch of these errors:

:: Import PGP key 9D4C5AA15426DA0A, “Frederik Schwan freswa@archlinux.org”? [Y/n] y
error: key “9D4C5AA15426DA0A” could not be looked up remotely

and then the update fails.

I have tried running the following commands to solve the problem:

sudo pacman -Sy archlinux-keyring && pacman -Su

Returns error:

error: archlinux-keyring: signature from “Christian Hesse eworm@archlinux.org” is unknown trust
:: File /var/cache/pacman/pkg/archlinux-keyring-20230130-1-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] y
error: failed to commit transaction (invalid or corrupted package (PGP signature))
Errors occurred, no packages were upgraded.

Also tried with:

sudo pacman-key --refresh-keys

Which generates to many errors to paste all here but here is a sample:

gpg: [don’t know]: invalid packet (ctb=00)
gpg: keyring_get_keyblock: read error: Invalid packet
gpg: keyring_get_keyblock failed: Invalid keyring
gpg: failed to rebuild keyring cache: Invalid keyring
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keyring_get_keyblock: read error: Invalid packet
gpg: keydb_get_keyblock failed: Invalid keyring
gpg: validate_key_list failed
gpg: error retrieving ‘farseerfc@archlinuxcn.org’ via WKD: No data
gpg: error reading key: No data
gpg: checking the trustdb
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet

Does anyone have any idea what could be wrong? I have edited my mirrorlist to activate more mirrors, this didn’t help either.

Any help would be greatly appreciated!

1 Like

Have a look at:

3 Likes

You could check this: Archlinux-keyring "invalid or corrupted"

Besides that you could try and erase the cached file: /var/cache/pacman/pkg/archlinux-keyring-20230130-1-any.pkg.tar.zst

In order to get it downloaded again.

2 Likes

I have deleted the keyring file in the pacman cache, it didn’t help unfortunately.

sudo pacman -Sy archlinux-keyring endeavouros-keyring && sudo pacman -Syu

is very similar to what I have already tried but doesn’t help, produces error:

error: target not found: endeavouros-keyring

In the thread that was linked it was suggested to run the following commands:

sudo pacman-key --recv-keys 497AF50C92AD2384C56E1ACA003DB8B0CB23504F

resulting in:

ERROR: Remote key not fetched correctly from keyserver.

And/Or:

sudo pacman-key --lsign-key 497AF50C92AD2384C56E1ACA003DB8B0CB23504F

which yields the following errors:

gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keyring_get_keyblock: read error: Invalid packet
gpg: keyring_get_keyblock failed: Invalid keyring
gpg: failed to rebuild keyring cache: Invalid keyring
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keyring_get_keyblock: read error: Invalid packet
gpg: keydb_get_keyblock failed: Invalid keyring
gpg: validate_key_list failed
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keyring_get_keyblock: read error: Invalid packet
gpg: keydb_get_keyblock failed: Invalid keyring
==> ERROR: 497AF50C92AD2384C56E1ACA003DB8B0CB23504F could not be locally signed.

You need to try to get the pkg out of cache. Try deleting it when it fails the update. Then update the mirrors again and try. If you update the mirrors maybe you need to change your mirrors. Not sure what you are using? What country you are in?

Running:

sudo rm /var/cache/pacman/pkg/archlinux-keyring-20230130-1-any.pkg.tar.zst

Generates the following error:

rm: cannot remove ‘/var/cache/pacman/pkg/archlinux-keyring-20230130-1-any.pkg.tar.zst’: No such file or directory

I have checked multiple times that the file is not present.

I have tried to uncomment every mirror in the mirrorlist file and running sudo pacman -Syu, that didn’t help either.

Okay… but then you need to download the package. If the mirrors aren’t fetching the right packager or is fetching the same package is because the mirror isn’t synced and or it can’t download it. Hence why i say change your mirror locations and update them. Pick mirrors such as US or Germany etc. that are different from what you have and update them.

Thank you for your help, I apologize if I’m missing something. Is there a command I should run? I have uncommented every German and US server in /etc/pacman.d/mirrorlist file.

After that I try to update (sudo pacman -Syu) and get the following errors:

:: Proceed with installation? [Y/n] y
(184/184) checking keys in keyring [##########################################################################################################] 100%
downloading required keys…
:: Import PGP key 9D4C5AA15426DA0A, “Frederik Schwan freswa@archlinux.org”? [Y/n] y
error: key “9D4C5AA15426DA0A” could not be looked up remotely
:: Import PGP key C06086337C50773E, “Jelle van der Waa jelle@archlinux.org”? [Y/n] y
error: key “C06086337C50773E” could not be looked up remotely
:: Import PGP key 771DF6627EDF681F, “Tobias Powalowski tpowa@archlinux.org”? [Y/n] y
error: key “771DF6627EDF681F” could not be looked up remotely
:: Import PGP key 3B94A80E50A477C7, “Jan Alexander Steffens (heftig) heftig@archlinux.org”? [Y/n] y
error: key “3B94A80E50A477C7” could not be looked up remotely
:: Import PGP key 76A5EF9054449A5C, “Pierre Schmitz pierre@archlinux.org”? [Y/n] y
error: key “76A5EF9054449A5C” could not be looked up remotely
:: Import PGP key 139B09DA5BF0D338, “David Runge dvzrv@archlinux.org”? [Y/n] y
error: key “139B09DA5BF0D338” could not be looked up remotely
:: Import PGP key 51E8B148A9999C34, “Evangelos Foutras foutrelis@archlinux.org”? [Y/n] y
error: key “51E8B148A9999C34” could not be looked up remotely
:: Import PGP key E5BB298470AD4E41, “Sébastien Luttringer seblu@seblu.net”? [Y/n] y
error: key “E5BB298470AD4E41” could not be looked up remotely
:: Import PGP key 39E4B877E62EB915, “Sven-Hendrik Haase svenstaro@gmail.com”? [Y/n] y
error: key “39E4B877E62EB915” could not be looked up remotely
:: Import PGP key 786C63F330D7CB92, “Felix Yan felixonmars@archlinux.org”? [Y/n] y
error: key “786C63F330D7CB92” could not be looked up remotely
:: Import PGP key 9C02FF419FECBE16, “Morten Linderud foxboron@archlinux.org”? [Y/n] y
error: key “9C02FF419FECBE16” could not be looked up remotely
:: Import PGP key 0F65C7D881506130, “Maxime Gauduin alucryd@archlinux.org”? [Y/n] y
error: key “0F65C7D881506130” could not be looked up remotely
:: Import PGP key 66E60E5F785A6824, “Campbell Jones serebit@archlinux.org”? [Y/n] y
error: key “66E60E5F785A6824” could not be looked up remotely
:: Import PGP key 11675C743429DDEF, “Massimiliano Torromeo mtorromeo@archlinux.org”? [Y/n] y
error: key “11675C743429DDEF” could not be looked up remotely
error: required key missing from keyring
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.

Have you tried this first.

sudo pacman-key --populate archlinux endeavouros
sudo pacman-key --refresh-keys

Running:

sudo pacman-key --populate archlinux endeavouros

Generates an extreme amount of rows like this, I don’t think I can copy them all, here are the last ones:

gpg: keyring_get_keyblock: read error: Invalid packet
gpg: keyring_get_keyblock failed: Invalid keyring
gpg: failed to rebuild keyring cache: Invalid keyring
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keyring_get_keyblock: read error: Invalid packet
gpg: keydb_get_keyblock failed: Invalid keyring
gpg: validate_key_list failed
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keyring_get_keyblock: read error: Invalid packet
gpg: keyring_get_keyblock failed: Invalid keyring
gpg: failed to rebuild keyring cache: Invalid keyring
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keyring_get_keyblock: read error: Invalid packet
gpg: keydb_get_keyblock failed: Invalid keyring
gpg: validate_key_list failed
gpg: [don’t know]: invalid packet (ctb=00)
gpg: keydb_search failed: Invalid packet
==> Locally signing trusted keys in keyring…
==> ERROR: E0D16589967E1FE68EF8693E7EED78C58A63A62E could not be locally signed.
==> ERROR: 75BD80E4D834509F6E740257B1B73B02CC52A02A could not be locally signed.
==> ERROR: 2AC0A42EFB0B5CBC7A0402ED4DC95B6D7BE9892E could not be locally signed.
==> ERROR: 0F20FADC599D1C46EB556455AED8858E4B9813F1 could not be locally signed.
==> ERROR: 69E6471E3AE065297529832E6BA0F5A2037F4F41 could not be locally signed.
==> ERROR: 286E73D3CB90A2368DE1B0B12B37DD3DB00531E8 could not be locally signed.
==> ERROR: 8F43FC374CD4CEEA19CEE323E3D8752ACDF595A1 could not be locally signed.
==> ERROR: 8AD2DB862F3CA7B90B9CAF578B7B0A2203562CF6 could not be locally signed.
==> ERROR: C918B8CB65A96DFA48F1F2E6BC4423F58F260BAF could not be locally signed.

The second command also generates several pages of errors, most of them of the “Invalid packet” kind.

Try

sudo pacman-key --init
sudo pacman-key --populate

Yes, because as you posted earlier, you already deleted it.

Well, I assume you just copied the exact command from the other thread, but you need to replace the key from the thread with the one you have problems with.

So, judging by your initial post it should be

sudo pacman-key --recv-keys 9D4C5AA15426DA0A

And try the commands ricklinux postet