PDA

View Full Version : Revisiting an old e16 issue ...



Dan
26th February 2013, 10:14 PM
... in particular the one here, (starting at post 43) (forums.fedoraforum.org/showthread.php?t=272559) regarding getting a functional menu entry for Suspend.

As posted there, this works via the terminal:
su -
(provide password)

pm-suspend

Or, this works, too.


sudo pm-suspend

The problem comes in trying to get this to execute from a menu item. Neither one will work as a standard user, and there is no opportunity to authenticate by password, so they silently fail.


"User Menus"
"User Application List" NULL menu "user_apps.menu"
"Applications" NULL menu "menus_apps/index.menu"
"Epplets" NULL menu "epplets.menu"
"Restart" NULL "exit restart"
"Log Out" NULL "exit logout"
"Suspend" NULL "pm-suspend"




Figure 1: Menu Entry
http://forums.fedoraforum.org/picture.php?albumid=313&pictureid=1544


Figure 2: Missing selection = Suspend.
http://forums.fedoraforum.org/picture.php?albumid=313&pictureid=1545



Sea's solution works, but I've never been a big fan of beesu. I don't have it installed as I don't really understand all of what I know of what it's doing.

I'd just as soon have only that one command function without interference.

So that leaves me with two options. Get a clearer understanding of what beesu is doing, and how to cage it for the rest of the system, or find a way to get that command to work from the menu. (Ideally, I'd like it to pop in as an option in the resulting logout/shutdown dialogue. So, that's the bottom line question.


How to get that command to work normally. (ie, get the suspend option included in the shutdown dialog.)

If that's not possible, how to get the menu command to properly function without beesu?

Or, whussup with beesu, and how to pull it's fangs for anything except activating that one single command?




Simple ... no? <..:confused:..>






ONGOING-EDITING: Done.

jpollard
27th February 2013, 12:34 AM
Note: I'm still using F16 for the most part,

pm-suspend is a shell script... that happens to need root privileges.

You might have the utility "consolehelper" installed (it MAY be a gnome based, but it shows in the package "usermode".

IF you create a symbolic link in /usr/bin pointing to console helper (and call the link pm-suspend), then consolehelper will request root (by password), and then exec /usr/sbin/pm-suspend as the root user.

You should be able to put the now existing /usr/bin/pm-suspend in a menu and have it work.

Dan
27th February 2013, 02:02 AM
Ok. I'll try that in a bit. I've tried all three of these, and nothing has worked so far. (The last one was just a wild-bassed shot the dark. <..:p..> )


dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.S uspend \
int32:0

*************************

dbus-send --session --dest=org.freedesktop.PowerManagement \
--type=method_call --print-reply --reply-timeout=2000 \
/org/freedesktop/PowerManagement \
org.freedesktop.PowerManagement.suspend

****************************

/* ** Suspend */

dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.DeviceKit.Power /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Suspend


***************************


dbus-send --print-reply \
--system \
--dest=org.freedesktop.DeviceKit.Power \
/org/freedesktop/DeviceKit/Power \
org.freedesktop.DeviceKit.Power.Suspend


*******************************


dbus-send --system --print-reply \
--dest="org.freedesktop.UPower" \
/org/freedesktop/UPower \
org.freedesktop.UPower.Suspend

marriedto51
27th February 2013, 10:19 AM
I'd be tempted to configure sudo to let you run pm-suspend as root with no password. Something like


username ALL=(root) NOPASSWD: /usr/sbin/pm-suspend
in the /etc/sudoers file should then allow you to have "sudo pm-suspend" as the command in the menu entry.

sea
27th February 2013, 11:22 AM
As part of my custom spin, where i had similar issues, i came across some nice lines.
Its Lua code, but the required info is easy to extract:

mnuPower = {
{ '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' },
{ 'reboot', 'dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart', beautiful.reload_icon },
{ 'halt', 'dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop' },
{ "logout", awesome.quit }
}

I assume your code doesnt work because of the HAL reference, which isnt used anymore, if we're talking about F18 that is.
EDIT: /* Oh dang, just seeing your last one is UPower as well :( */
hth

Dan
27th February 2013, 08:18 PM
... not much progress.

This:

dan ALL=(root) NOPASSWD: /usr/sbin/pm-suspend
Worked fine (as expected) in the terminal, but then this:

"Suspend" NULL (exec) "pm-suspend"
failed to do anything from the menu. (As a variant, I included the complete path ... but that was ignored as well.)

This:

'dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend'failed to work anywhere.

Unless I miss my guess, the first trick here, should have circumvented the need for this:

IF you create a symbolic link in /usr/bin pointing to console helper (and call the link pm-suspend), then consolehelper will request root (by password), and then exec /usr/sbin/pm-suspend as the root user.
Which is also neatly circumscribed by the fact that it failed, too.

What am I doing wrong here?! <..:confused:..>


I wondered if maybe it didn't need to be done from within another file, so I made such a file, (named it "suspend-e16") made it executable, and viola! that works when run from a terminal with this:
$ ./suspend-e16
But that fails from the menu, to.

I'm missing something here.


What is?

Dan
27th February 2013, 08:48 PM
We may be getting somewhere. At least the failures are getting more interesting.

This:
IF you create a symbolic link in /usr/bin pointing to console helper (and call the link pm-suspend), then consolehelper will request root (by password), and then exec /usr/sbin/pm-suspend as the root user.

You should be able to put the now existing /usr/bin/pm-suspend in a menu and have it work. At least gets a response. That being a small error box that says ...
Unknown Error ... with a nice little "Close" button on it. Nothing else. <..:rolleyes:..>

jpollard
28th February 2013, 12:56 AM
Unknown Error in this case means that the /usr/sbin/pm-suspend isn't there.

At least, that is what I get when that happens.

Dan
28th February 2013, 01:48 AM
Hmmm.

Nope. Just looked. It's definitely there. Demonstrable also by the fact that (from a user terminal in my home directory), this works just fine.

sudo /usr/sbin/pm-suspend

ocratato
28th February 2013, 03:25 AM
Just a thought. Perhaps there is something in their menu system that prevents the running of privileged programs or scripts for security reasons. Can you run other privileged programs or scripts through the menu system or is this just something about pm-suspend ?

Dan
28th February 2013, 03:47 AM
I suppose it has to be something of that nature. I wonder if the suspend feature really wasn't on the radar back when e16 was built.

marriedto51
28th February 2013, 09:44 AM
A thought about the sudo approach... Does it make any difference if you comment out the requiretty line in /etc/sudoers?


# Defaults specification
[...]
#Defaults requiretty
Defaults env_reset
[...]

Dan
28th February 2013, 02:51 PM
YES! <..:dance:..>



That's half the battle! Now the menu entry under user menus functions! Unfortunately, the one under the "file menu" does not.

Still broken:

"User Menus"
"User Application List" NULL menu "user_apps.menu"
"Applications" NULL menu "menus_apps/index.menu"
"Epplets" NULL menu "epplets.menu"
"Restart" NULL "exit restart"
"Log Out" NULL "exit logout"
"Suspend" NULL "pm-suspend"
"Suspend" NULL "sudo pm-suspend"
"Suspend" NULL "sudo /usr/sbin/pm-suspend"
"Suspend" NULL exec "(any path/command) pm-suspend"



Works fine:

"user_apps.menu"
[<--- snip --->]
"Suspend" NULL exec "sudo /usr/sbin/pm-suspend"

That being said, if I cannot fix the file menu entry, I can live with the other one the way it is.

Mostly now I just want to understand why.

Cygn
28th February 2013, 06:56 PM
Hehe, I had a similar fight when I compiled E17 from src and looked for working sysactions.conf
The answer is:

systemctl suspend
and that runs fine as user.

Dan
28th February 2013, 07:03 PM
Ok! Outstanding! <..:thumb:..> That works too ... from the user_apps.menu. Still not so much from the user menus. <..:confused:..>

Dan
28th February 2013, 08:57 PM
Weird! This works on one laptop (F17 base) ... fails on the other (F16 base). Color me confused.

<..:confused:..>

Ihatewindows
28th February 2013, 09:28 PM
Could it be the version of Enlightenment? Maybe slightly different?

marriedto51
1st March 2013, 10:48 AM
Weird! This works on one laptop (F17 base) ... fails on the other (F16 base). Color me confused.

I get this on F16:


$ systemctl suspend
Unknown operation suspend
$

Cygn
1st March 2013, 10:53 AM
i guess it's a systemd feature introduced in F17.


Ok! Outstanding! <..:thumb:..> That works too ... from the user_apps.menu. Still not so much from the user menus. <..:confused:..>
So it wasn't a sudo/suid/permission issue at the first place.

Dan
1st March 2013, 12:03 PM
I get this on F16:


$ systemctl suspend
Unknown operation suspend
$ Ayup. That's exactly what I get, too.


i guess it's a systemd feature introduced in F17.


So it wasn't a sudo/suid/permission issue at the first place.So it seems. Although the work-around to it in F16 does involve setting:

# Defaults specification
[...]
Defaults requiretty

[...] as marriedto51 suggested. But it's not required in F17.

IHeart SymLinks
11th April 2013, 06:09 PM
... [URL="forums.fedoraforum.org/showthread.php?t=272559"]
Figure 1: Menu Entry
http://forums.fedoraforum.org/picture.php?albumid=313&pictureid=1544


Figure 2: Missing selection = Suspend.
http://forums.fedoraforum.org/picture.php?albumid=313&pictureid=1545


Is that Fedora, what theme is that?

Dan
11th April 2013, 06:35 PM
Yes, that is Fedora. In particular, F17. It is not Gnome. It is e16 (you'll find it in the repos) and the theme is one I adapted. The files for it are in this thread.

http://forums.fedoraforum.org/showthread.php?t=289800

Introduction and exploration of e16 is in these threads.

http://forums.fedoraforum.org/showthread.php?t=289151
http://forums.fedoraforum.org/showthread.php?t=289444


The results:

http://forums.fedoraforum.org/picture.php?albumid=313&pictureid=1591

IHeart SymLinks
11th April 2013, 08:52 PM
Oh e16, I thought it said el6.

Thanks.