Re: How to hibernate from the command line without typing password

2009-12-09 Thread Sjoerd Hardeman

Celejar schreef:

On Tue, 8 Dec 2009 11:02:11 +
chombee chom...@lavabit.com wrote:


On Sun, Dec 06, 2009 at 02:10:38PM -0500, Celejar wrote:

On Sun, 6 Dec 2009 14:57:21 +
chombee chom...@lavabit.com wrote:

...


Gnome desktop. You can send a signal via dbus asking for the computer to
be hibernated with the following command:

dbus-send --session --dest=org.freedesktop.PowerManagement 
--type=method_call /org/freedesktop/PowerManagement org.freedesktop.PowerM
anagement.Hibernate

...


I also saved the command as an executable script called 'hibernate' so
that I can hibernate from the command line by just typing hibernate.

I don't recall the earlier thread, but what's wrong with the
'hibernate' command from the 'acpi-support' package, or 's2disk' from
the 'usswsusp' package?

I have acpi-support installed but don't seem to have a hibernate
command, could take a closer look at the package I guess. I also have


Sorry, my mistake - it's in the package 'hibernate'.


usswsusp installed but I think the s2disk command must be run with sudo,
so you have to type your password.


Of course it must be run as root - why would a linux system allow an
arbitrary user the power to suspend the system!  If you want to avoid
typing a password, then you need to configure sudo to allow your user
to use that command without a password.  This is what Xfce, for
example, recommends:

Quote

I'm unable to shutdown or restart my computer when running Xfce.

There are two way to fix this: sudo and hal/dbus. Default starting from
version 4.4 is hal.



...



As you can see above, the dbus method that you're using also requires a
dbus policy + adding yourself to a specific group.
If the dbus is set up correctly (eg, you can use hibernate as a user 
using one of the guis) this should also work:
 'dbus-send --session --dest=org.freedesktop.PowerManagement 
--type=method_call /org/freedesktop/PowerManagement 
org.freedesktop.PowerManagement.Hibernate'


but of course 'sudo s2disk' is a lot less typing ;)

Sjoerd



signature.asc
Description: OpenPGP digital signature


Re: How to hibernate from the command line without typing password

2009-12-08 Thread chombee
On Sun, Dec 06, 2009 at 02:10:38PM -0500, Celejar wrote:
 On Sun, 6 Dec 2009 14:57:21 +
 chombee chom...@lavabit.com wrote:
 
 ...
 
  Gnome desktop. You can send a signal via dbus asking for the computer to
  be hibernated with the following command:
  
  dbus-send --session --dest=org.freedesktop.PowerManagement 
  --type=method_call /org/freedesktop/PowerManagement org.freedesktop.PowerM  
anagement.Hibernate
 
 ...
 
  I also saved the command as an executable script called 'hibernate' so
  that I can hibernate from the command line by just typing hibernate.
 
 I don't recall the earlier thread, but what's wrong with the
 'hibernate' command from the 'acpi-support' package, or 's2disk' from
 the 'usswsusp' package?

I have acpi-support installed but don't seem to have a hibernate
command, could take a closer look at the package I guess. I also have
usswsusp installed but I think the s2disk command must be run with sudo,
so you have to type your password.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to hibernate from the command line without typing password

2009-12-08 Thread Celejar
On Tue, 8 Dec 2009 11:02:11 +
chombee chom...@lavabit.com wrote:

 On Sun, Dec 06, 2009 at 02:10:38PM -0500, Celejar wrote:
  On Sun, 6 Dec 2009 14:57:21 +
  chombee chom...@lavabit.com wrote:
  
  ...
  
   Gnome desktop. You can send a signal via dbus asking for the computer to
   be hibernated with the following command:
   
   dbus-send --session --dest=org.freedesktop.PowerManagement 
   --type=method_call /org/freedesktop/PowerManagement 
   org.freedesktop.PowerManagement.Hibernate
  
  ...
  
   I also saved the command as an executable script called 'hibernate' so
   that I can hibernate from the command line by just typing hibernate.
  
  I don't recall the earlier thread, but what's wrong with the
  'hibernate' command from the 'acpi-support' package, or 's2disk' from
  the 'usswsusp' package?
 
 I have acpi-support installed but don't seem to have a hibernate
 command, could take a closer look at the package I guess. I also have

