Skip to content

Lock screen never clears the password buffer across suspend/resume #7789

Closed

Description

@brightwalker25

What happened

Resuming from suspend with the session already locked sometimes brings up the
Omarchy lock screen with its password field already populated — a short run of
characters I did not type. Authentication then fails on the first attempt,
because the real password is appended to whatever is already in the buffer.

What I expected

The password field to be empty on every wake, as it is on a fresh lock.

Steps to reproduce

  1. Lock the session (omarchy system lock, or let it idle-lock).
  2. Suspend, and leave the machine suspended for a while.
  3. Resume and look at the password field before typing.

It is intermittent, not every wake.

The Omarchy part

resetAuthenticationState() in shell/plugins/lock/Service.qml:116 clears
enteredPassword. It is called from exactly three places:

  • beginLock() (:134)
  • finishUnlock() (:155)
  • the unlock branch of onLockStateChanged (:259)

All three are lock/unlock transitions. Nothing resets the buffer across a
suspend/resume boundary, so a lock screen that was already up before suspend
keeps whatever the input layer delivered while it was down.

The plugin has no PrepareForSleep handler, but it is not unaware of resume
elsewhere — idleBlankTimer (:418) explicitly compensates for a countdown
frozen by suspend by checking wall-clock drift:

// A countdown frozen by suspend fires right after resume, which would
// blank the freshly woken unlock screen under the user. Wall-clock time
// exposes the gap: take a fresh run-up instead of blanking.
if (Date.now() - armedAt > interval + 2000) {

The same resume boundary that gets special handling for blanking gets none for
authentication state.

There is a mild credential angle too: if a partly-typed real password is in the
field when the machine suspends, it survives the suspend and is still there on
wake, rather than being discarded.

What I have not established

  • The source of the characters is unconfirmed. My guess is the built-in
    i8042 keyboard (AT Translated Set 2 keyboard) flushing latched scancodes
    when S3 re-powers the controller. A Logi Bolt receiver (046D:C548) that also
    exposes a keyboard interface is not ruled out. I have not captured
    libinput debug-events across a resume to name the device.
  • Whether a reset on resume is sufficient. If the characters are delivered
    shortly after resume rather than buffered from before it, a reset fired on
    the resume signal could race them and clear too early. Ordering would need
    checking before settling on a fix.

So the report I am confident in is the narrow one: the auth buffer is never
cleared at the suspend/resume boundary. Whether that fully explains the symptom
is a separate question.

Relevant local context

This machine is pinned to S3 (MemorySleepMode=deep) as a workaround for
#7788. S3 powers down USB and the i8042 controller where s2idle did not, and
the phantom characters appeared after that change — so anyone trying to
reproduce this on s2idle may not see it.

Workaround

Esc or Ctrl+U clears the field (LockView.qml:177 Keys.onPressed).

System details

  • Omarchy 4.0.0-1, Hyprland 0.56.2-1, quickshell-git 0.3.0.r20.g28771c7-2
  • Kernel 7.1.8-arch1-3
  • ASUS Zenbook UX8402ZE (Zenbook Pro 14 Duo)
  • Intel Core i9-12900H (Alder Lake), Iris Xe i915 + NVIDIA RTX 3050 Ti Mobile
  • /sys/power/mem_sleep = s2idle [deep]
  • pacman -Qkk omarchy: 1628 total files, 0 altered files
  • No lock plugin override in ~/.config/omarchy/

Related: #7788 (the S3 workaround this appeared downstream of), #6925 (a
different failure in the same auth-state area, closed not-planned).

Filed by Claude Opus 5 via Claude Code.

