Trying to use Hybrid sleep causes shutdown instead (UPower)

My laptop has a bad battery that suddenly falls down to 0% even through it can run for a couple more hours. The problem is that this broken battery triggers UPower critical power action which is Hybrid sleep. But instead of Hybrid sleep actually happening the laptop shutdowns instead.
How can I fix Hybrid sleep so it doesn’t cause UPower to shutdown? Or even better take no action at all (I understand the risks of it)

Edit: System information:

System:
  Kernel: 5.16.8-200.fc35.x86_64 x86_64 bits: 64 compiler: gcc
    v: 2.37-10.fc35 Desktop: KDE Plasma 5.23.5
    Distro: Fedora release 35 (Thirty Five)
Machine:
  Type: Laptop System: HP product: HP Laptop 15-da1xxx
    v: Type1ProductConfigId serial: <superuser required>
  Mobo: HP model: 8533 v: 70.38 serial: <superuser required> UEFI: Insyde
    v: F.38 date: 08/31/2021
Battery:
  ID-1: BAT1 charge: 18.9 Wh (75.0%) condition: 25.2/41.9 Wh (60.2%)
    volts: 13.1 min: 11.6 model: Hewlett-Packard PABAS0241231 status: Charging
CPU:
  Info: quad core model: Intel Core i7-8565U bits: 64 type: MT MCP
    arch: Whiskey Lake rev: B cache: L1: 256 KiB L2: 1024 KiB L3: 8 MiB
  Speed (MHz): avg: 672 high: 700 min/max: 400/4600 cores: 1: 609 2: 700
    3: 700 4: 700 5: 700 6: 633 7: 641 8: 700 bogomips: 31999
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
Graphics:
  Device-1: Intel WhiskeyLake-U GT2 [UHD Graphics 620]
    vendor: Hewlett-Packard driver: i915 v: kernel bus-ID: 00:02.0
  Device-2: NVIDIA GM108M [GeForce MX130] vendor: Hewlett-Packard
    driver: N/A bus-ID: 01:00.0
  Device-3: Chicony HP TrueVision HD Camera type: USB driver: uvcvideo
    bus-ID: 1-5:2
  Display: x11 server: X.Org 1.20.14 driver: loaded: modesetting
    unloaded: fbdev,vesa resolution: 1920x1080~60Hz
  OpenGL: renderer: Mesa Intel UHD Graphics 620 (WHL GT2)
    v: 4.6 Mesa 21.3.6 direct render: Yes
Audio:
  Device-1: Intel Cannon Point-LP High Definition Audio
    vendor: Hewlett-Packard driver: snd_hda_intel v: kernel bus-ID: 00:1f.3
  Sound Server-1: ALSA v: k5.16.8-200.fc35.x86_64 running: yes
  Sound Server-2: PipeWire v: 0.3.45 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Hewlett-Packard driver: r8169 v: kernel port: 4000 bus-ID: 02:00.0
  IF: eno1 state: down mac: <filter>
  Device-2: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter
    vendor: Hewlett-Packard driver: rtl8821ce v: N/A port: 3000 bus-ID: 03:00.0
  IF: wlo1 state: up mac: <filter>
RAID:
  Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci
    v: 3.0 bus-ID: 00:17.0
Drives:
  Local Storage: total: 1.14 TiB used: 84.87 GiB (7.3%)
  ID-1: /dev/nvme0n1 vendor: Kingston model: SA2000M8250G size: 232.89 GiB
    temp: 21.9 C
  ID-2: /dev/sda vendor: Western Digital model: WD10SPZX-60Z10T0
    size: 931.51 GiB temp: 19 C
Partition:
  ID-1: / size: 107.72 GiB used: 21.98 GiB (20.4%) fs: ext4
    dev: /dev/nvme0n1p4
  ID-2: /boot size: 973.4 MiB used: 250.7 MiB (25.8%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-3: /boot/efi size: 511 MiB used: 18.1 MiB (3.5%) fs: vfat
    dev: /dev/nvme0n1p1
  ID-4: /home size: 118.91 GiB used: 3.47 GiB (2.9%) fs: ext4
    dev: /dev/nvme0n1p3
Swap:
  ID-1: swap-1 type: zram size: 7.51 GiB used: 0 KiB (0.0%) dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 29.8 C pch: 30.0 C mobo: 27.8 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 231 Uptime: 6m Memory: 7.51 GiB used: 1.97 GiB (26.2%)
  Init: systemd runlevel: 5 Compilers: gcc: 11.2.1 Packages: 5
  note: see --pkg Shell: Bash v: 5.1.8 inxi: 3.3.12

Welcome to ask.:fedora:edora @td211

Could you please give us more info’s as :

inxi -Fzx in terminal and post the output as </> Preformatted text here.

Hi there. Hybrid sleep means it will sleep then hibernate. Unfortunately with Fedora Linux the hibernate are by default is disabled. That is why if the system detect critical battery percentages it will shutdown instead of hibernate.

If you want to have hibernate active, you could set it manually. There lot of tutorials available on the internet.

Or you can use Fedora KDE spin. KDE have feature to save the last session that (at least for me) it almost like hibernate.

Note: I’m no longer use KDE at present.

Added the requested info. Can I just disable UPower on critical battery to prevent it from taking any action?

I already use the KDE spin. The main issue is that I don’t want the laptop to power off, it can operate for almost 3 hours while supposedly 0%.

If you are sure with 0% it still can run 3 hours, you can modify /etc/UPower/UPower.conf, find part UsePercentageForPolicy=true change it to false. It will use time action as bellow:

TimeLow=1200
TimeCritical=300
TimeAction=120

Instead of:

PercentageLow=20
PercentageCritical=5
PercentageAction=2

You could also change the default values (please read through all the comment there inside UPower.conf file). After that run systemctl restart upower of just reboot to make sure everything reload correctly.

1 Like

I tried, but looks like the BIOS also reports 0 minutes which leads to the same result. Is there any way to stop UPower when the battery is critical and restart it when plugged in? (Using a systemd service for example)

The available choice possible for default Fedora Linux installation only PowerOff for UPower when on action. You need manually enable hibernate to do that.

Or just set higher TimeLow/TimeCritical or PrecentageLow/PrecentageCritical so you get earlier notification and have enough times to plug in the AC power to avoid the system from power off.