Gentoo Wiki




Despite my best searching, the documentation out there for setting up APM suspend seems to be pretty minimal. I realize that ACPI is the new standard, but the code and drivers out there still seem to be in the developing stages. Here goes. I used an IBM Thinkpad 600x for this, but it should be pretty generic as long as your computer's bios supports APM.

Compile APM into your kernel

Make sure your /usr/src/linux symlink points to your kernel source folder, and run make menuconfig in there.

Linux Kernel Configuration: enabling APM
Power management options (ACPI, APM)  --->
  [*] Power Management support
ACPI (Advanced Configuration and Power Interface) Support  --->
  [ ] ACPI Support
APM (Advanced Power Management) BIOS Support  --->
  <*> APM (Advanced Power Management) BIOS support
    [ ]   Ignore USER SUSPEND
    [*]   Enable PM at boot time
    [*]   Make CPU Idle calls when idle
    [ ]   Enable console blanking using APM
    [ ]   RTC stores time in GMT
    [ ]   Allow interrupts during APM BIOS calls
    [ ]   Use real mode APM BIOS call to power off

Then save and exit.

You may have to change one or more of the APM options to make things work correctly, but this should give you the best default power management using APM. If you have problems suspending later on, try a different kernel configuration to see if it works.

Next, compile and copy your new kernel into /boot (done with 2.6 kernel, check handbook for 2.4 commands)

# make bzImage modules modules_install
# mount /boot
# cp arch/i386/boot/bzImage /boot/kernel-2.x.y
# cp /boot/
# rm /boot/
# ln -s /boot/ /boot/

now before you unmount /boot, run

# nano -w /boot/grub/grub.conf

and add the parameter apm=on acpi=off to your kernel parameters. The code is the same for lilo, just a different file. Once you are done with this part, you can unmount /boot and reboot with your new apm-ready kernel!

Emerge and Test apmd

apmd is a daemon that handles apm requests, basically, the thing that allows you to tell the computer to suspend. Emerging is pretty straightforward, run

# emerge apmd

Now you want to start apmd and use rc-update to make it run at boot

# /etc/init.d/apmd start
# rc-update add apmd default

Configuration shouldn't take much as long as you have apm support in your kernel. To test that apm works, you should be able to do the following: To see information about AC status and battery info

# apm

To standby (on my system just turns the monitor off)

# apm -S

To suspend (the real goal of this howto)

# apm -s

If these commands don't work, go back to Step 1 and check out the kernel options. Some computers have weird BIOS's that linux has ways around using the different options. Otherwise, continue on.

Configure apmd Events

You may notice after suspending that your network card or sound stops functioning. Fortunately, apmd has a way around this, using scripts placed in /etc/apm/resume.d/ for resume scripts after it is out of sleep mode and /etc/apm/suspend.d/ for scripts that are executed when you go to sleep mode. They are executed every time the system suspends/resumes. Here are the scripts in my resume.d and suspend.d directory, you can add your own if you have other things you would like run on suspend/resume:

File: /etc/apm/resume.d/resume
   /etc/init.d/alsasound start
   /etc/init.d/hotplug start
   /sbin/cardctl insert
File: /etc/apm/suspend.d/suspend
   /etc/init.d/alsasound stop
   /etc/init.d/hotplug stop
   /sbin/cardctl eject

The pcmcia script will cause any pcmcia cards to be reloaded (network cards, etc). It is like pulling the card out of the slot and reinserting it.

Make sure that for each script you make it executable using chmod +x scriptname.

Now when you run apm -s you should have sound, usb, pcmcia working when you resume. You can check the output of dmesg and it should have some info about things that have been restarted. That's it!

See Also

Retrieved from ""

Last modified: Mon, 25 Aug 2008 06:12:00 +0000 Hits: 34,174