Repository navigation
Description
Describe the bug
gh auth login (and gh auth status) hang indefinitely, with no output and no error, when the Secret Service provider is in a broken state. In my case there were two gnome-keyring-daemon instances on the session bus after the daemon crashed and was restarted.
Each attempt triggered a desktop keyring unlock prompt, which appeared twice. Then gnome-keyring-daemon crashed. gh never timed out or reported anything. When run from a terminal where the desktop prompt isn't visible, it just hangs, so the one-time device code and the URL are never shown.
After the crash, two daemons were running:
gnome-keyring-daemon --start --foreground --components=secrets, D-Bus-activated (indbus.service's cgroup)gnome-keyring-daemon --foreground --components=pkcs11,secrets --control-directory=..., the systemd user unitgnome-keyring-daemon.service
Killing the D-Bus-activated instance and running systemctl --user restart gnome-keyring-daemon.socket gnome-keyring-daemon.service fixed it immediately. After a single keyring unlock, gh auth login -w worked normally.
Steps to reproduce the behavior
The trigger is environmental and hard to reproduce on purpose:
- Have a GNOME session where
gnome-keyring-daemoncrashes and a second instance gets D-Bus-activated next to the systemd-managed one, so two Secret Service owners exist. - Have a stored token that is no longer valid (
gh auth statusreports "The token in default is invalid"). - Run
gh auth login -h github.com -p ssh -worgh auth status. ghblocks on the keyring call forever. No device code is printed, and there is no timeout or error.
Expected vs actual behavior
Expected: if the keyring / Secret Service call doesn't return within a reasonable time, gh fails with an actionable message. For example: "the system keyring did not respond; unlock it, or retry with --insecure-storage". For auth status, at least report that the keyring is unresponsive.
Actual: an indefinite silent hang. gh auth status hangs the same way.
Logs / environment
- gh version 2.103.1 (2026-10-23)
- Ubuntu 26.04.1 LTS, GNOME on Wayland
- gnome-keyring 50.0 (
gnome-keyring-daemoncrash report recorded by apport at the time)
Related
- gh auth login hangs after selecting github.com (Debian 12) #7356: same symptom, where the cause was a keyring unlock prompt shown on the local desktop while
ghwaited silently. gh apisilently sends unauthenticated requests when keychain access fails #13317: a different keyring failure mode (silent fallback to unauthenticated requests).
A timeout plus a hint about --insecure-storage would have turned this into a self-explanatory error instead of an apparent freeze.
Activity
cli-triage commentedon Oct 24, 2026
Thanks for the detailed report. I'm suggesting
bug,priority-3, andgh-auth: this describesgh auth login/gh auth statusfailing to surface any error when the Secret Service (keyring) backend is in a broken state, but it looks like a narrow, environment-specific trigger (two competinggnome-keyring-daemoninstances after a crash) with a workaround (restart the daemon, or--insecure-storage), so I'm not marking it P1/P2.I didn't find an exact duplicate. #7356 (closed) was an older, unrelated hang after selecting "GitHub.com", and #13317 is about silent unauthenticated fallback rather than hanging — both correctly linked by the reporter as "related," not duplicates.
Hypothesis on the mechanism: each keyring operation already has a timeout, not an unbounded wait —
keyring.Getgives up and returns aTimeoutErrorafter 60 seconds (bumped up from 3 seconds specifically so interactive unlock prompts have time to be answered, see 0ca080d):cli/internal/keyring/keyring.go
Lines 37 to 60 in 0ca080d
AuthConfig.ActiveTokencan call into the keyring more than once per invocation (viaTokenForUserand then aTokenFromKeyringfallback), so what looks like an "indefinite" hang may actually be one or more sequential 60-second waits with no progress indicator — worse here because a crashing/restarting daemon could also be re-triggering GUI unlock prompts each time. I can't confirm from the report alone whether the process truly never returns or whether it was still inside these windows when the reporter gave up; a maintainer may want to ask whether the hang exceeded ~1-2 minutes, and whetherstrace/gdbus monitoroutput is available to see which D-Bus call stalls.ye-discernis commentedon Oct 24, 2026
Answers, plus a controlled repro with strace.
Controlled repro: keyring paused, not crashed
I
SIGSTOPed the single, healthy systemd-managedgnome-keyring-daemon, rangh auth statusunderstrace -f -tt -e trace=%process,%network,poll,ppoll,epoll_pwait,futex, thenSIGCONTed it. gh 2.103.1.gh auth statusblocked for 180.2 s, exactly 3 × 60 s. The trace shows three back-to-back waits, each timing out at 60 s:connect()happens at t=0. Nothing else happens until the third timeout, after which gh resolves DNS, connects to api.github.com:443 and exits 1.This confirms the triage hypothesis: sequential 60 s keyring timeouts (here three of them), with no progress indicator.
gh auth login. That command then hits the same keyring and hangs again. In the real incident, that is exactly the loop I ended up in.The original incident (system journal, local time)
gnome-keyring-daemonloggedgkd_secret_service_get_pkcs11_session: assertion 'client' failed,aes_negotiate: assertion 'session' failed, andg_variant_new: expected GVariant of type 'v' but received value has type '(null)', then aborted (SIGABRT, 22:37:28).Activating service name='org.freedesktop.secrets' requested by ... comm="gh auth token". That started the D-Bus-activation copy (--start --components=secrets) alongside the systemd unit, which systemd restarted at 22:37:29. Both copies then logged "The Secret Service was already initialized", and the D-Bus copy loggeddiscover_other_daemon: 1.gh auth login -h github.com -p ssh -wblocked for about 18 minutes (exit 1, no device code ever printed).gh auth statusblocked for about 3 minutes, consistent with the 3 × 60 s above.Suggestions
--insecure-storage).hlymhalsyry48-hash commentedon Oct 24, 2026