Too many connections Howto install ACPI under Linux
Howto ACPI

Author : Sylvestre Ledru (questions, comments, do not hesitate ...)
Version francaise
Return to the linux page
If you like this howto and you want to thank me for my work : here is my wishlist on Amazon - France or my Amazon US wishlist :)
If you are a corporation and you make some business thanks to my howto, we'll love to have a present from you (or just tell me who is using my howto).

New (25/08/2003), Kernel :
Since the new kernel (2.4.22), this ACPI patch is by default included in it.
New (08/11/2003), suspend / hibernate :
I finaly successed to install and configure the suspend mode !

What is ACPI ?
ACPI is a quite old technology but it is pretty badly supported by the officiel Kernel. ACPI is developped by a consortium of few corporation like Intel, compaq, IBM ... The aim of the technology is to provide a remplacement for APM.
It is very usefull on laptops (power management, temperature ...).
Unfortunately, specifications are not very well followed by constructors, so, developments are quite difficult.

How install ACPI ?

First, visit the opensource website ( and download the appropriate version for your kernel.
For example, I have a 2.4.20 kernel. So, I will download this file : acpi-20021212-2.4.20.diff.gz which provides an update for the official kernel (ACPI in the official kernel used to suck).

I suppose that you have the sources of the kernel in the /usr/src/linux directory.
We have to patch the kernel (don't worry, it is very easy) :
# cd /usr/src/linux
# wget http://url/acpi-20021212-2.4.20.diff.gz
# gunzip acpi-20021212-2.4.20.diff.gz
# patch -p1 < acpi-20021212-2.4.20.diff
it will patch the kernel.

A new option in the kernel menu will appear in 'General Setup' :
'ACPI support'.
In the menu, you can add these options :
AC Adapter, Battery, Button, Fan, Processor, Thermal Zone.
But sometime, the BIOS doesn't support these options.
Select what you need (as module or as static), recompile your kernel, install it and reboot.

Now, your kernel supports ACPI, but you need to install a program in order to 'manage' ACPI.
Under Debian, apt-get install acpid should be enought.

You should have some files in the /proc/acpi directory like /proc/acpi/info.
If you don't have the file, there is an error (so, check if you made any mistakes). Otherwise, ACPI should work fine on your computer.
For example, cat /proc/acpi/battery/BAT1/state gives me (when my laptop is plugged) (here, it is BAT1 but sometimes it is BAT0) :
present: yes
capacity state: ok
charging state: unknown
present rate: 0 mA
remaining capacity: 4192 mAh
present voltage: 16736 mV

It is also possible to get more informations like in /proc/acpi/battery/BAT1/info :
present: yes
design capacity: 4400 mAh
last full capacity: 4192 mAh
battery technology: rechargeable
design voltage: 14800 mV
design capacity warning: 300 mAh
design capacity low: 200 mAh
capacity granularity 1: 32 mAh
capacity granularity 2: 32 mAh
model number: 00 00 00 00
serial number: 30 00 00 00 00 00 00 00 00
battery type: 00 00 00 00
OEM info: 00 00 00 00

If you want a more friendly user interface than cat or less, you can install acpi (apt-get install acpi) which is a client.
For example, at the moment, on my laptop, acpi provides theses informations :

[11:39:58][sly@reloaded] /proc/acpi$ acpi -V
Battery 1: discharging, 82%, 01:56:53 remaining
Thermal 1: ok, 43.0 degrees C
AC Adapter 1: off-line

It exists a gkrellm plugin called gkacpi. It is quite bugged because of the lack of standardisation with ACPI but the source code (C) is quite easy to understand.

Suspend / Hibernate mode :
Thanks to Jan's Linux Log, I just successed to enable the suspend computer mode !! This means that I can press the power button to stop the computer and press again to restore my session and everything !! Great stuff !!
In order to get that stuff :
You have to patch your kernel with swsup (Software Suspend For Linux) :

cd /usr/src/
bunzip2 swsusp-2.0-rc2-whole.bz2
cd linux
patch -p1 < ../swsusp-2.0-rc2-whole

Unselect the SMP option (in Processor type and features), select Software Suspend and Relaxed /proc/swsusp permissions (in General Setup), select Enhanced Real Time Clock Support (in Character devices). Recompile your kernel and install it.
You have to specify also in your Linux Loader (lilo or grub) the name of the swap partition where will be stored the image :
for example, with lilo, it will be :


(change 7 for your configuration).
Download the script on the same website as the patch (This script is called suspend-script) and install it (./ --install as root). This script will add some stuff regarding to your linux distribution (it manages at least Suse, Mandrake, Debian, Redhat, Gentoo and Slackware).
Edit the /etc/suspend.conf file and change SWSUSP_FORCE_SUSPEND_MODE="0" to SWSUSP_FORCE_SUSPEND_MODE="acpi"
If you successed to install everything, you should have your laptop suspended by executing /usr/local/sbin/hibernate.
You can make your own "shortcut" : if you press the power button, it will hibernate your computer. Edit the /etc/acpi/events/power file and add in it :

event=button[ /]power
action=sudo /usr/local/sbin/hibernate

And configure your sudo :

Host_Alias LOCALHOST=localhost,yourhost
ALL LOCALHOST=NOPASSWD: /usr/local/sbin/hibernate *

And it should work !!

Access denied for user 'sylvestre'@'localhost' (using password: NO)
Comment closed because of the spam