Activity

  1. berndb commented on Aug 22, 2026

    @berndb
    Contributor

    Possibly related: #7805 / PR #7806 — same symptom (password field pre-filled with masked dots on wake, first auth attempt fails), but reproduced without any suspend involved, on a desktop that merely DPMS-blanks the lock screen.

    The mechanism there turned out to be the wake keypress itself: the key is delivered to the password field (key_press_enables_dpms passes it through), the DPMS wake modeset stalls the compositor for seconds on slow-to-wake displays, so the key's release arrives late — and since Wayland key repeat is client-side, the TextInput types the held character at the repeat rate for the whole stall. Deterministic there: lock, wait for the blank, tap one letter key briefly → a pile of dots. Waking with Shift leaves the field empty.

    That suggests a cheap differential test for your intermittent case, since the masking hides whether the buffer holds one repeated character or genuinely distinct ones: after resume, wake with Shift (or the mouse) instead of a character key.

    • Field still pre-filled → real phantom input, consistent with your i8042 scancode-flush theory, and worth capturing with libinput debug-events across a resume.
    • Field empty → it was wake-key repeat, and Drop key auto-repeat in the lock screen password field #7806 (drop auto-repeat in the password field, except Backspace/Delete) should cover your case too.

    The two fixes are complementary either way: auto-repeat filtering does nothing against discrete replayed scancodes (they carry no repeat flag), and a reset at the resume boundary does nothing for the no-suspend blank/wake path. Your narrow finding — that resetAuthenticationState() is never called across suspend/resume — looks valid independent of which source fills the buffer, including the credential angle of a half-typed password surviving suspend.

  2. brightwalker25 commented on Aug 27, 2026

    @brightwalker25
    Author

    Ok thanks for the clarification

  3. jmmon commented on Sep 29, 2026

    @jmmon

    Confirmed on s2idle, and it is purely a buffer-preservation bug — no phantom input

    Reproduced on a Dell XPS 15 9530, Omarchy 4.0.0.r1832.g23dab9e-1, Hyprland
    0.56.2, quickshell 0.3.1, kernel 7.2.5-3-omarchy, external ViewSonic VG3448
    on DisplayPort. /sys/power/mem_sleep = s2idle (not the deep/S3 pin from
    #7788).

    Method: left 3 Space characters in the field as a marker, suspended 157.6s, and
    compared field length across the boundary using a wall-clock heartbeat in the
    plugin (suspend freezes the QML event loop, so the first tick after resume
    reports the gap).

    11:03:06.289  wake-request, fieldLen=0
                  3 Space taps -> field = 3
                  ... 157.6s suspended ...
    11:06:19.023  resume-gap detectedMs=157601  fieldLen=3  lockRequested=true
    11:06:19.024  blank-timer fired elapsedMs=170750  fieldLen=3
    11:06:45.521  secure=false  unlocked
    

    lock-requested does not appear between the marker and the resume, and
    neither does a view teardown — so beginLock()/resetAuthenticationState()
    never ran. The buffer crossed the suspend boundary untouched. That is the
    narrow claim in this issue, reproduced.

    The phantom characters did not appear on s2idle

    Field was exactly 3 after resume, not 3+N. No keys were injected by the resume.

    This machine does have the AT Translated Set 2 keyboard you suspected, but
    on s2idle the controller is not powered down, so there is nothing to flush.
    So the two halves of this report separate cleanly on this hardware:

    • buffer survives suspend — reproduces, hardware-independent, and is the
      actual defect
    • phantom characters — did not reproduce; consistent with your own note
      that S3 is what makes it appear

    Implications for a fix

    Since the characters are not being injected here, a reset fired on the resume
    signal has nothing to race on s2idle — but on an S3 machine it still might,
    and this run cannot speak to that. Ordering still needs checking before
    settling on the fix, as you said.

    One guard already exists and behaved correctly, worth keeping: the blank timer
    fired 1ms after resume with elapsedMs=170750 and took a fresh run-up rather
    than blanking the freshly woken screen.

    Separate observation: omarchy-sleep-lock.service failed

    omarchy-sleep-lock.service: Main process exited, code=exited, status=1/FAILURE
    omarchy-sleep-lock.service: Scheduled restart job, restart counter is at 5
    

    Retried 5 times during the suspend. Unrelated to the buffer, but it is erroring
    on this machine.

    Side note: this repro needs a fallback monitor rule

    Locking with the external display in External-Only mode and then unplugging it
    leaves the built-in panel black — the lock surface has nowhere to draw:

    DEBUG: Not creating lock surface for screen QScreen(...) as it is not backed by a valid wayland output.
    

    Worth knowing for anyone trying to reproduce this on a laptop: after the resume
    there is no visible lock screen to inspect.

  4. brightwalker25 commented on Sep 29, 2026

    @brightwalker25
    Author

    @jmmon Thank you for taking the time to reproduce this so thoroughly. It is very helpful to know that the buffer survives suspend on s2idle as well, and that the phantom characters did not appear there. That supports the idea that they come from S3 on my machine and are a separate problem. Thank you also for the notes on omarchy-sleep-lock.service and the fallback monitor rule.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions