bigscott Posted January 17, 2004 Report Share Posted January 17, 2004 (edited) Hi all, I am so happy to find these forums. I was looking for a Mandrake forum that used a good BB like Invisionboard. (I can't make heads or tails out of MandrakeExperts thread organizations). I spent hours, yeah days, trying to find a poweroff button solution that worked with linux, and thought I'd share the power off that finally worked for me, hopefully to save others some grief. (Of course, you know that all hardware, etc., is different so I can't say that this will work for everyone.) What this does: When you hit the power button on your PC, it performs a clean shutdown (shuts down processes and then powers off). My system: Dell Precision Workstation (desktop tower) with Pentium4, 2.4Gz Processor My distro: Mandrake 9.2 download edition using 2.4.22-10mdk kernel Prerequisites: acpi and acpid (Don't know why it needs both, but it appears to be necessary). I just uninstalled apm and installed both of these programs through the install software desktop link on Mandrake 9.2. NOTE: There is no need to compile or recompile the kernel to do this. 1. Open a Konsole and "su root" 2. "cd /etc/acpi/events" 3. "touch powerbtn" (this makes a new file called 'powerbtn') 4. "gedit powerbtn" and insert the following 2 lines into the empty file: event=button[ /]power action=sudo /sbin/halt 5. "ls /etc/acpi/events" and remove any duplicate files with a tilde (~) at the end of the file name 6. "service acpi restart" 7. "service acpid restart" 8. You should now be able to perform a clean shutdown just by pressing the power button. Kind Regards, Scott Edited January 17, 2004 by bigscott Quote Link to comment Share on other sites More sharing options...
bvc Posted January 17, 2004 Report Share Posted January 17, 2004 Interesting. Did you not have an /etc/acpi/power file w/ the following in it? event=button/power (PWR.|PBTN) action=/sbin/poweroff Works for me but I'm desktop, so that may have something to do with it. I logout of X and from init 3 do poweroff. Quote Link to comment Share on other sites More sharing options...
Urza9814 Posted January 18, 2004 Report Share Posted January 18, 2004 THANK YOU!!! Hope it works on my comp...if I ever stop being lazy and do that :-P Quote Link to comment Share on other sites More sharing options...
bigscott Posted January 18, 2004 Author Report Share Posted January 18, 2004 (edited) Interesting. Did you not have an /etc/acpi/power file w/ the following in it? event=button/power (PWR.|PBTN) action=/sbin/poweroff Works for me but I'm desktop, so that may have something to do with it. I logout of X and from init 3 do poweroff. Yes, I already had an file named "power" in my /etc/acpi directory that had those codes, but it didn't work. Originally I had "lid" and "power" files in that directory, and I just added a file named 'powerbtn' . Note that I added the 'sudo' so that all users on my PC could use it. This is on a desktop PC too... tall tower (Dell Precision 360). This method is much quicker than logging out of X, going to runlevel 3, and then doing a poweroff. IMHO, this is the way a power button should work... doing a clean shutdown and then powering off. Before, I could only get a clean shutdown by either going to a Console and doing a halt OR logging out, waiting on logout screen, telling the computer what I wanted to do, etc... you know the drill. That implementation of going through all of those screens to logout or poweroff was copied from Windows illogical way of doing things from the start menu. (It makes no sense to go to a 'Start' menu to 'Stop" something.) I'm running a dual-boot system with Windows XP Professional and Linux Mandrake 9.2 with lilo as the boot manager. Windows does a clean shutdown for me by just pressing the power button, but I think this may be Dell specific. Now, both operating systems do clean shutdowns and power off with the power button. Now, I am working on getting all devices to turn on and off by the power button, such as monitor, printer, modem, etc. I don't know about you, but electricity is expensive where I live.:o I have a Belkin UPS 350vA, and it has linux software that will shutdown everything (works with Mandrake), but there's no way to turn it back on, other than going under the desk and turning the UPS back on. I want to be able to turn everything ON and OFF with my PC's power button. NOTE: I think the power off solution is important. Why? Most people expect a power button to "power off", and if someone else hits the power button to turn off your computer, then this clean shutdown routine could prevent damaged files. It's also convenient. Edited January 18, 2004 by bigscott Quote Link to comment Share on other sites More sharing options...
coverup Posted January 19, 2004 Report Share Posted January 19, 2004 A very useful thread. Maybe, you post it to Tips and Tricks? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.