Must re-init pacman-key after every boot

Hello,
Since a couple of weeks i must reinit pacman-key (pacman-key --init and --populate) after every reboot to make update work.
After that it work fine both yay and pacman, but this is inconvenient, i think what is missing - in profile maybe?
I set my keepass as ssh key agent
agent export SSH_AUTH_SOCK=‘/run/user/1000/keeagent.socket’

maybe this is a problem?

BR,
Greg

Without knowing what the cause is - there is no way to provide a meaningful comment.

But it does sound like you are loosing the folder /etc/pacman.d/gnupg or the content inside

If your system looks similar to this sample listing and you suspect your keepass agent to be the culprit - first step would be to remove the assignment - then figure out what to do instead.

 $ ls -l /etc/pacman.d
total 8
drwxr-xr-x 5 root root 4096 13 feb 18:26 gnupg
-rw-r--r-- 1 root root  348 13 feb 14:51 mirrorlist

 $ ls -l /etc/pacman.d/gnupg/
total 2872
drwx------ 2 root root    4096 12 aug  2024 crls.d
-rw-r--r-- 1 root root      17  7 aug  2024 gpg-agent.conf
-rw-r--r-- 1 root root     130  7 aug  2024 gpg.conf
drwx------ 2 root root    4096  7 aug  2024 openpgp-revocs.d
drwx------ 2 root root    4096  7 aug  2024 private-keys-v1.d
-rw-r--r-- 1 root root 1423350 24 jan 08:37 pubring.gpg
-rw-r--r-- 1 root root 1423350 24 jan 08:37 pubring.gpg~
srw------- 1 root root       0 13 feb 18:26 S.dirmngr
-rw------- 1 root root       0  7 aug  2024 secring.gpg
srw------- 1 root root       0 13 feb 18:26 S.gpg-agent
srw------- 1 root root       0 13 feb 18:26 S.gpg-agent.browser
srw------- 1 root root       0 13 feb 18:26 S.gpg-agent.extra
srw------- 1 root root       0 13 feb 18:26 S.gpg-agent.ssh
srw------- 1 root root       0 13 feb 18:26 S.keyboxd
-rw-r--r-- 1 root root   49152  4 dec 13:52 tofu.db
-rw-r--r-- 1 root root   18480 24 jan 08:37 trustdb.gpg

KeepassXC should not interfere with pacman. Pacman is running as root, while KeepassXC is running for your user.
Also, pacman does not use ssh keys. It has it’s own pgp key store.

How do you know that something is broken?

Thanks for advise, i willecheck it without Keepass, but I doubt it.
You to bet on gpg.
I think my gpg folders looks fine

ls -l /etc/pacman.d
razem 8
drwxr-xr-x 5 root root 400 02-14 09:28 gnupg
-rw-r--r-- 1 root root 386 02-13 10:00 mirrorlist
-rw-r--r-- 1 root root 314 01-03 19:22 pacredir

Where i see diference, on your system DB is with .pdg extension,
on my in kbx (machine use kerberos)

ls -l /etc/pacman.d/gnupg/
razem 2924
drwx------ 2 root root      60 02-14 08:44 crls.d
-rw-r--r-- 1 root root      17 02-14 07:40 gpg-agent.conf
-rw-r--r-- 1 root root     167 02-14 08:40 gpg.conf
drwx------ 2 root root      60 02-14 07:40 openpgp-revocs.d
drwx------ 2 root root      60 02-14 07:40 private-keys-v1.d
-rw-r--r-- 1 root root       0 02-14 07:40 pubring.gpg
-rw-r--r-- 1 root root 1458168 02-14 07:40 pubring.kbx
-rw-r--r-- 1 root root 1457587 02-14 07:40 pubring.kbx~
srw------- 1 root root       0 02-14 07:09 S.dirmngr
-rw------- 1 root root       0 02-14 07:40 secring.gpg
srw------- 1 root root       0 02-14 07:09 S.gpg-agent
srw------- 1 root root       0 02-14 07:09 S.gpg-agent.browser
srw------- 1 root root       0 02-14 07:09 S.gpg-agent.extra
srw------- 1 root root       0 02-14 07:09 S.gpg-agent.ssh
srw------- 1 root root       0 02-14 07:09 S.keyboxd
-rw-r--r-- 1 root root   49152 02-14 07:40 tofu.db
-rw-r--r-- 1 root root   18160 02-14 07:40 trustdb.gpg

maybe its problem?

I presume it’s broken because not working properly (or not like before).
Every time when i after system rebot try to update/install something i see key error and must set pacman-key command first.
After that installation be fine.
And on my home system where i have Arch it’s work.
It’s work fine before.

