DankMaterialShell icon indicating copy to clipboard operation
DankMaterialShell copied to clipboard

Wi-Fi secret agent silently cancels re-auth prompts and deletes correct saved passwords, permanently breaking reconnect (hotspot drops, laptop lid-close)

Open UnderStackDev opened this issue 2 months ago • 0 comments

dms doctor -vC

Click to expand
## DMS Doctor Report

**System**
- [ok] Operating System: Fedora Linux 44 (Forty Four)
  - ID: fedora, Version: 44, Arch: amd64
- [ok] Architecture: amd64
- [ok] Display Server: Wayland
  - WAYLAND_DISPLAY=wayland-1

**Versions**
- [ok] DMS CLI: dms v1.6.0
  - /usr/bin/dms
- [ok] Quickshell: Quickshell 0.3.1 (revision 2d3b3e9c70ef380dff751b61d334dc88df016c29, distributed by Fedora COPR (lionheartp/Hyprland))
  - /usr/bin/qs
- [ok] DMS Shell: v1.6.0
  - /run/user/1000/danklinux-shell/9d4a9fd2ce270115

**Compositor**
- [ok] Hyprland: 0.56.2
- [info] Active: Hyprland

**Network**
- [ok] Network: NetworkManager
  - NetworkManager present. Using NM API.

**Services**
- [ok] dms.service: enabled, active

Summary: 0 error(s), 1 warning(s), 36 ok (unrelated warning: XDG_MENU_PREFIX not set)

Description

DMS's built-in NetworkManager secret agent (com.danklinux.NMAgent) has two compounding problems that together make Wi-Fi effectively unrecoverable after any connection hiccup that requires re-auth — most commonly a mobile-hotspot drop (phone leaves range) or a laptop lid-close/suspend cycle:

  1. The re-auth prompt silently self-cancels. When the same connection needs secrets again in quick succession (e.g. because the underlying association keeps failing for an unrelated reason — driver issue, AP hiccup, whatever), the agent's GetSecrets prompt does NOT stay up waiting for the user. After ~44s with no visible, obvious response it logs:

    [SecretAgent] Waiting for user input (token=...)
    ... 44s later ...
    [SecretAgent] Prompt failed or cancelled: ErrUnknown: secret prompt cancelled by user
    

    The user never consciously cancelled anything — the prompt just isn't a persistent, hard-to-miss modal the way GNOME Shell's or nm-applet's is. In our reproduction the user entered the correct password twice in a row for two earlier prompts (confirmed via [SecretAgent] User provided secrets, save=true), so this isn't a typo — it's the third/Nth prompt in a short window that gets lost.

  2. The agent proactively calls DeleteSecrets on connections that are failing. The clearest, unambiguous case in our logs is for a connection whose stored PSK was in fact correct and which nobody had removed via nmcli/nm-connection-editor at that point:

    syys 05 12:17:44 dms[109644]: INFO go: [SecretAgent] DeleteSecrets called: path=/org/freedesktop/NetworkManager/Settings, uuid=6a19b17d-bc02-4b1f-8af9-e28f8bd7a8a6
    

    (Two earlier DeleteSecrets calls for other UUIDs also appear in our logs, but those may coincide with our own manual nmcli connection delete cleanup of separately-broken duplicate profiles during debugging, so we can't cleanly attribute those two to DMS acting on its own — the one above is the one we can.) Once the secret is deleted, a transient failure (association hiccup, timing issue, driver flake — anything that isn't actually "wrong password") gets permanently converted into "no secret on disk," so the next autoconnect attempt fails immediately with:

    NetworkManager: no secrets: No agents were available for this request.
    state change: need-auth -> failed (reason 'no-secrets')
    

    and toggling the Wi-Fi radio off/on from the DMS Control Center does not help, because the profile now genuinely has no stored secret and nothing re-prompts for it on its own.

Net effect: a connection that has worked perfectly fine for a long time (same machine, same kernel, same driver, verified reliable for us on a GNOME session the same day) becomes permanently stuck the first time it needs to re-authenticate under DMS, and recovering requires the user to manually inspect nmcli/journalctl/dmesg and re-enter credentials by hand outside of DMS's own UI. There is no indication in DMS's UI that this happened — no persistent "enter password" prompt, no error toast that survives — the user just sees Wi-Fi silently refuse to reconnect.

Priority argument

This is not an edge case — every laptop user hits it on first lid close, every mobile hotspot user hits it multiple times per day. Current behavior means DMS is not viable as a daily driver on portable hardware without the user manually diagnosing and fixing what should be a default, invisible part of the setup.

