Bug 459902 - Update logind.conf while setting lid actions from systemsettings
Summary: Update logind.conf while setting lid actions from systemsettings
Status: RESOLVED UPSTREAM
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_powerdevil (other bugs)
Version First Reported In: unspecified
Platform: Other Other
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-01 20:12 UTC by retired
Modified: 2024-09-13 18:04 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description retired 2022-10-01 20:12:44 UTC
So here is some background. I'm using my laptop with lid down, since 32" is more usable than 15". I told systemsettings to ignore the lid switch when it's on running with external power.
Here's the problem, when I tell my system to shutdown while lid is down, it half kills the session and goes to sleep instead. After waking up all I get is a black screen and cursor, restarting sddm gets me fully functional system.

I was puzzled at first, coming from work and I could have sworn that I pressed shutdown in plasma.
Turns out that after session is done, logind takes over (my theory at least) and whatever is in logind.conf takes priority.

After setting "HandleLidSwitch and HandleSuspendKey, just for good measure to "ignore" my system shuts down even with lid down.

Does logind even support what powerdevil with plasma can do? Having multiple options for different power supply states I mean.
Comment 1 Jakob Petsovits 2024-09-13 17:58:56 UTC
> Does logind even support what powerdevil with plasma can do? Having multiple options for different power supply states I mean.

It doesn't, that's a bit unfortunate that we can't cleanly map to systemd concepts. What systemd does have nowadays is HandleLidSwitchDocked and HandleLidSwitchExternalPower, which roughly let you do the same thing as Plasma's power state configuration, but looking at it from a somewhat different angle.

I'm a little wary of writing systemd.conf from PowerDevil natively, it seems feasible to do if we let a KAuth helper write the config to e.g. /etc/systemd/logind.conf.d/90-kde-powerdevil.conf, but also we'll have to think about a good UI for that or whether it would make more sense to somehow get powerdevil to run also by SDDM (without interruption when starting the session).

Also see: https://github.com/systemd/systemd/issues/31119

But there might also be a different issue altogether, because if systemd is told to shutdown, it shouldn't let subsequent inhibitor changes affect this initial choice. Maybe writing logind configuration is only a hack and the real task is to figure out why shutdown doesn't remain shutdown inside logind itself.
Comment 2 Zamundaaa 2024-09-13 18:04:16 UTC
This sounds more like a bug in systemd than anything else, and the underlying issue would not be fixed by using systemd power management in Plasma.
Please make a bug report to systemd about it; it should not sleep (for any reason, not just the lid switch thing) when the system is already shutting down.