Resetting all GPG keys, error?

I had some key issues, so I reset everything on my system as follows, which I hope is right, otherwise please correct me.

sudo rm -R /etc/pacman.d/gnupg/
sudo rm -R ~/.gnupg
sudo rm -R /root/.gnupg/
sudo gpg --refresh-keys
sudo pacman-key --init
sudo pacman-key --populate manjaro
sudo pacman-key --populate archlinux
sudo pacman-key --refresh-keys
sudo pacman -Syyu

However, if I execute gpg --homedir /etc/pacman.d/gnupg --list-keys, I get

gpg: WARNING: unsafe ownership on homedir '/etc/pacman.d/gnupg'
gpg: Note: trustdb not writable
/etc/pacman.d/gnupg/pubring.gpg

How can I solve that? And did I do everything right in principle so that in the end everything is consistent and clean?

you can try this:

  1. Remove all keys
    sudo rm -rf /etc/pacman.d/gnupg
    sudo rm -R /root/.gnupg/
  2. Reinitialize files & folders for keys
    sudo pacman-key --init
  3. Repopulate keys
    sudo pacman-key --populate archlinux manjaro
  4. Reinstall latest keyrings
    sudo pacman -Sy gnupg archlinux-keyring manjaro-keyring
  5. Refresh the signature keys
    sudo pacman-key --refresh-keys
  6. Clear out the software packages downloaded during aborted installations (optional):
    sudo pacman -Sc
  7. Finally, try updating your system to see if the errors were resolved.
    sudo pacman -Syyu
1 Like

The items 4. and 6. are new, thank you, but what about sudo rm -R ~/.gnupg and sudo gpg --refresh-keys? I guess these commands don’t contribute.

well this is how i have saved it, if i have keyring errors, these commands should fix your issue…

Unfortunately, I still get the warning. And what is the /root partition all about? I thought / is root.

That is the home directory for the root user, not the root directory.

1 Like

so you still have keyring issues - cant install/update… or the only issue is the … gpg: Note: trustdb not writable… ?

The issue is

gpg: WARNING: unsafe ownership on homedir '/etc/pacman.d/gnupg'
gpg: Note: trustdb not writable

It seems that I can install and update.

i tried running the command and get the same

gpg: WARNING: unsafe ownership on homedir '/etc/pacman.d/gnupg'
gpg: Note: trustdb not writable

so its probably how it should be

Thanks. This helped alot!

A year old thread?