Skip to content

Skip custom mirror config when keyring sync fails#4577

Open
Softer wants to merge 3 commits into
archlinux:masterfrom
Softer:fix-keyring-sync-check
Open

Skip custom mirror config when keyring sync fails#4577
Softer wants to merge 3 commits into
archlinux:masterfrom
Softer:fix-keyring-sync-check

Conversation

@Softer
Copy link
Copy Markdown
Contributor

@Softer Softer commented Jun 6, 2026

Related to #4565

I couldn't reproduce the exact crash, but there is a clear gap in the code: _verify_service_stop() waits for archlinux-keyring-wkd-sync.service to reach a terminal state but never checks whether it succeeded or failed. If it failed, set_mirrors() triggers mirror speed sorting (downloading core.db from each mirror), followed by pacman -Syy which can crash with "GPGME error: No data" due to uninitialized keyring.

This change checks the service exit state after waiting. If it failed, custom mirror configuration is skipped and installation continues with default mirrors (from reflector or ISO).

What changed:

  • installer.py: track _keyring_synced flag, set to False when wkd-sync service state is failed
  • guided.py: check installation.keyring_synced before calling set_mirrors()

Softer added 2 commits June 3, 2026 16:19
Check the exit state of archlinux-keyring-wkd-sync.service after
waiting for it to finish. If it failed, skip set_mirrors() and
continue installation with default mirrors instead of crashing
with "GPGME error: No data" during pacman -Syy.
@Softer Softer requested a review from Torxed as a code owner June 6, 2026 11:07
@h8d13
Copy link
Copy Markdown
Contributor

h8d13 commented Jun 6, 2026

My thought is that perhaps there should be a fall-back path that uses steps in comment

And I don't think how you handled it in code will help actual state tracking of the service:

  • Rather you'd want to use stderr of the pacman -Syy command itself IMO

Instead of skipping mirror configuration when wkd-sync fails, catch
the GPGME error at the point where it actually occurs - during
pacman -Syy. If the sync fails with a keyring-related error, reinit
the keyring with pacman-key --init/--populate and retry the sync.
@Softer
Copy link
Copy Markdown
Contributor Author

Softer commented Jun 6, 2026

Good point, thanks for linking #2213. You're right that checking the service state alone isn't enough - the keyring can be broken even when wkd-sync reports success (e.g. network wasn't ready when it ran).

Updated the approach: instead of skipping mirrors, we now catch the error where it actually happens - in pacman -Syy. If the sync fails with a GPGME/keyring error, we automatically reinit the keyring (killall gpg-agent, pacman-key --init, pacman-key --populate archlinux) and retry the sync. The wkd-sync state check stays as an early warning in the log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants