Hello forum,

I have run into a recent problem that I cannot suspend my system unless I add sudo to the command "obshutdown -c ~/.config/obshut/exit.rc" listed in jwm menu.

is this expected behavior?

It probably means it's more secure since programs running from window manager don't get automatic root.
this is my exit.rc:
#
# Openbox shutdown dialog
# This is example obshutdown rc file
# Copy this file to ~/.obshutdown.rc and customise
#

[general]
version =        0.1-rc1
verbose =        false
default_action = shutdown
composite =      true
theme =          faenza
buttons =        cancel logout shutdown restart

[actions]
logout =         jwm -exit
shutdown =       dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
restart =        dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
lock = 
switch = 
suspend =        dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
hibernate =      dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
custom = 		

[shortcuts]
logout =         l
shutdown =       s
restart =        r
lock = 
switch = 		
suspend =        u
hibernate =      h
custom = 

[labels]
cancel =         CANCEL
logout =         LOGOUT
restart =        RESTART
shutdown =       SHUTDOWN
lock =           LOCK
switch =         SWITCH USER
suspend =        SUSPEND
hibernate =      HIBERNATE
Obviously consolekit need to run on your system
How does your jwm menu config file entry for obshutdown look?
<Program icon="exit" label="Exit">sudo obshutdown -c ~/.config/obshut/exit.rc</Program>
Do you have to add the sudo? because if I don't add it, my system doesnt suspend
what happens if you directly type in terminal the suspend command
% dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
interesting the output is:
Error org.freedesktop.DBus.Error.UnknownMethod: No such method “Suspend”
It doeent work with sudo from terminal either, same error.
well then i dont know whats wrong with your system then, since earlier you said the suspend command works with "sudo", but now, running the suspend command directly instead of passing through obshutdown (which basically is the same thing), does not work?
How do you have sudo working on /etc/sudoers and is your user still on /etc/group wheel?
Sudo normally requires a password to work, unless from the same shell you have just recently entered the pw.
The other way is to have the 2nd part of sudoers uncommented where it allows user to issue sudo NOPASSWD.
The third way is/was to substitute gksudo.

But if dbus and consolekit for user are set correctly, just as they are in live JWM you don't need any of this.

So maybe check your 66-intree -g both user and root and if you can share the output here.
I do have NOPASSWD set up for sudo. everything seems ok for the relevant trees.
boot-user output from # 66-intree -g
Name         : boot-user
Initialized  : yes
Enabled      : yes
Starts after : root
Current      : no
Allowed      : root
Symlinks     : svc->source db->source
Contents     : /
               ├─(up,Enabled,oneshot) setenv@ orb
               ├─(1072,Enabled,longrun) svscan@ orb-log
               ├─(1124,Enabled,longrun) svscan@ orb
               ├─(up,Enabled,module) scandir@ orb
               ├─(up,Enabled,oneshot) mount-run@ orb
               ├─(1077,Enabled,longrun) consolekit-log
               ├─(1081,Enabled,longrun) consolekit
               ├─(up,Enabled,module) console-tracker@ consolekit
               ├─(1075,Enabled,longrun) sddm-log
               ├─(1085,Enabled,longrun) sddm
               ├─(up,Enabled,module) display-manager@ sddm
               └─(up,Enabled,module) boot-user@ orb
%66-intree -g
Name         : graphics
Initialized  : yes
Enabled      : yes
Starts after : None
Current      : yes
Allowed      : orb
Symlinks     : svc->source db->source
Contents     : /
               ├─(1270,Enabled,longrun) dbus-session@ orb-log
               ├─(1269,Enabled,longrun) pulseaudio-log
               ├─(11991,Enabled,longrun) pulseaudio
               ├─(up,Enabled,oneshot) xdg-user-dirs
               └─(1274,Enabled,longrun) dbus-session@ orb

ok after looking at... stuff, im wondering if how exactly is running obshutdown -c ~/.config/obshut/exit.rc with sudo allows you to suspend the computer?

For one, the only available items shown (unless you intentionally modified exit.rc) are cancel logout shutdown restart
Even if you do enable Hibernate and Suspend items, UPower does not have either Hibernate or Suspend modules, so it should still now work even with sudo? It was probably not intended to be used hence it was left out of the Exit menu and are just left overs from default configs.

org.freedesktop.ConsoleKit.Manager does have Hibernate and Suspend modules, but i dont know **** about handling the error:
% dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Suspend 
Error org.freedesktop.DBus.Error.InvalidArgs: Type of message, “()”, does not match expected type “(b)”
i don't use any sudo command at my jwm menu
<Program icon="exit" label="Exit">obshutdown -c ~/.config/obshut/exit.rc</Program>
eric wrotei don't use any sudo command at my jwm menu
<Program icon="exit" label="Exit">obshutdown -c ~/.config/obshut/exit.rc</Program>
im not sure if you are replying to my last post, or for the thread started. In any case, the issue is that somehow TS said that adding "sudo" to the command "obshutdown -c ~/.config/obshut/exit.rc" allowed him to Suspend. Its not about your config have or does not have sudo in it.

My post states my findings that even with sudo, suspend should still not work, since no suspend or hibernate module exists for UPower.
Oh yeah, I gotta slap my forehead...I forgot to mention that I use:
  dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Suspend  boolean:true
In my exit.rc for my suspend since i had problems using the code with Upower immediately after installing Obarun.

When I run this in terminal without sudo I get:
 Error org.freedesktop.ConsoleKit.Manager.Error.InsufficientPermission: Not Authorized
25 days later
turns out, you need to install pm-utils from aur for Suspend, Hibernate to work using consolekit, then change suspend and hibernate commands appropriately:

https://wiki.archlinux.org/index.php/ConsoleKit# Use_D-Bus_for_power_operations

if you will still get "insufficient permission" errors, polkit might not be running correctly or something. im on my custom bspwm config with dbus-run-session starting my bspwn session, so dunno whats the case for jwm
Seems to have solved itself after a pm-utils update. so I bet some package was requiring an update because of some conflict somewhere. I dont know. Glad it is solved tho.

Powered by Obarun