Ubuntu – Hibernate/suspend on critical battery level – where should I set it from MATE GUI

16.04batteryhibernatematesuspend

I have bought new battery for my laptop. It is running Ubuntu MATE 16.04.5 LTS.

This new battery have normal capacity, charging and provides long life 🙂

But I have small problem: when battery level goes under some level – the laptop shutdowns immediately. I remember, that it normally went to the suspend with old battery.

With new battery I can suspend manually and all suspend-related tests (such as pm-is-supported --suspend, pm-is-supported --hibernate, pm-is-supported --suspend-hybrid) returns 0, so these actions are supported.

For more predictive results I have reseted all settings with

gsettings reset-recursively org.mate.power-manager

So my GSettings reports the following:

$ gsettings list-recursively | egrep "critical|action|low|time" | grep -i power | sort -u
org.mate.power-manager action-critical-battery 'hibernate'
org.mate.power-manager action-critical-ups 'shutdown'
org.mate.power-manager action-low-ups 'hibernate'
org.mate.power-manager action-sleep-type-ac 'suspend'
org.mate.power-manager action-sleep-type-battery 'hibernate'
org.mate.power-manager idle-dim-time 10
org.mate.power-manager info-history-time 21600
org.mate.power-manager notify-low-capacity true
org.mate.power-manager notify-low-power true
org.mate.power-manager percentage-action 2
org.mate.power-manager percentage-critical 3
org.mate.power-manager percentage-low 10
org.mate.power-manager show-actions true
org.mate.power-manager time-action 120
org.mate.power-manager time-critical 300
org.mate.power-manager time-low 1200
org.mate.power-manager use-time-for-policy true

In /etc/UPower/UPower.conf I have default values:

$ cat /etc/UPower/UPower.conf | grep -v ^# | egrep "Critical|Low|Action|Time"
PercentageLow=10
PercentageCritical=3
PercentageAction=2
TimeLow=1200
TimeCritical=300
TimeAction=120
CriticalPowerAction=HybridSleep

The MATE Power Management Preferences (mate-power-preferences) does not have GUI element to set critical battery level:

mate-power-preferences

Where should I set critical battery level for hibernate or suspend from MATE GUI?
Will changing value via GSettings or Dconf change value in UPower.conf?
Where else should I set the action on critical battery level?


Updates:
1. Laptop model is Asustek UX32A.
Output of cat /sys/class/power_supply/BAT0/uevent:

POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=481
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=7400000
POWER_SUPPLY_VOLTAGE_NOW=7400000
POWER_SUPPLY_POWER_NOW=11151000
POWER_SUPPLY_ENERGY_FULL_DESIGN=48248000
POWER_SUPPLY_ENERGY_FULL=50038000
POWER_SUPPLY_ENERGY_NOW=46346000
POWER_SUPPLY_CAPACITY=92
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=UX32-65
POWER_SUPPLY_MANUFACTURER=ASUSTeK
POWER_SUPPLY_SERIAL_NUMBER= 

and output of upower --dump:

Device: /org/freedesktop/UPower/devices/line_power_AC0
  native-path:          AC0
  power supply:         yes
  updated:              Sun Nov  4 12:43:52 2018 (233 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              no
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               ASUSTeK
  model:                UX32-65
  power supply:         yes
  updated:              Sun Nov  4 12:45:52 2018 (113 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              46.509 Wh
    energy-empty:        0 Wh
    energy-full:         46.916 Wh
    energy-full-design:  48.248 Wh
    energy-rate:         11.514 W
    voltage:             7.4 V
    time to empty:       4.0 hours
    percentage:          92%
    capacity:            81.4562%
    technology:          lithium-ion
    icon-name:          'battery-full-symbolic'
  History (charge):
    1541324752  92.000  discharging
  History (rate):
    1541324752  11.514  discharging

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              Sun Nov  4 12:45:52 2018 (113 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              46.509 Wh
    energy-full:         46.916 Wh
    energy-rate:         11.514 W
    time to empty:       4.0 hours
    percentage:          92%
    icon-name:          'battery-full-symbolic'

Daemon:
  daemon-version:  0.99.4
  on-battery:      yes
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: HybridSleep

2. TLP is not installed on my system.
3. I have reseted all settings with no luck. Todat I asked question on Ubuntu-MATE.community.

Best Answer

GUI method

From: Change Critical Battery Level and Action in Linux Mint 18 Cinnamon you can install dconf-editor using:

$ sudo apt-get install dconf-editor

Then go to org -> cinnamon -> settings-daemon -> plugins -> power

mate gsettings power.png

  • Default settings are (in %):
  • Critical battery action: hibernate
  • Critical: 2
  • Action: 2
  • Low: 10

Exercise caution and tweak to your heart’s content ?


Original Answer and edits below

Review your current settings with:

$ gsettings list-recursively | grep critical
org.gnome.settings-daemon.plugins.power critical-battery-action 'shutdown'
org.gnome.settings-daemon.plugins.power percentage-critical 3
org.gnome.settings-daemon.plugins.power time-critical 300

Change your critical-battery-action

$ gsettings set org.gnome.settings-daemon.plugins.power critical-battery-action 'suspend'

Linux Mate differences

When using Linux Mate you need to substitute org.gnome with org.mate and possibly change your keys. From ArchWiki:

Battery discharge

To disable the notification on battery discharge, run:

$ gsettings set org.mate.power-manager.notify-discharging false

However in Ubuntu there is no equivalent.

Find all Mate power settings

To find all Mate power settings use:

$ gsettings list-recursively | grep power-manager

In Ubuntu you would use:

$ gsettings list-recursively | grep plugins.power