Sorry, my mistake - it's in the package 'hibernate'.

 usswsusp installed but I think the s2disk command must be run with sudo,
 so you have to type your password.

Of course it must be run as root - why would a linux system allow an
arbitrary user the power to suspend the system!  If you want to avoid
typing a password, then you need to configure sudo to allow your user
to use that command without a password.  This is what Xfce, for
example, recommends:

Quote

I'm unable to shutdown or restart my computer when running Xfce.

There are two way to fix this: sudo and hal/dbus. Default starting from
version 4.4 is hal.

Using sudo

You have to allow the user(s) to execute
$installdir/libexec/xfsm-shutdown-helper with sudo. Install sudo and
run visudo (root) and add the following line (replace prefix with the
correct path):

 %users ALL = NOPASSWD:prefix/libexec/xfsm-shutdown-helper

Add the user to the users group (root):

 gpasswd -a username users

When you logout and login again, the shutdown and restart buttons
should be sensitive. For more information you can referrer to the
xfce4-session and sudo documentation.

Using hal and dbus

Make sure that the hal and dbus daemons are started on boot, and that
you are running a recent version of dbus (at least 1.1). Refer to your
distribution for exact steps.

In the steps below the groupname “power” is used. This is DEPENDING ON
YOUR DISTRIBUTION.

Your /etc/dbus-1/system.d/hal.conf should contain a section similar to this:

policy group=power
  allow send_interface=org.freedesktop.Hal.Device.SystemPowerManagement/
  ...
/policy

Add the user to the power group (root):

 gpasswd -a username power

When you logout and login again, the shutdown and restart buttons should be 
sensitive.

/Quote

http://wiki.xfce.org/faq

As you can see above, the dbus method that you're using also requires a
dbus policy + adding yourself to a specific group.

Celejar
-- 
foffl.sourceforge.net - Feeds OFFLine, an offline RSS/Atom aggregator
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



How to hibernate from the command line without typing password

2009-12-06 Thread chombee
I asked this question on this list a while back and although I did get a
helpful response that would have led to a solution, it would not have
led to the better solution that I recently discovered so I thought I'd
post this in case it might be helpful to anyone else searching the list.

I found the solution in this blog post:

http://thehacklist.blogspot.com/2009/09/suspendhibernate-from-command-line.html

the command in the post itself didn't work for me, but one given in the
comments did. This works for me in Debian Lenny running the default
Gnome desktop. You can send a signal via dbus asking for the computer to
be hibernated with the following command:

dbus-send --session --dest=org.freedesktop.PowerManagement 
--type=method_call /org/freedesktop/PowerManagement org.freedesktop.PowerM
anagement.Hibernate

In the above blog post's comments you'll find a similar command to
suspend the computer.

I used this command to add a one-click hibernate button to my Gnome
panel (as a custom application launcher). Normally you can't hibernate
without multiple clicks in Gnome, and it always asks you whether you
want to suspend, hibernate, restart or shutdown, of which shutdown seems
to always be the default. I just kept choosing shutdown and then cursing
because what I always want is to hibernate. If hibernate works for you,
why would you ever want to shutdown? Hibernate seems to me to be what
computers should always do, as they start up much faster and all your
context is preserved.

I also saved the command as an executable script called 'hibernate' so
that I can hibernate from the command line by just typing hibernate.

Works for me!


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to hibernate from the command line without typing password

2009-12-06 Thread Celejar
On Sun, 6 Dec 2009 14:57:21 +
chombee chom...@lavabit.com wrote:

...

 Gnome desktop. You can send a signal via dbus asking for the computer to
 be hibernated with the following command:
 
 dbus-send --session --dest=org.freedesktop.PowerManagement 
 --type=method_call /org/freedesktop/PowerManagement org.freedesktop.PowerM
 anagement.Hibernate

...

 I also saved the command as an executable script called 'hibernate' so
 that I can hibernate from the command line by just typing hibernate.

I don't recall the earlier thread, but what's wrong with the
'hibernate' command from the 'acpi-support' package, or 's2disk' from
the 'usswsusp' package?

Celejar
-- 
foffl.sourceforge.net - Feeds OFFLine, an offline RSS/Atom aggregator
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org