stopping elogind from doing crazy things
how to stop elogind on slackware from doing things like automagick shutdowns or suspend.
i have an immense dislike of automatic things trying to be clever. elogind, while a noble cause, is the former child of systemd and thus is totally broken if you don't follow it's way of doing things.
one thing it does are automatic actions on low battery. i don't want my device to power down if i only have 5% battery left. i can do that myself, thanks. unfortunately, being the spawn of systemd, it's nearly unconfigurable. you might tune some knobs, but disabling this behavior completely isn't supported without things that are, quoting the manpage,
[...] for local use only and should be considered hacks.
thanks, i hate it!
so, here's how to hopefully disable the shitty behaviors of elogind:
set these settings in the config: [Login] HandlePowerKey=ignore HandleSuspendKey=ignore HandleHibernateKey=ignore HandleLidSwitch=ignore HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore IdleAction=ignore
[Sleep] AllowSuspend=no AllowHibernation=no AllowSuspendThenHibernate=no AllowHybridSleep=no AllowPowerOffInterrupts=yes AllowSuspendInterrupts=yes
AllowSuspendInterrupts=yesenables canceling of shutdown and suspend by placing a hook script into
/etc/elogind/system-shutdown/. we just add a script which always fails. note that "fail" is something different in systemd-land, the exit-status is ignored. the scripts seem to have to print magic words (from loginctl(1)):
Whether the executables in these directories run successfully or not is of no concern to elogind. If you want the scripts to cause the action to be cancelled if one fails, you can set "AllowPowerOffInterrupts" and/or "AllowSuspendInterrupts" to "yes" in /etc/elogind/logind.conf. For this to work the executables in question must print an error message to "STDOUT" that begins with either of these keywords: "CANCELLED", "CRITICAL", "ERROR" or "FAILED". If you want any of these words in a message without causing the action to be cancelled, just re-arrange the sentence in question so that the keyword is not the first word.
.. systemd folks are twisted if you'd ask me. but nobody does, so we are left with this mess!11
so this script should be fine:
#!/bin/sh echo "CANCELLED" echo "CRITICAL" echo "ERROR" echo "FAILED" exit 255
place it into
/etc/elogind/system-shutdown/fail and make it executable.
as we have disabled suspend in the config, that should be enough to
disable the shenanigans elogind does.
all it would have taken is a config switch.