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
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 adelayshutdown inhibitor, logind postpones the transition and the session stays on screen in a half-terminated state: it is already past theRUNNINGphase, so the panel's nextorg.gnome.SessionManager.Shutdowncall fails withthe 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-upgradessetup withInstallOnShutdown "true"andInhibitDelayMaxSec=1800, but any longdelayinhibitor triggers it. With the defaultInhibitDelayMaxSecof a few seconds nobody notices.How to reproduce
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:csm_systemd_attempt_stop()(csm-systemd.c:236) just callsPowerOff(TRUE)and relies on systemd to tear everything down. cinnamon-session also never takes adelayinhibitor of its own:csm_systemd_add_inhibitor()only ever takesblockones on behalf of session apps (csm-systemd.c:629).gnome-session handles this differently:
gsm_systemd_prepare_shutdown()takes its owndelayinhibitor before callingPowerOff/Reboot, andgsm_manager_quit()then callsgsm_system_complete_shutdown()(which drops that inhibitor) followed bygsm_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()aftercsm_system_attempt_stop()— thePowerOffcall is asynchronous, so quitting right after it would cut it short. That is: take adelayinhibitor before requestingPowerOff/Reboot, release it at quit time, and let the session exit.Related reports
blocksystemd inhibitor when a user application createsdelayinhibitor #147 / Cinnamon creates ablocksystemd inhibitor when a user application createsdelayinhibitor #194 / Cinnamon creates ablocksystemd inhibitor when a user application createsdelayinhibitor #195 — cinnamon-session creating ablockinhibitor when an application asks for adelayone. Same area, different problem.PowerOff) — that one is about shutdown being refused, not delayed, and does not change the behaviour described here.