From the Battery-Powered-mini-HOWTO " .. for APM to work on any notebook or energy-conscious desktop, the system BIOS ROM in the machine must support the APM Specification standard. Furthermore, for APM to work with the Linux operating system, the system BIOS ROM must support either the 1.0 or 1.1 version of the APM standard, and it must also support 32-bit protected mode connections. A system that supports APM 1.1 is preferred, as it provides more features that the device driver and supporting utilities can take advantage of."
You may get information about the APM version with the dmesg command and in the /proc/apm file.
Features of APM appropriate to Documentation/Configure.help: "The system time will be reset after a USER RESUME operation, the /proc/apm device will provide battery status information, and user-space programs will receive notification of APM events (e.g., battery status change). "
APM support consists of two parts: kernel support and user-land support.
For kernel support, enable the parameters in the corresponding kernel section. Some features need special tweaking with certain machines (e.g. IBM™ ThinkPad) or even don't work, ("TI 4000M TravelMate and the ACER 486/DX4/75 because they don't have compliant BIOSes"). Currently all distributions I know don't provide a kernel with APM support enabled. So you usually have to compile your custom kernel. Please see Kernel-HOWTO or distribution manual for details. The available APM options are (please see Documentation/Configure.help in the kernel source tree for more details):
CONFIG_APM_IGNORE_USER_SUSPEND Just a workaround for some NEC Versa M series laptops.
CONFIG_APM_DO_ENABLE Enable APM features at boot time.
CONFIG_APM_CPU_IDLE. Puts CPU in power save mode, if there is nothing to do for the kernel.
CONFIG_APM_DISPLAY_BLANK Some laptops can use this to turn off the LCD backlight when the screen blanker of the Linux virtual console blanks the screen. Note that this is only used by the virtual console screen blanker, and won't turn off the backlight when using the X Window system.
CONFIG_APM_POWER_OFF Turns the machine completely down, when using halt. This feature works with most laptops without problems.
CONFIG_APM_IGNORE_MULTIPLE_SUSPEND Just a workaround for IBM™ ThinkPad 560.
CONFIG_APM_IGNORE_SUSPEND_BOUNCE Just a workaround for Dell Inspiron 3200 and other notebooks.
CONFIG_APM_RTC_IS_GMT Stores time in Greenwich Mean Time format. It is in fact recommended to store GMT in your real time clock (RTC) in the BIOS.
CONFIG_APM_ALLOW_INTS Resolves some problems with Suspend to Disk for some laptops, for instance many newer IBM™ ThinkPads.
Joey Hess <firstname.lastname@example.org> wrote at <email@example.com> "I just installed kernel 2.2.12 on my laptop, and was having some trouble getting apm working. it said apm disabled on user request at boot time. Well, some grepping the kernel sources found that passing apm=on to the kernel at boot time enables it now. I can't find any record or docs of this change.
The utilities for userland support may be found at http://worldvisions.ca/~apenwarr/apmd/. APMD is a set of programs that control the Advanced Power Management system found in most modern laptop computers. If you run a 2.2.x kernel and want to experiment, Gabor Kuti <firstname.lastname@example.org> has made a kernel patch that allows you to hibernate any Linux system to disk, even if your computers APM BIOS doesn't support it directly. in my humble opinion you don't need this features if your laptop provides a function key to invoke suspend mode directly.
When you first install Linux, you will probably have to recompile the kernel. The kernel that came with your distribution probably does not have APM enabled.
README apmd?:On laptop computers, the APM support provides access to battery status information and may help you to conserve battery power, depending on your laptop and the APM implementation.
Rik Faith <email@example.com> has transferred maintenance of the Linux apmd package over to me, Avery Pennarun <firstname.lastname@example.org> and I'm finally getting around to making a release with the many updates we've collected since the last release back in 1996.
Here's what apmd can do:
apmd(8): logs the battery status to syslog every now and then and handles background power management tasks;
apm(1): a command-line tool to print the current battery status or suspend the computer;
xapm(1x): provides a battery meter for X11;
libapm.a: a library for writing similar APM applications.
Richard Gooch wrote: I'have had a look at the beta version of apmd, and I still don't like it, because:
Only supports one command to run at suspend time.
Doesn't distinguish between user and system suspends.
doesn't provide a way to disable policy (the sync(); sleep(0) ; sync(); sleep(1); sequence)
Does not document extra features.
And I'm not sure that what we want is a single super daemon. A collection of smaller daemons might be better, since it allows people to pick and choose. A super daemon is bloat for those who only want one small feature.
Though this topic was discussed controversly Richard Gooch has put together a package suspendd at http://www.atnf.csiro.au/~rgooch/linux/ .
Note: I didn't check whether this features are merged into one package (apmd eventually) already.
If you have another operating system preinstalled or use another operating system at the same disk, make sure there is no "hibernation" or "suspend" tool installed, which could severely interfere with Linux, e.g. it might use disk space which is occupied by Linux or vice versa.
If your machine worked with 2.0.x kernels but not with the 2.2.x series, take this advice from Klaus Franken email@example.com : "The default changed in 2.2. Search in the init-scripts for halt and change it to halt -p or poweroff. See man halt , if you don't have this option you need a newer version of halt." You may find it in the SysVinit package.
On some new machines (for instance HP Omnibook 4150 - 366 MHz model) when accessing /proc/apm, you may get a kernel fault general protection fault: f000. Stephen Rothwell explaines: "This is your APM BIOS attempting to use a real mode segment while in protected mode, i.e. it is a bug in your BIOS. .. We have seen a few of these recently, except all the others are in the power off code in the BIOS where we can work around it by returning to real mode before attempting to power off. Here we cannot do this."
apmd-rhcn-2.4phil-1 by RedHat ftp://rhcn.redhat.com/pub/rhcn/ contains an unofficial patch for shutting down the PCMCIA sockets before a suspend and patches for multiple batteries.
Appropriate to Documentation/Configure.help: "Some other things you should try when experiencing seemingly random, weird problems:
make sure that you have enough swap space and that it is enabled.
pass the no-hlt option to the kernel.
switch on floating point emulation in the kernel and pass the no387 option to the kernel.
pass the floppy=nodma option to the kernel.
pass the mem=4M option to the kernel (thereby disabling all but the first 4 MB of RAM).
make sure that the CPU is not over clocked.
read the sig11 FAQ at http://www.bitwizard.nl/sig11/ .
disable the cache from your BIOS settings.
install a fan for the video card or exchange video RAM.
install a better fan for the CPU.
exchange RAM chips.
exchange the motherboard.
PCMCIA Card Services and Advanced Power Management (from the PCMCIA-HOWTO):
"Card Services can be compiled with support for APM (Advanced Power Management) if you've configured your kernel with APM support. ... The PCMCIA modules will automatically be configured for APM if a compatible version is detected on your system. Whether or not APM is configured, you can use cardctl suspend before suspending your laptop, and cardctl resume after resuming, to cleanly shut down and restart your PCMCIA cards. This will not work with a modem that is in use, because the serial driver isn't able to save and restore the modem operating parameters. APM seems to be unstable on some systems. If you experience trouble with APM and PCMCIA on your system, try to narrow down the problem to one package or the other before reporting a bug. Some drivers, notably the PCMCIA SCSI drivers, cannot recover from a suspend/resume cycle. When using a PCMCIA SCSI card, always use cardctl eject prior to suspending the system.".
"Many (most?) BIOSes fail to save and restore display controller chip registers, and X11 has no protocol to be notified of resume events, so on many systems suspend/resume is more-or-less incompatible with X11. " Linux Laptops has created a fix for this problem.
Sometimes X Windows and APM don't work smoothly together, the machine might even hang. A recommendation from Steve Rader: Some linux systems have their X11 server hang when doing apm -s. Folks with this affliction might want switch to the console virtual terminal then suspend chvt 1; apm -s as root, or, more appropiately sudo chvt 1; sudo apm -s. I have these commands in a script, say, my-suspend and then do xapmload --click-command my-suspend .
As far as I remember this is controversly discussed, but I don't remember the URL. Recently it became a kernel feature. Therefore there are some new options for LILO, e.g. apm=on/off. Couldn't check this in detail yet.
The new 3.0beta versions add a new feature to apmd: it can run arbitrary commands (like cardctl suspend) when you suspend or resume your system. It also supports BIOS clocks that are set to UTC time.
Lots of BIOSes fail to restore sound chip registers, so you may get a squeal of feedback when you wake up the machine. A script in /etc/apm/event.d can use aumix to save and restore sound mixer settings.
From the man page: Some computers, especially laptops, can wake-up from a low-power suspend to DRAM mode using the Real-time-clock (RTC) chip. Apmsleep can be used to set the alarm time in the RTC and to go into suspend or standby mode. An interrupt from the RTC causes the computer to wake-up. The program detects this event, by waiting for a leap in the kernel time and terminates successfully. If no time leap occurs within one minute, or something goes wrong, the exit value will be non-zero. Apmsleep is part of the apmd package.
Software suspend enables the possibility of suspending a machine. It doesn't need APM. You may suspend your machine by either pressing Sysrq-d or with swsusp or shutdown -z (patch for sysvinit needed). It creates an image which is saved in your active swaps. By the next booting the kernel detects the saved image, restores the memory from it and then it continues to run as before you've suspended. If you don't want the previous state to continue use the noresume kernel option.
Software suspends may even be better than hibernate, because now I can suspend my Linux system, boot into Microsoft Windows, perform a few illegal operations and be shut down, and then restart my Linux setup exactly where I left off! This is something that cannot be done with hibernation, since that always restores the last state that you suspended from, be it Microsoft Windows or Linux. So if I want to switch to Microsoft Windows to play games or do anything else, I can leave my Linux desktop exactly as it is and return to how I left it.