Expected Behavior

  • A GetSecrets prompt for an already-known connection should stay visible/pending (or at minimum be clearly, persistently surfaced — a toast/notification the user can act on later, not something that silently expires after ~44s) until the user actually answers it or explicitly dismisses it.
  • DeleteSecrets should not be called reactively on every connection failure. A transient/driver-level association failure (anything other than an explicit "wrong password"/auth-rejected signal from NetworkManager) should not cause DMS to discard a previously-working, correctly-saved secret. At minimum this should require several consecutive, unambiguous auth-rejection failures (not handshake timeouts) before secrets are purged, and should never fire silently — the user should be told a saved network's credentials were dropped.
  • Toggling Wi-Fi off/on (or some equivalent one-click action) in the Control Center should be a real, working "try again from scratch" path, not something that just retries against an already-broken/secret-less profile.

Steps to Reproduce

  1. Have a saved Wi-Fi connection (a phone's mobile hotspot is the easiest way to reproduce, since it drops/reappears constantly as the phone moves).
  2. Let the connection fail to associate/authenticate a few times in a row within a short window (a hotspot going in and out of range does this naturally; a real access point can be reproduced by walking out of range and back, or by briefly changing/removing the AP's password and then restoring it).
  3. Watch journalctl --user -u dms.service | grep -i secretagent during this window.
  4. Observe: DMS's agent is asked for secrets more than once, the user answers correctly at least once, and eventually either (a) a prompt round is logged as "cancelled by user" despite no such action being taken, and/or (b) DeleteSecrets fires for the connection.
  5. Wi-Fi now stays disconnected. Toggling the radio off/on in DMS's Control Center does not fix it. The only way back in is nmcli/nm-applet/manually re-adding the password outside DMS.

Error Messages/Logs

syys 05 11:58:12 dms[109644]:   INFO  go: [SecretAgent] GetSecrets called: path=/org/freedesktop/NetworkManager/Settings/3, setting=802-11-wireless-security, hints=[], flags=7
syys 05 11:58:12 dms[109644]:   INFO  go: [SecretAgent] connType=802-11-wireless, name=OnlyWlans 1, vpnSvc=, fields=[psk], flags=7, vpnPasswordFlags=65535
syys 05 11:58:12 dms[109644]:   INFO  go: [SecretAgent] Waiting for user input (token=010aef2b3d2e6b5b6715f6f02a8219c9)
syys 05 11:58:18 dms[109644]:   INFO  go: [SecretAgent] User provided secrets, save=true
syys 05 11:58:27 dms[109644]:   INFO  go: [SecretAgent] GetSecrets called: path=/org/freedesktop/NetworkManager/Settings/3, setting=802-11-wireless-security, hints=[], flags=7
syys 05 11:58:27 dms[109644]:   INFO  go: [SecretAgent] Waiting for user input (token=5999fb6eb94793c8d74dfbf7b2eaca1c)
syys 05 11:58:34 dms[109644]:   INFO  go: [SecretAgent] User provided secrets, save=true
syys 05 11:58:43 dms[109644]:   INFO  go: [SecretAgent] GetSecrets called: path=/org/freedesktop/NetworkManager/Settings/3, setting=802-11-wireless-security, hints=[], flags=7
syys 05 11:58:43 dms[109644]:   INFO  go: [SecretAgent] Waiting for user input (token=34c4e06f9982558f218862467c7014d3)
syys 05 11:59:27 dms[109644]:   WARN  go: [SecretAgent] Prompt failed or cancelled: ErrUnknown: secret prompt cancelled by user
syys 05 11:57:16 dms[109644]:   INFO  go: [SecretAgent] DeleteSecrets called: path=/org/freedesktop/NetworkManager/Settings, uuid=c3b531d6-f9be-4c03-b104-bb117a99083d
syys 05 11:57:16 dms[109644]:   INFO  go: [SecretAgent] DeleteSecrets called: path=/org/freedesktop/NetworkManager/Settings, uuid=a1a6e1b6-3f5f-414e-90f9-ee2de4bafa69
...
syys 05 12:14:56 dms[109644]:   INFO  go: [SecretAgent] DeleteSecrets called: path=/org/freedesktop/NetworkManager/Settings, uuid=9709883f-d954-3fad-8f91-4518755d17bf
syys 05 12:17:44 dms[109644]:   INFO  go: [SecretAgent] DeleteSecrets called: path=/org/freedesktop/NetworkManager/Settings, uuid=6a19b17d-bc02-4b1f-8af9-e28f8bd7a8a6
NetworkManager[663]: <warn>  device (wlp0s20f0u1): no secrets: No agents were available for this request.
NetworkManager[663]: <info>  device (wlp0s20f0u1): state change: need-auth -> failed (reason 'no-secrets')

Separately, on this same machine/kernel/session, the underlying association itself is also affected by a known upstream rtw88 driver issue causing repeated 4WAY_HANDSHAKE_TIMEOUT (see https://github.com/lwfinger/rtw88/issues/430) — included here for completeness since it's what originally triggered the repeated re-auth attempts in our case, but the secret-agent behavior above would cause the same permanent lockout for any cause of repeated transient auth failure (weak signal, AP reboot, etc.), not just this specific driver bug.

UnderStackDev avatar Sep 05 '26 10:09 UnderStackDev