PDA

View Full Version : ACPI it's not just for laptops.



rickenbacherus
08-12-2003, 04:32 AM
Does your laptop need ACPI becasue it overheats? Tired of using a power strip to shut down your desktop becasue it won't power down correctly with APM? ACPI might just be your answer. It should be noted that ACPI does not work on all machines.
This is the easiest way I know of to get acpi working.
First you need an acpi patched kernel.. Oh No! you say- I Don't know how to build an acpi patched kernel. Not to worry. Thanks to the excellent efforts of Kano this couldn't possibly be any easier. It's already built!- you just have to install it and that's easier than falling off a dead horse. You can get the kernel and install scripts here:

http://debian.tu-bs.de/knoppix/Kano

For laptop owners get the kernel-2.4.21-acpi.zip . For desktop owners get the kernel-2.4.21-ck3.zip . Everything you need is in the .zip file.

Make a new directory to unzip all of this into unless you want an entire herd of files floating around.
mkdir newkernel
Become root:
su
<password>
Download your kernel.zip into your newly created directory.
cd newkernel
unzip kernel-2.4.21-acpi.zip

*NOTE* Before continuing you should do uname -r . if you have a 2.4.20-xfs kernel then no changes are necessary. If you have 2.4.21-xfs then you need to either edit the next to last line of ./install-kernel-knoppix.sh to reflect your kernel version. It should look like this after editing:

ln -sf boot/vmlinuz-2.4.21-xfs /vmlinuz.old

or give this command in the newkernel directory:

perl -pi -e 's/2.4.20-xfs/2.4.21-xfs/' install-kernel-knoppix.sh

Now, on with the show.....

./install-kernel-knoppix.sh
cd /boot
ls

You should see a new symlink called vmlinuz
ls -al vmlinuz
lrwxrwxrwx 1 root root 19 Aug 2 06:07 vmlinuz -> vmlinuz-2.4.21-acpi

or... if you installed 2.4.21-ck3:
lrwxrwxrwx 1 root root 18 Aug 15 21:27 vmlinuz -> vmlinuz-2.4.21-ck3

Yes! The new kernel is installed.

Now you need to edit LILO.
sudo xedit /etc/lilo.conf
(of course you may use any editor that you prefer).

The installation script linked your original kernel to LinuxOLD and you no longer need to use initrd! So, you need to move initrd to LinuxOLD. Here is an example for the new LILO entry for the new vmlinuz kernel and an example of what vmlinuz.old should look like:

default=Linux
image=/boot/vmlinuz
label=Linux
read-only

image=/vmlinuz.old
label=LinuxOLD
initrd=/boot/initrd.gz

This way you can still boot your old kernel by selecting LinuxOLD. In fact-you could copy/paste the above and comment (add a '#' to the front of) the other kernel entries if you like.
After everything looks right in LILO you need to run it.

/sbin/lilo

It should return
Added Linux
Added LinuxOLD

Of course if there were any errors you'll need to fix them and rerun LILO.

*NOTE* According to the acpi documentation if you have problems with acpi it may be necessary to add the following to the append="" line in /etc/lilo.conf:
acpi=off

reboot
uname -r
*If you don't see 2.4.21-acpi (or 2.4.21-ck3)then you did not boot the new kernel. Go back and fix lilo.*
cd newkernel

Become root.
If you installed kernel-2.4.21-acpi then do the following:
./install-acpi-modules.sh | tee acpi.log

If you've installed kernel-2.4.21-ck3 then do this:
./install-ospm-modules.sh | tee acpi.log

That's the only difference in installation procedures for the two kernels.

You should now have a file called acpi.log in your newkernel directory. Have a look at it- see what installed. *Note that not every machine will support every option. When viewing the acpi.log the message NOT WORKING should not necessarily be determined as a failed installation.*

apt-get remove --purge apmd
apt-get install acpid

If you installed 2.4.21-acpi you can also do this:
apt-get install acpi

That's it!

Now you should be able to determine some info about your hardware.

acpi -V

Should return something like so:
Battery 1: unknown, 100%
Thermal 1: ok, 62.0 degrees C
AC Adapter 1: on-line

That's with the ac adapter plugged in of course. :)

cat /proc/acpi/info
version: 20030619
states: S0 S1 S3 S4 (swsusp) S5

cat /proc/acpi/battery/BAT1/info
present: yes
design capacity: 3600 mAh
last full capacity: 3031 mAh
battery technology: rechargeable
design voltage: 10800 mV
design capacity warning: 61 mAh
design capacity low: 0 mAh
capacity granularity 1: 36 mAh
capacity granularity 2: 36 mAh
model number: P71048002110
serial number: 1600242472
battery type: Li-ION
OEM info:

Is this cool or what?? Go ahead and cd /proc/acpi and have a look around. Different systems will support different options. This is really only the beginning as acpi is a rather broad subject. Unfortunately the standards for acpi are not strictly adhered to.

This kernel also has the swsusp patch (software suspend) since suspend isn't supported in the Linux kernel this is an alternative wat to use suspend. The documentation can be found here:
/usr/share/doc/kernel-doc-2.4.21-acpi/Documentation/swsusp.txt.gz

http://swsusp.sourceforge.net/

If you're using KDE then you can set up acpi from the Control Center>Power Control>Laptop Battery. Additionally you may choose to have an icon in your system tray indicating the charge state of your battery. By right clicking the icon you can also set up acpi. Be aware that acpi doesn't work on every machine. Fortunately Kano was also kind enough to include scripts to uninstall the kernel and acpi patch.

Commands you can issue to put your machine into various sleep states:
http://acpi.sourceforge.net/documentation/sleep.html

ACPI documentation can be found here:
/usr/share/doc/kernel-doc-2.4.21-acpi

ACPI project page:
http://acpi.sourceforge.net/

Great girlgeek doc:
http://xtrinsic.com/geek/articles/acpi.phtml

Tuxmobil:
http://tuxmobil.org/apm_linux.html

http://www.cpqlinux.com/acpi-howto.html

If you have any tips/tricks experiences or otherwise for ACPI in Linux please feel free to add them here.

*** No wimpdoze users were harmed either emotionally or physically during the installation of this bitchin' kernel.*** ;)

psoares
08-12-2003, 05:29 PM
Hi there!

After trying other solutions (compile a new kernel, etc.) I followed your instructions on a Compaq Presario 700. All went fine but now it just doesnt boot with no error messages.

What shall I do to revert to the old kernel? Can anyone help me here?
I don't have a lot of experience so I need rather precise hints.

TIA

Paulo Soares

rickenbacherus
08-12-2003, 05:51 PM
Well, you can always boot Knoppix cd and fix your install from there. Here's a post on how to fix lilo with Knoppix cd here (http://www.knoppix.net/forum/viewtopic.php?t=4097#19170). Do you still get the prompt to select your os or does it just boot without offering you a choice? You should still be able to select LinuxOLD and boot your old kernel.

psoares
08-12-2003, 06:20 PM
Thank you. With your suggestion I was able to fix it.

Do you have any idea why the new kernel failed to boot in this machine?

rickenbacherus
08-12-2003, 07:32 PM
Do this:

cd /boot
ls

You should have a symlink called vmlinuz. Do this:

ls -al vmlinuz
It should tell you this:
lrwxrwxrwx 1 root root 19 Aug 2 06:07 vmlinuz -> vmlinuz-2.4.21-acpi
(I presume you are using the laptop kernel).

When you boot do you get the option to choose from Linux and LinuxOLD? If so, when you select Linux what happens? Nothing at all?

What does acpi.log tell you?

psoares
08-12-2003, 10:50 PM
Thanks for your help.

The answer to all your questions is Yes except to the last one. When I choose Linux at the boot menu nothing happens and I get a blank screen.

Note that I followed the instructions carefully and there were no errors reported.

I didn't get to install the acpi-modules because I couldn't reboot with the new kernel. So there is no acpi.log.

rickenbacherus
08-12-2003, 11:38 PM
Let's see /etc/lilo.conf although I don't think that's the problem. My only suggestion is to use the script that you downloaded with the kernel and uninstall the kernel and try again.

psoares
08-13-2003, 01:29 PM
I followed your suggestion but the problem remains. Here it is /etc/lilo.conf.

vga=791
# /etc/lilo.conf - See: `lilo(8)' and `lilo.conf(5)',
# --------------- `install-mbr(8)', `/usr/share/doc/lilo/',
# and `/usr/share/doc/mbr/'.

# +---------------------------------------------------------------+
# | !! Reminder !! |
# | |
# | Don't forget to run `lilo' after you make changes to this |
# | conffile, `/boot/bootmess.txt', or install a new kernel. The |
# | computer will most likely fail to boot if a kernel-image |
# | post-install script or you don't remember to run `lilo'. |
# | |
# +---------------------------------------------------------------+

# Support LBA for large hard disks.
#
lba32

# Overrides the default mapping between harddisk names and the BIOS'
# harddisk order. Use with caution.
#disk=/dev/hde
# bios=0x81

#disk=/dev/sda
# bios=0x80

# Specifies the boot device. This is where Lilo installs its boot
# block. It can be either a partition, or the raw device, in which
# case it installs in the MBR, and will overwrite the current MBR.
#
boot=/dev/hda

# Specifies the device that should be mounted as root. (`/')
#
root=/dev/hda1

# Enable map compaction:
# Tries to merge read requests for adjacent sectors into a single
# read request. This drastically reduces load time and keeps the
# map smaller. Using `compact' is especially recommended when
# booting from a floppy disk. It is disabled here by default
# because it doesn't always work.
#
# compact