Yes, my keepas is only gues (i use keepass not keepassXC).
BR.

Again, what doesn’t happen? And actually what does happen? Please post terminal output.

pacman gpg keyring is intended to be private to pacman - just like any other keyring is private to the user - in this case your keepass installation is hijacking the pacman keyring - and this is a configuration issue.

As you state your Arch install work - then please recheck your configuration on your Manjaro system.

Massage is moustly in polish,
keyring not found, keys is not writable etc.

:: Kontynuować instalację? [T/n] 
(166/166) sprawdzanie kluczy w bazie                         [################################] 100%
ostrzeżenie: Publiczny zestaw kluczy nie został odnaleziony; czy uruchomiłeś 'pacman-key --init'?
pobieranie potrzebnych kluczy…
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  zestaw kluczy jest niezapisywalny
błąd:  brak wymaganego klucza w pęku kluczy
błąd:  nie udało się dokonać transakcji (niespodziewany błąd)
Wystąpiły błędy, nie zaktualizowano żadnego pakietu.
 -> error installing repo packages
error installing repo packages

gpg list keys normaly:

gpg2 --list-keys
/home/maggreg/.gnupg/pubring.kbx
--------------------------------
pub   rsa4096 2009-07-28 [SC]
      AC0A4FF12611B6FCCF01C111393587D97D86500B
uid    [    nieznane   ] Colin Watson <cjwatson@chiark.greenend.org.uk>
uid    [    nieznane   ] Colin Watson <cjwatson@canonical.com>
uid    [    nieznane   ] Colin Watson <cjwatson@ubuntu.com>
uid    [    nieznane   ] Colin Watson <cjwatson@debian.org>
sub   rsa4096 2009-07-28 [E]

pub   rsa4096 2011-10-18 [SC]
      CD0A6E3CBB6768800B0736A8E7677380F54FD8A9
uid    [    nieznane   ] Ian Kent <raven@themaw.net>
uid    [    nieznane   ] Ian Kent <ikent@redhat.com>
sub   rsa4096 2011-10-18 [E]

pub   rsa2048 2013-09-17 [SC]
      A523530DD1E9FDDFAD3D5FCAA9B57A926EF302F5
uid    [    nieznane   ] Darren Salt <dsalt@unvanquished.net>
uid    [    nieznane   ] Darren Salt <ds@zap.tartarus.org>
uid    [    nieznane   ] Darren Salt <justanotherdsalt@googlemail.com>
uid    [    nieznane   ] Darren Salt <listspam@moreofthesa.me.uk>
uid    [    nieznane   ] Darren Salt <linux@moreofthesa.me.uk>
uid    [    nieznane   ] Darren Salt <devspam@moreofthesa.me.uk>
uid    [    nieznane   ] Darren Salt <ds@moreofthesa.me.uk>
sub   rsa2048 2013-09-17 [E]

pub   rsa2048 2014-12-28 [SC]
      0ED9020DA90D3F6E70BD3945D9625E5D7AD0177E
uid    [    nieznane   ] Joachim Metz <joachim.metz@gmail.com>
sub   rsa2048 2014-12-28 [E]

pub   rsa4096 2013-02-04 [SC]
      BD84DE71F493DF6814B0167254EDC91609BC9183
      Revocable by: DD12A30E507068C7B405C18ED51C8A5363B4835B
uid    [    nieznane   ] Christian Hesse <Christi@n-Hes.se>
uid    [    nieznane   ] Christian Hesse <mail@eworm.de>
sub   rsa4096 2013-02-04 [E]
sub   cv25519 2022-01-12 [E]
sub   ed25519 2022-01-12 [S]

pub   rsa2048 2014-01-10 [SC] [wygasa: 2025-04-29]
      20EE325B86A81BCBD3E56798F04367096FBA95E8
uid    [    nieznane   ] Dain Nilsson <dain@yubico.com>
sub   rsa2048 2014-01-10 [A] [wygasa: 2025-04-29]
sub   rsa2048 2014-01-10 [E] [wygasa: 2025-04-29]

and folder not contains pubring db

ls -l /etc/pacman.d/gnupg/
razem 8
-rw------- 1 root root   32 02-17 06:50 pubring.kbx
srw------- 1 root root    0 02-17 06:48 S.dirmngr
srw------- 1 root root    0 02-17 06:48 S.gpg-agent
srw------- 1 root root    0 02-17 06:48 S.gpg-agent.browser
srw------- 1 root root    0 02-17 06:48 S.gpg-agent.extra
srw------- 1 root root    0 02-17 06:48 S.gpg-agent.ssh
srw------- 1 root root    0 02-17 06:48 S.keyboxd
-rw------- 1 root root 1200 02-17 06:50 trustdb.gpg

but in user folder:

ls -l ~/.gnupg/
razem 56
drwx------ 1 u u    14 2023-01-27  crls.d
drwx------ 1 u u    0 2023-01-27  private-keys-v1.d
-rw-r--r-- 1 u u 26796 02-04 07:26 pubring.kbx
-rw-r--r-- 1 u u 20921 01-28 14:53 pubring.kbx~
-rw------- 1 u u 1200 2023-01-27  trustdb.gpg

and after init and populate

sudo pacman-key --init ; sudo pacman-key --populate 
gpg: starting migration from earlier GnuPG versions
gpg: porting secret keys from '/etc/pacman.d/gnupg/secring.gpg' to gpg-agent
gpg: migration succeeded
==> Generowanie klucza głównego pacmana. To może zająć trochę czasu.
gpg: Generating pacman keyring master key...
gpg: katalog „/etc/pacman.d/gnupg/openpgp-revocs.d” utworzony
gpg: certyfikat unieważnienia został zapisany jako „/etc/pacman.d/gnupg/openpgp-revocs.d/77F93F16669C857014E18944C441A7F31F4AD6CD.rev”
gpg: Done
==> Aktualizacja zaufanej bazy danych...
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: poziom: 0 poprawnych:   1 podpisanych:   0 zaufanie: 0-,0q,0n,0m,0f,1u
[1]+  Kod wyjścia 1          sudo pacman --init
==> Dodawanie kluczy z arch4edu.gpg...
==> Dodawanie kluczy z archlinux.gpg...
==> Dodawanie kluczy z manjaro.gpg...
==> Lokalne podpisywanie zaufanych kluczy w bazie...
  -> Locally signed 24 keys.
==> Importowanie zaufanych wartości właściciela...
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: inserting ownertrust of 4
gpg: setting ownertrust to 4
gpg: inserting ownertrust of 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: inserting ownertrust of 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: inserting ownertrust of 4
==> Wyłączanie unieważnionych kluczy w bazie...
  -> Disabled 53 keys.
==> Aktualizacja zaufanej bazy danych...
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: poziom: 0 poprawnych:   1 podpisanych:  21 zaufanie: 0-,0q,0n,0m,0f,1u
gpg: poziom: 1 poprawnych:  21 podpisanych: 101 zaufanie: 0-,0q,0n,21m,0f,0u
gpg: Uwaga: podpisy kluczami osób trzecich wykorzystujące algorytm SHA1 są odrzucane
gpg: (opcją „--allow-weak-key-signatures” można to obejść)
gpg: poziom: 2 poprawnych:  78 podpisanych:  21 zaufanie: 78-,0q,0n,0m,0f,0u
gpg: następne sprawdzanie bazy odbędzie się 2025-06-16

we see

ls -l /etc/pacman.d/gnupg/
razem 2924
-rw-r--r-- 1 root root      17 02-17 07:03 gpg-agent.conf
-rw-r--r-- 1 root root     130 02-17 07:03 gpg.conf
drwx------ 2 root root      60 02-17 07:03 openpgp-revocs.d
drwx------ 2 root root      60 02-17 07:03 private-keys-v1.d
-rw-r--r-- 1 root root       0 02-17 07:03 pubring.gpg
-rw-r--r-- 1 root root 1458168 02-17 07:03 pubring.kbx
-rw-r--r-- 1 root root 1457587 02-17 07:03 pubring.kbx~
srw------- 1 root root       0 02-17 06:48 S.dirmngr
-rw------- 1 root root       0 02-17 07:03 secring.gpg
srw------- 1 root root       0 02-17 06:48 S.gpg-agent
srw------- 1 root root       0 02-17 06:48 S.gpg-agent.browser
srw------- 1 root root       0 02-17 06:48 S.gpg-agent.extra
srw------- 1 root root       0 02-17 06:48 S.gpg-agent.ssh
srw------- 1 root root       0 02-17 06:48 S.keyboxd
-rw-r--r-- 1 root root   49152 02-17 07:03 tofu.db
-rw-r--r-- 1 root root   18160 02-17 07:03 trustdb.gpg

and pacman (yay) work fine till next reboot:

Edit,
I solved it, for some reason something disabled the pacman init service on my system.
After the command:

sudo systemctl enable --now pacman-init.service

everything came back to normal.
Thanks for the advice.

BR,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.