FS#42798 - [gnupg, pacman] Gnupg-2.1 does not work well with pacman-key
Attached to Project:
Arch Linux
Opened by Mateusz Paluszkiewicz (TheAifam5) - Saturday, 15 November 2014, 13:26 GMT
Last edited by Gaetan Bisson (vesath) - Tuesday, 26 June 2018, 00:07 GMT
Opened by Mateusz Paluszkiewicz (TheAifam5) - Saturday, 15 November 2014, 13:26 GMT
Last edited by Gaetan Bisson (vesath) - Tuesday, 26 June 2018, 00:07 GMT
|
Details
Steps to reproduce:
1. Enable Testing repository. 2. Update. 3. Try to add custom key eg: pacman-key -r 5EE46C4C Logs: gpg: connecting dirmngr at '/root/.gnupg/S.dirmngr' failed: IPC connect call failed gpg: keyserver receive failed: No dirmngr ==> ERROR: Remote key not fetched correctly from keyserver. |
This task depends upon
The pacman-key issue should be investigated but seems independent.
# gpg --homedir /etc/pacman.d/gnupg/ --no-permission-warning --recv-keys 941C2A25
gpg: connecting dirmngr at '/root/.gnupg/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr
It seems that if I do:
sudo -i dirmngr < /dev/null
This creates what is needed for pacman-key to find the IPC to dirmngr, and pacman-key works out of the box. Could you confirm this?
I'll reply to my mailing list post upstream to see if anyone has other ideas.
So it should probably be done on post_install as well as post_upgrade.
If it does, could you confirm that running dirmngr in post_install solves the issue you experience? Thanks.
Actually, after a bit more testing it seems that might not be needed after all, simply creating /root/.gnupg is enough to fix it. From what I can tell a simple `[[ -d /root/.gnupg ]] || mkdir /root/.gnupg` instead of calling dirmngr is enough to make things work as expected, but it should happen on post_install as well for new installs.
I should say however that I only tried on new installs with a keyring already to the new format (from host), or creating a new one (pacman-key --init), both of which requires simply the folder to be created, but not updating a system and converting the current keyring, as seems to be the original issue in this bug report. That might be a separate/different issue where dirmngr is still required to be called on post_upgrade (as I assume the folder would have then already existed?).
But I'm not sure if this should be addressed in arch-install-scripts though; Maybe ensuring that the folder exists could be added to pacman-key, so that it always works regardless of how it came to be called, since as Allan said above it is a wrapper around gpg, and this is working around a bug in gpg?
error: key "A6234074498E9CEE" could not be looked up remotely
error: required key missing from keyring
error: failed to commit transaction (unexpected error)
and that led me to the following bug report: https://bugs.archlinux.org/task/43759
and to the following thread: https://bbs.archlinux.org/viewtopic.php?id=193382
Digging a bit I found that, in order to comunicate with the keyserver, gpg inovkes dirmng but this is started as a daemon:
# ps -Af | grep dirmngr
root 12302 1 0 18:06 ? 00:00:00 dirmngr --daemon --homedir /etc/pacman.d/gnupg
The problem is that according to man pages, dirmngr ignores the --homedir option if --daemon is passed and it relies instead on the environment variable GNUPGHOME:
[root@530U3C daddona]# pacman-key --recv-keys A6234074498E9CEE
gpg: connecting dirmngr at '/root/.gnupg/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr
==> ERROR: Remote key not fetched correctly from keyserver.
[root@530U3C daddona]# GNUPGHOME=/etc/pacman.d/gnupg/ pacman-key --recv-keys A6234074498E9CEE
gpg: key 498E9CEE: "Christian Hesse (Arch Linux Package Signing) <arch@eworm.de>" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
==> Updating trust database...
gpg: next trustdb check due at 2016-01-22
$ pacaur -S aurman
...
==> Verifying source file signatures with gpg...
aurman_sources git repo ... FAILED (unknown public key 465022E743D71E39)
GnuPG is not broken, *your system is broken*.
Moreover, it is physically impossible for you to get the output you did, if the codepath you just linked to was actually run.
If you had posted the full output, we'd be able to see how the error message you refer to *is not there*.
Moreover, this bug is about pacman, not makepkg and not AUR helpers. Your makepkg/AUR helper woes are not on-topic for this bug report.
Comment by Jeremy (jeremyd) - Sunday, 18 March 2018, 08:53 GMT-4
Looks like dirmngr --daemon --homedir /etc/pacman.d/gnupg is working now. Can we change to using this? I selfishly need to run pacstrap inside a docker container and it isn't working with the /dev/null workaround currently in place in the gnupg.install. (dirmngr hangs using 100% cpu because /dev/null isn't a real device).
Then got *hijacked* by a moronic report yesterday. :)
If you're going to close it as WORKSFORME, please confirm it is for the real issue, not the hijack. :)
Everybody else: I will ignore all further comments that do not concern Jeremy's proposed fix or my reply to him. Please create new bug reports for anything else.
I haven't had a chance to reproduce again, because I just use the archlinux docker image now and like I said.. tracker broken took months. I'll close this out as .. no longer needed. Thanks!