[Techtalk] Automatic shutdown when pressing power button

Wim De Smet kromagg at gmail.com
Mon Sep 18 14:57:15 UTC 2006

On 9/17/06, Tiera <tiera at bredband.net> wrote:
> We have a mythtv box at home. We used to have Ubuntu hoary with gnome on
> it. When we had that we could press the power button on the computer and
> that would shut down the system nicely, ie not just killing the power,
> it would shut down just as if you had written "shutdown -h now". We've
> now upgraded the box to Ubuntu Breezy and fluxbox instead of gnome. The
> nice power button functionality we had before doesn't work anymore now.
> I'm guessing gnome had something to do with it, but I'm not sure. I'm
> not even sure what you would call this functionality so I don't know
> what to google for. Does anyone have any pointers? I would love to be
> able to shut down the box properly by just pressing the power button again.

Well I'll give you some background info so you know what's going on.
The signal the powerbutton sends is part of the ACPI(Advanced
Configuration and Power Interface) subsystem of your computer which is
basically the modern way of going about powersaving and stuff like

Now linux has specific modules to "catch" these events and send them
to a userspace program (something that's not part of the kernel). The
first thing you'd need to do is verify the following:
- is the "button" kernel module being loaded (check with lsmod | grep button)
- is the acpid program installed and working? (ps -A | grep acpi)
- is it taking the right action for the powerbutton?

The first 2 are pretty trivial since you can load the module manually
(modprobe button) and put it in /etc/modules, if acpid is not
installed you can do aptitude install acpid or something similar with
your favourite apt front-end. The last part is a bit tricky since
there are several ways this could work.

You mentioned you switched to fluxbox from gnome, maybe all acpid does
is pass the event to hal which passes the event to gnome which does
the shutdown. The event is normally configured in /etc/acpi/events.
Could be that there's a package which does what you want when you
install it though so you could do a search for 'acpi' first (aptitude
search acpi for instance). Otherwise you can just edit the 'action'
part to point to a script of your making or that is still available on
your system (in /etc/acpi typically) and do it there.

I hope that gets you on the right track, I tried to search ubuntu.com
for something about this but didn't immediately come up with anything.


More information about the Techtalk mailing list