Lid close: suspend still happens after the lid is reopened, because the lock-screen call blocks csd-power
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start with plugins/power/csd-power-manager.c, especially do_lid_closed_action(), suspend_with_lid_closed(), activate_screensaver(), and handle_suspend_actions(). Trace how the blocking lock call and lid_is_closed state affect suspension, then check how lid events and the existing PrepareForSleep lock are handled. Done means reopening the lid during a cold screensaver start prevents the pending suspend while preserving lock behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When the lid is closed, csd-power first locks the screen and then suspends. The lock call is
synchronous and blocks the daemon's main loop until the lock screen is up. If cinnamon-screensaver
is not already running, this takes 4–20 s on my machine. If the lid is reopened during that time,
csd-power cannot process the lid-open event, and it suspends anyway as soon as the lock call returns.
The machine goes to sleep with the lid open. In my case, on wake-up the lock screen was then stuck:
the desktop was visible but nothing reacted, and there was no password box (see the related
cinnamon-screensaver issue).
System
- Linux Mint 22.3 (zena), Cinnamon 6.6.9, cinnamon-settings-daemon 6.6.4+zena,
cinnamon-screensaver 6.6.2+mint22.3, X11 - Kernel 7.0.0-42-generic, Lenovo notebook, Intel UHD 630 + NVIDIA GTX 1050 Ti Max-Q
(PRIME on-demand, driver 580.178.04; the panel is driven by i915), 3840×2160 panel, scale 2 lid-close-ac-action=lid-close-battery-action=suspend,lock-on-suspend= true,
lock-delay= 0- Sleep mode: deep (S3). The NVIDIA suspend/resume services ran cleanly (no errors).
Timeline of the failure (journal)
16:17:05 systemd-logind: Lid closed.
16:17:08 dbus: activating org.cinnamon.ScreenSaver (requested by cinnamon-screensaver-command)
16:17:09 cinnamon-screensaver: Starting screensaver...
16:17:11 systemd-logind: Lid opened. <-- lid reopened before suspend
16:17:21 systemd-logind: The system will suspend now!
16:17:22 kernel: PM: suspend entry (deep)
16:20:24 kernel: PM: suspend exit (no further lock-screen output, UI unresponsive)
Delay from lid close to suspend over the same day, with the screensaver started fresh each time:
4 s, 5 s, 10 s, 20 s, 16 s, 16 s. With a resident screensaver (cinnamon-screensaver --hold)
the delay drops to about 0.95 s:
18:00:07.54 Lid closed.
18:00:08.48 The system will suspend now!
So the race window is the screensaver's cold start, plus the fact that the result of that wait is
never checked against the current lid state.
Cause (from reading plugins/power/csd-power-manager.c on master)
do_lid_closed_action()→suspend_with_lid_closed()→do_power_action_type():case CSD_POWER_ACTION_SUSPEND: if (should_lock_on_suspend (manager)) { activate_screensaver (manager, TRUE); } csd_power_suspend (...);activate_screensaver()runs
g_spawn_command_line_sync ("cinnamon-screensaver-command --lock", ...).
This blocks the main loop, with no timeout, until the lock screen is fully up.- While it is blocked,
lid_state_changed_cb()/do_lid_open_action()cannot run.
After the call returns,csd_power_suspend()is called without re-checking
lid_is_closed. - The screen is locked a second time in
handle_suspend_actions()(onPrepareForSleep,
which already holds asleep/delayinhibitor for locking). A debug log of
cinnamon-screensaver shows twoLockrequests about 0.8 s apart for a single lid close.
Suggested fix
- Lock asynchronously (
g_spawn_async, or an async D-Bus call toorg.cinnamon.ScreenSaver.Lock),
so the main loop keeps handling lid events. - In the completion callback, suspend only if the lid is still closed. If the lid was opened
in between, cancel the pending suspend. - Possibly drop the lock before suspend in the lid path entirely, and rely on the existing
PrepareForSleep+ delay-inhibitor lock inhandle_suspend_actions().
Workaround
An autostart entry with cinnamon-screensaver --hold keeps the screensaver resident. This shrinks
the window to about 1 s, but does not close it.
- Lingua principale
- C
- Stelle
- 70
- Fork
- 81
- Merge medio
- 2g 7h
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di linuxmint/cinnamon-settings-daemon
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
linuxmint/cinnamon-settings-daemon#482 · 1 commento ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
linuxmint/cinnamon-settings-daemon#453 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
linuxmint/cinnamon-settings-daemon#483 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di linuxmint/cinnamon-settings-daemon
Issue simili
-
bug severity: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
AlessandroSangiuliano/Uros#1014 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
OpenXiangShan/NEMU#1314 ·
I maintainer di solito rispondono entro 1 giorno
-
`get_options()` repeats the first byte when hex-encoding octet stringsForse già presa @rue19 l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
OpenPrinting/cups#1830 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
micropython/micropython#20020 ·
I maintainer di solito rispondono entro 1 giorno
-
macro typo in readmeAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100