Also acta

Debian Squeeze with OpenBox

Debian GNU/Linux - Squeeze with OpenBox
If you can walk and chew gum at the same time, you can run GNU/Linux

debian tutorials
debiantutorials.org is built on and runs on Debian.

 

Creative Commons License
Put Lenny to Sleep
Put your Debian Lenny laptop to Sleep Print E-mail
Written by machiner   
Sunday, 19 October 2008 02:07

Put your Debian laptop to sleep; save power and time

Install origin: Lenny daily build, 16oct08, net install
Hardwarelshw > hardware.txt
Installeddpkg --get-selections > installed.txt

[EDIT These days, whether I install Gnome or not, I do install gnome-power-manager to handle putting my laptop to sleep. The program will live in your systray and you can set it up one time as you like and forget all about it. The following is still cool, though. I also forgot to mention that the following 2 packages must also be installed: radeontool vbetool.]

Short and sweet, this will take you mere moments to accomplish. The goal here is to have a handy shortcut icon for putting my laptop to sleep. I want it in the panel (taskbar, menubar, shortcut bar) on my custom Xfce4 Lenny desktop install and that's just what I've got. Click that little pic below, on the left, to see my panel.

The hibernate program is not needed for this and I don't have it installed. Instead I like to use s2ram wich comes with uswsusp, which is installed by default. I don't know how you guys do it, but on my Debian Lenny desktop this is how I get my laptop set up to be put to sleep.

The /usr/sbin/s2ram --force command must be run as root. So, I installed sudo for this purpose as I didn't want the overhead of gksu and I don't want my laptop awakening with a root terminal staring whomever lifted the lid in the face. Nuh, I'd rather not have that. So, sudo it is. Go ahead and install sudo:

# aptitude install sudo

Now, since I like using root regularly (when I need it) and don't really need sudo for other users, the only root ability that I will give myself through sudo is the ability to suspend the machine to ram. Precise control, that's what security is all about.

There are 2 things that I need to do to get my user account trusted with sudo capability.
  • add the user account to the sudo group: # adduser uname sudo
  • add the user account to the sudoers file: # visudo
You need to add the user account to this file as well as the permissions so you might add something like this:

uname ALL=/usr/sbin/s2ram --force

When you're finished, close the file the normal nano way; ctrl+x, y, enter.

Now, just logout one time to set your new group permission, log back in and make the shortcut on you taskbar. Right-click, add a thing. Just use sudo /usr/sbin/s2ram --force as the command and choose to run it in the terminal for your password prompt to work. That's it. Click it one time to test.

I don't run a standard Debian desktop with the typical Gnome environment so you may already have a handy shortcut for this. I run an Xfce4 desktop that I set up light with just what I use so I am used to making a few little shortcuts like this for myself. This whole proceedure takes less than a minute and it's only necessary the one time. Unless you reinstall.

--machiner 18oct08

Last Updated on Thursday, 26 March 2009 14:51