Power Management
MocaccinoOS uses systemd for system-level power management. Desktop environments also provide graphical settings for controlling power consumption, screen timeouts, battery behaviour and suspend actions.
This page explains how to configure power management and use systemd to control the available sleep states.
Desktop Power Settings
The recommended way to configure power management is through the settings application provided by your desktop environment.
KDE Plasma
Open System Settings and navigate to Power Management.
Depending on the hardware and Plasma version, you can configure:
- Screen brightness and dimming
- Screen inactivity timeout
- Automatic suspend
- Battery and AC power profiles
- Low battery notifications and actions
- Power button behaviour
Plasma also provides battery and power controls through the system tray.
GNOME
Open Settings and select Power.
Available settings include:
- Screen blanking timeout
- Automatic suspend
- Power mode
- Battery status and notifications
The available options depend on whether the system is running on battery power or connected to AC power.
XFCE
Open Settings Manager and select Power Manager.
You can configure display power management, system inactivity actions, button behaviour and battery notifications.
MATE
Open Control Center and select Power Management.
The available settings include display power management, suspend behaviour and power button actions.
COSMIC
Open Settings and select Power.
COSMIC provides power-related settings for managing display inactivity, suspend behaviour and battery operation. Available options depend on the COSMIC version and hardware.
Inspect Power Information
The upower utility can provide information about batteries and power
devices, when supported by the hardware.
List available power devices:
|
|
Inspect a battery:
|
|
The device path may differ between systems. Use the output of upower -e
to identify the correct path.
Information can include:
- Battery charge level
- Battery capacity
- Charging or discharging state
- Estimated remaining time
- Battery health information, when available
Suspend and Hibernation
Linux supports several sleep states. Which states are available depends on
the kernel, hardware, firmware and system configuration.
Suspend
Suspend, also known as suspend-to-RAM, pauses the system while keeping its
state in memory.
It consumes a small amount of power and allows the system to resume quickly.
If power is completely lost while suspended, unsaved work may be lost.
To suspend the system:
|
|
Hibernate
Hibernation saves the system state to persistent storage and powers off the
computer.
Unlike suspend, hibernation does not require continuous power to preserve
the session.
To hibernate:
|
|
Hibernation requires additional configuration, including suitable swap
space and a correctly configured initramfs resume mechanism. Having swap
enabled alone does not guarantee that hibernation will work.
Hybrid Sleep
Hybrid sleep combines suspend and hibernation. The system state is saved
to storage and the computer initially enters suspend.
If power is lost, the saved state can be restored from storage.
|
|
Suspend-then-Hibernate
Suspend-then-hibernate initially suspends the system and subsequently
hibernates it after a configured delay or when the battery reaches a
critical level, where supported.
|
|
This mode is particularly useful for laptops.
Check Available Sleep States
To inspect the sleep states supported by the running kernel:
|
|
Typical output:
|
|
These entries represent available kernel sleep states:
freeze: suspend-to-idlemem: suspend-to-RAMdisk: hibernation
The presence of a state does not guarantee that it will work correctly
with every system’s firmware and hardware.
To inspect the available suspend-to-RAM modes:
|
|
For example:
|
|
The value in square brackets is the currently selected mode.
Configure systemd Sleep Behaviour
Systemd provides configuration options for controlling suspend and
hibernation behaviour.
The main configuration file is:
|
|
Local configuration overrides can also be created in:
|
|
For example, to disable hibernation, create:
|
|
With the following contents:
|
|
The available options include:
AllowSuspend=AllowHibernation=AllowHybridSleep=AllowSuspendThenHibernate=
Only change these settings when you have a specific reason to do so.
Systemd generally detects which sleep states are available and advertises
the supported options automatically.
Power Button Behaviour
Systemd-logind handles several system power events, including the power
button and laptop lid switch.
The configuration file is:
|
|
Local overrides can be placed in:
|
|
For example, the following configuration makes systemd-logind ignore the
power button:
|
|
Other available actions include:
poweroffrebootsuspendhibernateignorelock
The available directives include HandlePowerKey, HandleSuspendKey,
HandleHibernateKey and HandleLidSwitch.
Desktop environments may also manage some power events. Avoid configuring
conflicting actions in both the desktop environment and systemd-logind.
Troubleshooting
System Does Not Suspend
Check the available kernel sleep states:
|
|
Inspect system logs for errors:
|
|
You can also inspect the systemd sleep service logs:
|
|
Check whether an application or service is preventing the system from
suspending:
|
|
System Does Not Resume Correctly
Resume problems are often related to firmware, kernel drivers or hardware
compatibility.
Inspect the previous boot’s kernel messages after restarting the computer:
|
|
Look for errors involving ACPI, graphics drivers, USB devices or storage.
Battery Drains Quickly During Suspend
Some systems use suspend-to-idle (s2idle) rather than deeper suspend
states. Depending on the hardware, this can result in higher power
consumption while suspended.
Inspect the currently selected mode:
|
|
Do not force a different suspend mode without checking hardware and
firmware support. An unsupported mode can prevent the system from
suspending or resuming correctly.
Hibernation Is Not Available
Hibernation requires more than a swap partition or swap file.
Check the following:
- The kernel supports hibernation.
- Sufficient persistent swap space is available.
- The initramfs contains the required resume support.
- The resume configuration points to the correct swap device or file.
- The storage and encryption configuration supports resume.
Refer to the Gentoo documentation below for the complete configuration
requirements.
Further Reading
- Gentoo Wiki: Power Management
- Gentoo Wiki: Suspend and Hibernate
- systemd-sleep.conf
- systemd-logind.conf
man systemctlman systemd-sleepman logind.conf