## 67.2 APM Advanced Power Management

{#sec:apm}

Advanced power management (APM) is supported by the kernel\footnote{Current Debian kernels have CONFIG_APM as a module but CONFIG_APM_DO_ENABLE is not set.} but because some older machines have problems with it some Debian kernels have it turned off by default. Thus, when you poweroff your machine (e.g., by poweroff) the machine does not automatically power down.

To turn on apm, if apm is compiled into the kernel (i.e., not a module) then simply add the following to the kernel configuration (often in /etc/lilo/conf, assuming you are using lilo to boot your machine):

  append="apm=on apm=power-off"

If you have apm as a module then use the following when you load the module:

  # modprobe apm power_off=1

Or for a more persistent approach add the following line to /etc/modules:

  apm power_off=1

Some relevant kernel configurations are:

  CONFIG_APM=y
CONFIG_APM_DO_ENABLE=y
CONFIG_APM_CPU_IDLE=y
CONFIG_APM_DISPLAY_BLANK=y
CONFIG_APM_RTC_IS_GMT=y
CONFIG_APM_IGNORE_MULTIPLE_SUSPEND=y
CONFIG_APM_IGNORE_SUSPEND_BOUNCE=y

This configuration allows, for example, the suspend feature to function on laptops (so that when you close the laptop lid the OS suspends). The laptop will beep then turn itself off. Simply open the laptop lid to resume. This works for both console logins and X sessions.

You can also eject the laptop from a docking station to achieve the same effect. When the laptop lid is opened, or the laptop is inserted back into a docking station, the system resumes. It seems advisable to do this only when in console mode (that is, not while you have an X session running - it’s not quite there for X sessions yet).

It is also suggested to install the apmd package which provides the apm command. This produces a more human readable output than a simple cat /proc/apm and can suspend your laptop from the command line:

  # apm
AC off-line, battery status high: 56% (2:27)
# apm -s

A suspend while connected to power within a docking station does not seem to suspend the machine completely. It sends it to sleep but it does not beep and power down.

Some useful commands related to rebooting are:

  # poweroff              (shutdown and turn off the computer)
# reboot                (shutdown and reboot the computer)

After installing the apmd package the suspend maintains the clock correctly between a suspend and a resume. (Although I seem to be losing a few seconds each time.)

Note that a suspend will disconnect your modem!

PROBLEMS When you eject the laptop from a docking station while running an X session it does not come back properly when the laptop is reinserted into a docking station. Sometimes the display is half off the screen. Sometimes simply get streaks across the screen. If this happens, you can go back to a console as usual with CTRL-ALT-F1, or exit from the X session with CTRL-ALT-BACKSPACE. If you eject while running an X session and open the laptop lid you will not get the proper display, and may damage the display. It can also freeze the laptop.

Suspend maintains RAM with the battery. Hibernate saves everything to disk. Standby powers down disks and the lcd display.

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0