Skip to main content
Topic: Which daemons might trigger a poweroff on low battery? I want to switch it off. (Read 431 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Which daemons might trigger a poweroff on low battery? I want to switch it off.

Ahoj,

I am using OpenRC as init system on a laptop.

There is something in my system which is not acpid that issues a system shutdown on low battery, which I never have activated and which I do not have activated! (I want to have my own solution which makes a suspend to disk via a custom script, but it will not run since this unwanted automagism is triggering earlier than my script.)

I have no idea what it is.

Can anyone suggest stuff I can have a look into and where I can switch it off?

  • /etc/acpi is completely customised and has nowhere anything related to poweroff.
  • /etc/elogind/logind.conf contains the following non-commented entries:
    Code: [Select]
    [Login]
    KillUserProcesses=no
    KillExcludeUsers=root
    InhibitDelayMaxSec=10
    HandlePowerKey=ignore
    HandlePowerKeyLongPress=ignore
    HandleRebootKey=ignore
    HandleRebootKeyLongPress=ignore
    HandleSuspendKey=ignore
    HandleSuspendKeyLongPress=ignore
    HandleHibernateKey=ignore
    HandleHibernateKeyLongPress=ignore
    HandleLidSwitch=ignore
    HandleLidSwitchExternalPower=ignore
    HandleLidSwitchDocked=ignore
    PowerKeyIgnoreInhibited=yes
    SuspendKeyIgnoreInhibited=yes
    HibernateKeyIgnoreInhibited=yes
    LidSwitchIgnoreInhibited=yes
    RebootKeyIgnoreInhibited=yes
    HoldoffTimeoutSec=30s
    IdleAction=ignore
    IdleActionSec=30min
    RuntimeDirectorySize=5M
    RemoveIPC=no
  • /etc/elogind/sleep.conf contains the following non-commented entries:
    Code: [Select]
    [Sleep]

Re: Which daemons might trigger a poweroff on low battery? I want to switch it off.

Reply #1
do you have any udev rule at "/etc/udev/rules.d/" something like this
Code: [Select]
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", \
RUN+="/usr/bin/slock loginctl hibernate -i"

Re: Which daemons might trigger a poweroff on low battery? I want to switch it off.

Reply #2
do you have any udev rule at "/etc/udev/rules.d/" something like this
Code: [Select]
SUBSYSTEM=="power_supply", \
ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", \
RUN+="/usr/bin/slock loginctl hibernate -i"
No:
grep -ri power_supply /etc/udev/rules.d /usr/lib/udev/rules.d:
Code: [Select]
/usr/lib/udev/rules.d/battery-stats.rules:SUBSYSTEM=="power_supply", ACTION=="change", RUN+="/usr/share/battery-stats/collect-csv"
/usr/lib/udev/rules.d/battery-stats.rules:SUBSYSTEM=="power_supply", ACTION=="change", RUN+="/usr/sbin/battery-stats-collector -1"
/usr/lib/udev/rules.d/battery-stats.rules:SUBSYSTEM=="power_supply", ATTR{online}=="[01]", RUN+="/usr/share/battery-stats/collect-csv"
/usr/lib/udev/rules.d/battery-stats.rules:SUBSYSTEM=="power_supply", ATTR{online}=="[01]", RUN+="/usr/sbin/battery-stats-collector -1"

Furthermore, as far as I can remember (but I am not sure) my device's hardware does not send any event on low or critical battery except a power button acpi event on "battery so low that hardware will hard-turn-off in a few seconds", so I guess something has to monitor the charge state regularly.

And power button ACPI event I have set to a custom script that does suspend to disk (and which I use daily by just pressing the power button to do a suspend to disk).

I remember that there was some automagism of power off on low battery in some system component, but I cannot remember which :-(.

Re: Which daemons might trigger a poweroff on low battery? I want to switch it off.

Reply #3
What desktop environment are you using? Unlikely as it is it might be using UPower.

 

Re: Which daemons might trigger a poweroff on low battery? I want to switch it off.

Reply #4
What desktop environment are you using?
Not a desktop environment.

Standalone stuff started via ~/.xinitrc:
  • xfwm4
  • artix-pipewire-loader
  • xfce4-panel

Unlikely as it is it might be using UPower.

Yes, upowerd is running.

I need to investigate
  • who is starting it,
  • if this is causing the shutdown.

/etc/UPower/UPower.conf has been manually edited by me, and it contains CriticalPowerAction=Ignore.

All non-comment entries of my /etc/UPower/UPower.conf:
Code: [Select]
[UPower]
EnableWattsUpPro=false
NoPollBatteries=true
IgnoreLid=true
UsePercentageForPolicy=true
PercentageLow=10
PercentageCritical=3
PercentageAction=0
TimeLow=1200
TimeCritical=300
TimeAction=120
CriticalPowerAction=Ignore

So it should not interfere, or has UPower some issues which ignore this config file settings?

Maybe we have the reason here: UPower by default does not support "doing nothing" :-(, and now I try aur/upower-nocritical-nosystemd-git.