# Installs the specified file as the new boot sector
# You have the choice between: bmp, compat, menu and text
# Look in /boot/ and in lilo.conf(5) manpage for details
#
install=/boot/boot-menu.b

# Specifies the location of the map file
#
map=/boot/map

# You can set a password here, and uncomment the `restricted' lines
# in the image definitions below to make it so that a password must
# be typed to boot anything but a default configuration. If a
# command line is given, other than one specified by an `append'
# statement in `lilo.conf', the password will be required, but a
# standard default boot will not require one.
#
# This will, for instance, prevent anyone with access to the
# console from booting with something like `Linux init=/bin/sh',
# and thus becoming `root' without proper authorization.
#
# Note that if you really need this type of security, you will
# likely also want to use `install-mbr' to reconfigure the MBR
# program, as well as set up your BIOS to disallow booting from
# removable disk or CD-ROM, then put a password on getting into the
# BIOS configuration as well. Please RTFM `install-mbr(8)'.
#
# password=tatercounter2000

# Specifies the number of deciseconds (0.1 seconds) LILO should
# wait before booting the first image.
#
delay=100

# You can put a customized boot message up if you like. If you use
# `prompt', and this computer may need to reboot unattended, you
# must specify a `timeout', or it will sit there forever waiting
# for a keypress. `single-key' goes with the `alias' lines in the
# `image' configurations below. eg: You can press `1' to boot
# `Linux', `2' to boot `LinuxOLD', if you uncomment the `alias'.
#
# message=/boot/bootmess.txt
# prompt
# single-key
# delay=100
# timeout=100

# Kernel command line options that apply to all installed images go
# here. See: The `boot-prompt-HOWO' and `kernel-parameters.txt' in
# the Linux kernel `Documentation' directory.
#
# append=""
append="hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi hdf=scsi hdg=scsi hdh=scsi apm=power-off nomce"

# Boot up Linux by default.
#
default=Linux

image=/boot/vmlinuz
label=LinuxNEW
read-only
# restricted
# alias=1

image=/vmlinuz.old
label=Linux
initrd=/boot/initrd.gz
read-only
optional
# restricted
# alias=2

# If you have another OS on this machine to boot, you can uncomment the
# following lines, changing the device name on the `other' line to
# where your other OS' partition is.
#
# other=/dev/hda4
# label=HURD
# restricted
# alias=3

rickenbacherus
08-13-2003, 05:49 PM
Try changing LILO to read as I have added in bold. Then , once you get it to boot properly you can change the labels for each kernel if you want to.

Change this....


# Boot up Linux by default.
#
default=Linux

image=/boot/vmlinuz
label=LinuxNEW
read-only
# restricted
# alias=1

To this:

default=Linux
image=/boot/vmlinuz
label=Linux
read-only

And change this:


image=/vmlinuz.old
label=Linux
initrd=/boot/initrd.gz
read-only
optional

To this:

image=/vmlinuz.old
label=LinuxOLD
initrd=/boot/initrd.gz

psoares
08-13-2003, 11:45 PM
Sorry, no good. You have been very helpful but it looks like something else is wrong.

I know acpi is supported in this laptop (Compaq Presario 700) with the kernel 2.4.20. I read somewhere that kernel 2.4.21 was sometimes problematic. It may be this the case.

Thanks again.

Paulo Soares

JockVSJock
08-17-2003, 10:11 PM
Don't mean to take over this thread, but I've downloaded and installed kernel 2.4.21-acpi.zip.

I installed it but when I use uname -a or uname -r, it still shows the older version.

I've never done this before, and I'm not sure where to start to troubleshoot this.

thanks

rickenbacherus
08-18-2003, 01:19 AM
Sounds like you just need to get LILO set up correctly. Post it please.


Don't mean to take over this thread, but I've downloaded and installed kernel 2.4.21-acpi.zip.

Nah- that's what this post is about- acpi.

JockVSJock
08-18-2003, 04:19 AM
Thanks for your help, and thank goodness for IRC.

phoneutria
08-19-2003, 08:42 PM
The installation worked very well here with kernel 2.4.21-xfs, but now I cannot use my AES encrypted file via loopback anymore. When trying to mount, I get an "ioctl: LOOP_SET_STATUS: Das Argument ist ungültig".

Does anyone know a solution?

rickenbacherus
08-19-2003, 09:55 PM
From the README from loop-AES-v1.7


You have to have a kernel version specific loop.o module in /boot for each kernel you intend to use.

Sorry I can't really be of much help here tho as I don't use encrypted filesystems. Looks to me as thoiugh you just need to build a new loop.o to match your new kernel.

arthur
09-11-2003, 05:24 PM
First of all, thanks so much for your post!

That is what I call support :D :D

