Keys cannot be refreshed

Since one month ago I’m trying to refresh keys with: sudo pacman-key --refresh-keys but I got error messages. This worked fine before. These are the last lines from console:

gpg: error retrieving 'email@alex19ep.me' via WKD: No data
gpg: error reading key: No data
gpg: key DAD6F3056C897266: "Alexander Epaneshnikov <email@alex19ep.me>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
pub   rsa4096 2020-03-04 [SC] [expires: 2022-01-20]
      6C7F7F22E0152A6FD5728592DAD6F3056C897266
uid           [ unknown] Alexander Epaneshnikov <email@alex19ep.me>
uid           [  full  ] Alexander Epaneshnikov <alex19ep@archlinux.org>
uid           [ unknown] Alexander Epaneshnikov <aarnaarn2@gmail.com>
uid           [ unknown] Alexander Epaneshnikov (second email) <alex19EP@yandex.ru>
sub   rsa4096 2020-03-04 [A] [expires: 2022-01-20]
sub   rsa4096 2020-03-04 [E] [expires: 2022-01-20]
sub   rsa4096 2020-03-04 [S] [expires: 2022-01-20]

gpg: error retrieving 'simon.bueeler@manjaro.org' via WKD: No data
gpg: error reading key: No data
gpg: refreshing 1 key from hkps://keyserver.ubuntu.com
gpg: key C0D1CCE50CC38123: "Simon Büeler <simon.bueeler@manjaro.org>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

I don’t know what’s wrong.

P.S.: Info

OS: Manjaro Linux x86_64
Kernel: 5.15.2-2-MANJARO
Shell: zsh 5.8 

Maybe this?

https://wiki.manjaro.org/index.php/Pacman_troubleshooting#Errors_about_Keys

You shouldn’t update the keys like this and stay on the ones provided from the repos (archlinux-keyring and manjaro-keyring)

So dear @mithrial , is @cscs 's reference not applicable? why?

I dont think they were correcting my post, and if they were … well they would be wrong.
( no spite @mithrial :smile_cat: )

No, it’s fine. From my experience, the keys on the keyservers sometimes differ from the ones in the repo.

A few weeks or months ago, we had the problem that a maintainer left maintaining Manjaro and withdrew his key from the keyservers. This resulted in invalid signatures for a few packages.

The link is valid until step 5, refreshing the keys.

Somewhat fair … but we wont know without OP attempting the normal procedures and producing any resulting errors. Maybe the original post was intended to point to having done all steps and this was the result … but we do not know, and considering their responses … I also find it unlikely.

I run commands from @cscs 's reference. This is the output:

$ sudo rm -r /etc/pacman.d/gnupg 

$ sudo pacman -Sy gnupg archlinux-keyring manjaro-keyring
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community                                                                                              6.7 MiB  8.06 MiB/s 00:01 [###############################################################################] 100%
 multilib is up to date
warning: gnupg-2.2.32-1 is up to date -- reinstalling
warning: archlinux-keyring-20211028-1 is up to date -- reinstalling
warning: manjaro-keyring-20210910-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (3) archlinux-keyring-20211028-1  gnupg-2.2.32-1  manjaro-keyring-20210910-2

Total Installed Size:  11.49 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n] 
(3/3) checking keys in keyring                                                                                                    [###############################################################################] 100%
warning: Public keyring not found; have you run 'pacman-key --init'?
downloading required keys...
error: keyring is not writable
error: keyring is not writable
error: keyring is not writable
error: required key missing from keyring
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.

$ sudo pacman-key --init
gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
gpg: no ultimately trusted keys found
gpg: starting migration from earlier GnuPG versions
gpg: porting secret keys from '/etc/pacman.d/gnupg/secring.gpg' to gpg-agent
gpg: migration succeeded
==> Generating pacman master key. This may take some time.
gpg: Generating pacman keyring master key...
gpg: key 1A6210268A9F2413 marked as ultimately trusted
gpg: directory '/etc/pacman.d/gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/etc/pacman.d/gnupg/openpgp-revocs.d/DDF8F3F2930209C73B8EB1151A6210268A9F2413.rev'
gpg: Done
==> Updating trust database...
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u

$ sudo pacman -Sy gnupg archlinux-keyring manjaro-keyring
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
warning: gnupg-2.2.32-1 is up to date -- reinstalling
warning: archlinux-keyring-20211028-1 is up to date -- reinstalling
warning: manjaro-keyring-20210910-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (3) archlinux-keyring-20211028-1  gnupg-2.2.32-1  manjaro-keyring-20210910-2

Total Installed Size:  11.49 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n] 
(3/3) checking keys in keyring                                                                                                    [###############################################################################] 100%
downloading required keys...
:: Import PGP key FC1B547C8D8172C8, "Levente Polyak <anthraxx@archlinux.org>"? [Y/n] 
:: Import PGP key 6D42BDD116E0068F, "Christian Hesse <arch@eworm.de>"? [Y/n] 
:: Import PGP key DAD3B211663CA268, "Bernhard Landauer <oberon@manjaro.org>"? [Y/n] 
(3/3) checking package integrity                                                                                                  [###############################################################################] 100%
error: gnupg: signature from "Levente Polyak <anthraxx@archlinux.org>" is unknown trust
:: File /var/cache/pacman/pkg/gnupg-2.2.32-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] 
error: archlinux-keyring: signature from "Christian Hesse (Arch Linux Package Signing) <arch@eworm.de>" is unknown trust
:: File /var/cache/pacman/pkg/archlinux-keyring-20211028-1-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] 
error: manjaro-keyring: signature from "Bernhard Landauer <bernhard@manjaro.org>" is unknown trust
:: File /var/cache/pacman/pkg/manjaro-keyring-20210910-2-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] 
error: failed to commit transaction (invalid or corrupted package (PGP signature))
Errors occurred, no packages were upgraded.

So I’m getting other errors, the sequence for steps was: 1,2,3,2… error

Now, I cannot update my OS:

$ sudo pacman -Syu
:: Synchronizing package databases...
error: failed to synchronize all databases (no servers configured for repository)

I had to run:

$ sudo pacman-mirrors --fasttrack && sudo pacman-key --refresh-keys && sudo pacman -Syyu

And my OS is working again. @mithrial was right?

It appears not … as they were claiming the guide was incorrect for including refresh-keys … which you executed with success.