Artix Linux Forum

Artix Linux => System => Topic started by: dreieck on 13 October 2023, 22:44:54

Title: Which daemons might trigger a poweroff on low battery? I want to switch it off.
Post by: dreieck on 13 October 2023, 22:44:54
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?

Title: Re: Which daemons might trigger a poweroff on low battery? I want to switch it off.
Post by: LemonPie on 14 October 2023, 00:40:23
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"
Title: Re: Which daemons might trigger a poweroff on low battery? I want to switch it off.
Post by: dreieck on 14 October 2023, 10:04:30
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 (https://wiki.archlinux.org/title/GPD_MicroPC) 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 :-(.
Title: Re: Which daemons might trigger a poweroff on low battery? I want to switch it off.
Post by: Hitman on 14 October 2023, 10:25:36
What desktop environment are you using? Unlikely as it is it might be using UPower.
Title: Re: Which daemons might trigger a poweroff on low battery? I want to switch it off.
Post by: dreieck on 14 October 2023, 12:24:48
What desktop environment are you using?
Not a desktop environment.

Standalone stuff started via ~/.xinitrc:

Unlikely as it is it might be using UPower.

Yes, upowerd is running.

I need to investigate

/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 (https://gitlab.freedesktop.org/upower/upower/-/merge_requests/40): UPower by default does not support "doing nothing" :-(, and now I try aur/upower-nocritical-nosystemd-git (https://aur.archlinux.org/packages/upower-nocritical-nosystemd-git).