Isso parece ser um bug do systemd causado pelo uso de um timer para acionar um serviço que usa ConditionACPower
; veja link . Mover a verificação de energia CA para o script hibernate-if-low-battery
deve corrigir o problema. Especificamente, isso funciona:
auto-hibernate.service
[Unit]
Description=Check battery level and hibernate if low
[Service]
Type=oneshot
ExecStart=/usr/local/bin/hibernate-if-low-battery
hibernar-se-bateria fraca
#!/usr/bin/env bash
# Configuration.
BATTERY_PATH=/sys/class/power_supply/BAT0
AC_PATH=/sys/class/power_supply/AC
CRITICAL_BATTERY_PERCENTAGE=5
# Get AC power status.
ac_power_active=$(< "${AC_PATH}/online")
# Calculate (the floor of) the battery percentage.
current_battery_level=$(< "${BATTERY_PATH}/energy_now")
max_battery_level=$(< "${BATTERY_PATH}/energy_full")
current_battery_percentage=$(((current_battery_level * 100)/max_battery_level))
battery_level_critical=$((current_battery_percentage <= critical_battery_percentage))
if (( ! ac_power_active && battery_level_critical )); then
logger 'Hibernating due to low battery.'
systemctl hibernate
fi