linuxmint / linuxmint/cinnamon-session
Session is not closed when shutdown starts while another process holds a `delay` inhibitor
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 31
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Still reproducible on current master (d10f424, 6.7.4-unstable).
Problem
When the user asks for shutdown or reboot, cinnamon-session runs its end-session phases and then calls logind PowerOff(), but it never terminates itself. If any other process holds a delay shutdown inhibitor, logind postpones the transition and the session stays on screen in a half-terminated state: it is already past the RUNNING phase, so the panel's next org.gnome.SessionManager.Shutdown call fails with
GDBus.Error:org.gnome.SessionManager.NotInRunning: Shutdown interface is only available during the Running phase
the desktop icons are gone because the apps were already asked to end, and yet applications can still be launched. The machine only powers off when the other inhibitor is released.
The original report comes from a unattended-upgrades setup with InstallOnShutdown "true" and InhibitDelayMaxSec=1800, but any long delay inhibitor triggers it. With the default InhibitDelayMaxSec of a few seconds nobody notices.
How to reproduce
systemd-inhibit --what=shutdown --mode=delay --who=test --why=test sleep 300
then shut down from the Cinnamon menu: the session stays visible and usable for the whole delay.
Where it comes from
csm_manager_quit() (cinnamon-session/csm-manager.c:487) exits the session for logout, but not for shutdown/reboot:
case CSM_MANAGER_LOGOUT_LOGOUT:
csm_quit ();
break;
...
case CSM_MANAGER_LOGOUT_SHUTDOWN:
case CSM_MANAGER_LOGOUT_SHUTDOWN_INTERACT:
csm_system_attempt_stop (manager->priv->system); /* line 520, no csm_quit() */
break;
csm_systemd_attempt_stop() (csm-systemd.c:236) just calls PowerOff(TRUE) and relies on systemd to tear everything down. cinnamon-session also never takes a delay inhibitor of its own: csm_systemd_add_inhibitor() only ever takes block ones on behalf of session apps (csm-systemd.c:629).
gnome-session handles this differently: gsm_systemd_prepare_shutdown() takes its own delay inhibitor before calling PowerOff/Reboot, and gsm_manager_quit() then calls gsm_system_complete_shutdown() (which drops that inhibitor) followed by gsm_quit(). The session goes away in any case, and the shutdown proceeds once the remaining inhibitors allow it.
Suggested fix
Port that split rather than simply adding a csm_quit() after csm_system_attempt_stop() — the PowerOff call is asynchronous, so quitting right after it would cut it short. That is: take a delay inhibitor before requesting PowerOff/Reboot, release it at quit time, and let the session exit.
Related reports
- #143 — same issue, opened in 2021, body was only a link to the Debian bug; never triaged and auto-closed as stale in April 2026. Hence this new issue with the details.
- #147 / #194 / #195 — cinnamon-session creating a
blockinhibitor when an application asks for adelayone. Same area, different problem. - #186, fixed by 8042c7f (clearing the session inhibitors before
PowerOff) — that one is about shutdown being refused, not delayed, and does not change the behaviour described here. - Debian bugs: https://bugs.debian.org/987612 (now reassigned to cinnamon-session) and the original https://bugs.debian.org/987431 against unattended-upgrades, where the analysis started.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with csm_manager_quit() in cinnamon-session/csm-manager.c and csm_systemd_attempt_stop() plus csm_systemd_add_inhibitor() in csm-systemd.c. Compare these paths with gnome-session's gsm_systemd_prepare_shutdown() and gsm_manager_quit(), then reproduce with the provided systemd-inhibit command. Done means the session exits during a delayed shutdown while the transition proceeds after remaining inhibitors are released.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100