Power management: Difference between revisions

From Alpine Linux
m (Prabuanand moved page Configure action when power-button is pressed to Power management: To consolidate all information related to power management to single page)
(reformatted the page so that more content can be added)
Line 1: Line 1:
This article explains how to configure what happens when you press the power button. This might be useful to allow for desktop environments to control what happens instead of shutting down.
[https://en.wikipedia.org/wiki/Power_management Power management] is a feature of computer CPUs, GPUs and peripherals such as monitors and printers, that turns off the power or switches the system to a low-power state when inactive based on a standard called ACPI, which has superseded APM. This page explains how to configure what happens  


# Install {{pkg|acpid}}: {{cmd|# apk add acpid}}
== Installation ==
# Enable and start the acpid daemon: {{cmd|# rc-update add acpid && rc-service acpid start}}


== Busybox acpid ==
Install the {{pkg|acpid}} package:{{cmd|# apk add acpid}}


This can be done via [[Busybox acpid]] by creating/modifying the hook in {{path|/etc/acpi/PWRF/00000080}}.
=== Power management utilities ===


=== Configuring for shutdown ===
There are a number of power management utilities available in Alpine Linux.
In a newly installed system this might be already defined, however you can create the hook as follows:


{{cat|/etc/acpi/PWRF/00000080|#!/bin/sh
* {{pkg|zzz}}
 
== Service configuration ==
 
Enable and start the {{ic|acpid}} daemon using the [[OpenRC]] commands:{{cmd|# rc-update add acpid && rc-service acpid start}}
 
== Handling the pressing of power button ==
 
In case of desktop environments, it might be useful to allow for some control on what happens when you press the power button instead of shutting down the computer. This can be done via [[Busybox#acpid]] by creating/modifying the hook in {{path|/etc/acpi/PWRF/00000080}}.
 
=== Configuring for shutdown ===
 
In a newly installed system this might be already defined, however you can create the hook as follows: {{cat|/etc/acpi/PWRF/00000080|#!/bin/sh
poweroff}}
poweroff}}


=== Configuring for sleep ===  
=== Configuring for sleep ===


# Install {{pkg|zzz}}: {{cmd|# apk add zzz}}
Use one of the [[#Power management utilities|power management utility]], say {{pkg|zzz}} here and Modify the hook as follows: {{cat|/etc/acpi/PWRF/00000080|#!/bin/sh
# Modify the hook as follows: {{cat|/etc/acpi/PWRF/00000080|#!/bin/sh
zzz}}
zzz}}


=== Disabling ===  
=== Disabling ===
 
To disable simply comment or remove the hook. This is useful to allow desktop environments to handle the power button.


{{cat|/etc/acpi/PWRF/00000080|#!/bin/sh
To disable simply comment or remove the hook. This is useful to allow desktop environments like [[Gnome]] or [[KDE]] to handle the power button. {{cat|/etc/acpi/PWRF/00000080|#!/bin/sh
#Nothing}}
#Nothing}}


[[Category:Power Management]]
[[Category:Power Management]]
[[category: Desktop]]

Revision as of 14:06, 2 May 2025

Power management is a feature of computer CPUs, GPUs and peripherals such as monitors and printers, that turns off the power or switches the system to a low-power state when inactive based on a standard called ACPI, which has superseded APM. This page explains how to configure what happens

Installation

Install the acpid package:

# apk add acpid

Power management utilities

There are a number of power management utilities available in Alpine Linux.

Service configuration

Enable and start the acpid daemon using the OpenRC commands:

# rc-update add acpid && rc-service acpid start

Handling the pressing of power button

In case of desktop environments, it might be useful to allow for some control on what happens when you press the power button instead of shutting down the computer. This can be done via Busybox#acpid by creating/modifying the hook in /etc/acpi/PWRF/00000080.

Configuring for shutdown

In a newly installed system this might be already defined, however you can create the hook as follows:

Contents of /etc/acpi/PWRF/00000080

#!/bin/sh poweroff

Configuring for sleep

Use one of the power management utility, say zzz here and Modify the hook as follows:

Contents of /etc/acpi/PWRF/00000080

#!/bin/sh zzz

Disabling

To disable simply comment or remove the hook. This is useful to allow desktop environments like Gnome or KDE to handle the power button.

Contents of /etc/acpi/PWRF/00000080

#!/bin/sh #Nothing