# acpi poweroff

## Xero

I've messed with trying to get acpi to shut the power off in the past and my results were inconsistant. With my old computer, it'd shut off about 1/3 of the time, I ended up just using apm=power-off in lilo to make things work and said bye bye to ACPI. On my new computer I need ACPI for hyperthreading so I figured I'd try to get it working again.

Using poweroff, halt -p, or any of the power down commands, while they shut down linux, they don't power off the computer. I have acpid installed and it shuts everything down when I press the power button, but again, no power off. I did a little research, searched these forums, and decided to try echo -n 5 > /proc/acpi/sleep. Sure enough, it works, my computer powers down. I then added that to /etc/init.d/shutdown.sh and now everything appears to be working perfectly. Everything gets shut down and then the computer powers off.

Is it safe to add echo -n 5 > /proc/acpi/sleep to the bottom of shutdown.sh? And why isn't it powering off using acpi without this? It's quite obvious to me that acpi is indeed working. I'm offically convinced that the halt or shutdown commands are not doing something right, or I'm expecting them to do something they don't even do, which seems odd as it used to work somewhat with my old computer, and it works fine with apm.

Any clues?

----------

## Moled

what kernel are you using?

----------

## Xero

Currently, ck-sources 2.4.22-r2, but previously vanilla 2.4.22.

----------

## Moled

http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.23.log

its in there near the bottom somewhere, I assume you have a p4?

acpi works quite nicely now

!

emerge vanilla-prepatch-sources

shutdown -h works fine now on my p4  :Smile: 

----------

## Xero

I just tried the prepatch kernel and the situation is the same. It still doesn't work unless I add that line to shutdown.sh, and then it started behaving like it did on my old computer, it'd shut down half of the time or so. 2.4.22 didn't do that. No matter what I do it seems without adding that line to shutdown.sh it doesn't power off at all. The only thing I can think of is maybe baselayout needs to be recompiled so halt/shutdown/etc knows about acpi. I see nothing about them that mentions ACPI anywhere though, so I don't think it would make a difference.

----------

## Moled

which acpi options did you use in the kernel?

I assume you DIDNT select the ht only one?

----------

## Xero

You're correct in your assumption, I have ACPI support, button, and processor.

----------

## TheCoop

have you tried acpid? adding it to startup, and pressing power button shuts the computer down. ymmv however

----------

## Xero

I already have acpid installed and added to startup. It does shut down using the power button, that works without a flaw. It still doesn't power off the computer though, unless I add that line to shutdown.sh

----------

## Moled

From man acpid:

 *Quote:*   

> EXAMPLE
> 
>        This example - placed in /etc/acpi/events/power - will shut down your system if you press the power button.
> 
>        event=button power.*
> ...

 

so pressing the power button would run /usr/local/sbin/power.sh

(or shutdown -h now in my case)

so I press my power button:

/var/log/acpid

 *Quote:*   

> [Fri Sep 26 01:44:00 2003] received event "button/power PWRF 00000080 0000000d"
> 
> [Fri Sep 26 01:44:00 2003] executing action "/etc/acpi/default.sh button/power PWRF 00000080 0000000d"
> 
> [Fri Sep 26 01:44:00 2003] BEGIN HANDLER MESSAGES
> ...

 

but it doesn't do anything

 :Sad: 

----------

## Xero

As that log shows it's running /etc/acpi/default.sh. Are you using ~x86? It seems that the current  stable x86 has a bug with default.sh. Try using acpid-1.0.2-r2, if you're not already.

----------

## Moled

thanks, I just switched to r2 and all is working good

----------

## jonas_nilsson

Hrmm, I've noticed this thread hasn't been active since early stone age, but I will post anyway. 

 *Quote:*   

> As that log shows it's running /etc/acpi/default.sh. Are you using ~x86? It seems that the current stable x86 has a bug with default.sh. Try using acpid-1.0.2-r2, if you're not already.

 

I am currently at my parents place for Christmas celebration, and only have a half-dead modem line, so all my sympathies go to those who can't download any fresh ebuilds.

The essence of this post is:

The style of the event expressions have changed in the kernel, so the line in the posted example saying

```
event=button power.* 
```

should now be

```
event=button/power.*  
```

So you don't have to update acpid!

Merry Christmas to all of you!

----------

## rafo

I also have had the problem where `shutdown -h now' doesn't physically power down the machine. On a oldish Dell 166 MHz desktop I could solve this by adding APM support to the kernel, including the "use real mode APM BIOS to power off" feature.

However, this didn't work on my slightly less old Compaq Deskpro (PIII 700 MHz). After several attempts with APM or ACPI in the kernel I found that I also had to add a parameter "acpi=force" on the kernel invocation line in GRUB. According to the messages obtained before including that parameter the Linux kernel doesn't by default trust a BIOS from the 1990's to have usable ACPI.

Upgrading the BIOS was not an option for this particular machine (system ROM family 686T3), even the most recent upgrade is dated 1999.

Once the "acpi=force" parameter was added the acpid service could be activated. However, `shutdown -h now' causes a physical power down even without having acpid running. The ACPI features that I have enabled in the kernel are "button" and "processor".

----------