Anyway, before I start pestering any of you with my problems, I have to say that I use a Samsung X10 Centrino laptop, for which ACPI instructions were provided here:

http://gaugusch.at/kernel.shtml

Since you provide instructions for an existing kernel:
what should I do, follow your directions or the ones provided in the page above?.

How do I apply a patch to a kernel, just in case you advise me to do that?.

Regards,

Arthur :wink:

Henk Poley
09-14-2003, 04:29 PM
How do I apply a patch to a kernel, just in case you advise me to do that?
I guess you have found out by now, but anyways. Invoke the following command in the dir you want to patch:
patch -p0 < foobar.patch

You will need to enter -p1 for 2.6 kernels

jtsai256
10-01-2003, 11:59 PM
Hello,
I found this forum very helpful, however I'm having difficulty with your instructions. I followed everything up to

uname -r

and it says 2.4.21-acpi.
I looked at the acpi.log file, and everything's fine.
However, when I input:

apt-get install acpid

I get the response

Reading Package Lists... Done
Building Dependency Tree... Done
E: Couldn't find package acpid

I tried the acpi -V command and that doesn't seem to work. Am I doing something wrong? Thanks for helping me out.

Strangely enough I have battery function up and running, but I have no sound. I'm running Knoppix 3.3 on a Toshiba 5005-s504

rickenbacherus
10-02-2003, 01:25 AM
However, when I input:

apt-get install acpid

I get the response

Reading Package Lists... Done
Building Dependency Tree... Done
E: Couldn't find package acpid

I tried the acpi -V command and that doesn't seem to work. Am I doing something wrong? Thanks for helping me out.

If the acpid (acpi daemon) package can't be found then perhaps your /etc/apt/sources.list needs to be updated? You can always just go get it from debain.org and install it with dpkg or mc. You did do apt-get update right? Note that acpid is not the same thing as acpi.

It isn't absolutely essential that you have acpi installed either. It's just an easier way to look at the info in /proc/acpi. It has no bering on the functionality of the acpi patched kernel. Until you install it tho- acpi -V certainly won't work.


Strangely enough I have battery function up and running, but I have no sound. I'm running Knoppix 3.3 on a Toshiba 5005-s504

What kind of soundcard? lspci Alot of Toshibas use Yamaha cards that are SB compatible. Have you set up alsa?

/etc/init.d/alsa-autoconfig

What does lsmod tell you? On my Toshiba I was able to get the ASLA drivers to work. But I installed the latest ALSA drivers (http://www.alsa-project.org) and compiled them myself. It's very easy to do. The card is a Yamaha OPL3SA2. I found it very handy to also install alsaconfig. It will help you set all the I/O addresses, IRQ, DMA, etc.
Have a look in your BIOS and see what is available for settings regarding the soundcard.

janmartin3
11-18-2003, 01:49 AM
Hi,

will you update your greate way to silence the fans to 2003-11-14 version of knoppix?
The fan of my notebook really drives me crazy.

Thanks,
JanMartin

janmartin3
11-18-2003, 03:43 AM
Hi,

just to tell that I followed your article and installed the new 2.4.23-rc1-xfs-acpi kernel to my knoppix Version 3.3 2003-11-14.

Fan is a nearly quiet.


Thanks so much.

JanMartin

beforewisdom
12-22-2003, 03:50 PM
[quote="rickenbacherus"]Does your laptop need ACPI becasue it overheats? Tired of using a power strip to shut down your desktop becasue it won't power down correctly with APM? ACPI might just be your answer. It should be noted that ACPI does not work on all machines.
This is the easiest way I know of to get acpi working.
First you need an acpi patched kernel.. Oh No! you say- I Don't know how to build an acpi patched kernel. Not to worry. Thanks to the excellent efforts of Kano this couldn't possibly be any easier. It's already built!- you just have to install it and that's easier than falling off a dead horse. You can get the kernel and install scripts here:

http://debian.tu-bs.de/knoppix/Kano

404 Page Not Found

Stephen
12-22-2003, 08:55 PM
[quote=rickenbacherus]Does your laptop need ACPI becasue it overheats? Tired of using a power strip to shut down your desktop becasue it won't power down correctly with APM? ACPI might just be your answer. It should be noted that ACPI does not work on all machines.
This is the easiest way I know of to get acpi working.
First you need an acpi patched kernel.. Oh No! you say- I Don't know how to build an acpi patched kernel. Not to worry. Thanks to the excellent efforts of Kano this couldn't possibly be any easier. It's already built!- you just have to install it and that's easier than falling off a dead horse. You can get the kernel and install scripts here:

http://debian.tu-bs.de/knoppix/Kano

404 Page Not Found

http://www.kano.mipooh.net/ the page has moved.

rickenbacherus
01-04-2004, 11:24 PM
And now- we even have Kanotix (http://www.kanotix.mipooh.net).