Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
07-31-2013, 04:47 PM
|
#1
|
Senior Member
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482
|
Suspend to ram as non-root
Slackware 14.0, generic kernel with mkinitrd.
I'm still learning my way with my Thinkpad T400. I seem to lack the big picture with suspend to ram.
I probably missed another memo somewhere. When I run upower -d as non-root, the output reveals the user does not have permission to suspend (can-suspend: no). The account is a member of the power and plugdev group.
pm-suspend is installed at /usr/sbin rather than /usr/bin and the script won't let non-root users execute. pm-suspend works fine as root.
/sys/power/state has permissions of 644, root:root. Of course, with those permissions I can't change the contents as non-root.
All scripts in /usr/lib/pm-utils are executable with 755 permissions.
Full install, so upower, et. al., are installed.
I've been browsing the forum and web to no avail. How do I programmatically execute suspend to ram as a non root user? I have the lid configured as well as Fn-F4, but want to have programmatic access too (can-suspend: yes).
Thanks. 
|
|
|
07-31-2013, 06:37 PM
|
#2
|
Member
Registered: Jan 2011
Location: Czech Republic
Distribution: Slackware, Gentoo, FreeBSD
Posts: 176
Rep:
|
Did you read SlackDocs article about hibernating? Suspend to ram isn't covered there, but you can get basic idea.
There are two ways to achieve that:
1) pm-utils via sudo
2) UPower + D-Bus
Code:
$ dbus-send --system --print-reply --dest="org.freedesktop.UPower" \
/org/freedesktop/UPower org.freedesktop.UPower.Suspend
Until I'll update and extend SlackDocs article mentioned above, I recommend ArchWiki - https://wiki.archlinux.org/index.php...s_regular_user.
Last edited by yenn; 07-31-2013 at 06:39 PM.
Reason: url edit
|
|
1 members found this post helpful.
|
07-31-2013, 07:04 PM
|
#3
|
Senior Member
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482
Original Poster
|
Let's start with the basics.
When I run upower -d I see the following at the end:
can-suspend: no
What is needed to change that to yes?
Quote:
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
|
Are you saying a non-root user has to type that entire gobbledygook string to suspend to ram? Or place that string into a script wrapper? Even if a non-root does that, upower -d still informs that the user does not have permissions. What is needed to obtain those permissions?
Note: when I run the gobbledygook above I receive a stdout message of "not authorized," which matches the upower -d output of can-suspend: no.
Last edited by Woodsman; 07-31-2013 at 07:08 PM.
|
|
|
07-31-2013, 09:01 PM
|
#4
|
Member
Registered: Aug 2012
Posts: 484
Rep: 
|
I'm afraid I can't test this now but give this a shot, put the following in: /etc/polkit-1/localauthority/50-local.d/30-power-group.suspend-override.pkla
Code:
[Suspend power group override]
Identity=unix-group:power
Action=org.freedesktop.upower.suspend
ResultAny=yes
ResultInactive=yes
ResultActive=yes
--mancha
|
|
1 members found this post helpful.
|
07-31-2013, 09:20 PM
|
#5
|
Senior Member
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482
Original Poster
|
Thanks.  That pkla file did the trick. Now upower -d shows can-suspend: yes. No reboot required, just logout/login.
Now, where in the Slackware documentation would I have found that solution?
I'm still confused. Most people using a laptop don't run as root. So why is this pkla policy not standard? How do folks use various graphical applets to suspend to ram when this policy is not present? Yeah, okay, most folks just close the lid, but for me to even get that to work I had to spend time on the web to learn how to add various acpi scripts. I find acpi on laptops to be ridiculously complicated. Suspend to ram on a laptop does not "just work" on linux based systems. 
|
|
|
07-31-2013, 11:24 PM
|
#6
|
Member
Registered: Nov 2011
Distribution: Slackware
Posts: 363
Rep:
|
I cannot answer that, but in case it is pertinent, when I run "upower -d," I get "can-suspend: yes."
The only thing I ever do for my machines is to make a small addition to /etc/acpi/acpi_handler.sh telling it to suspend on a lid event.
Last edited by Kallaste; 07-31-2013 at 11:27 PM.
Reason: typo
|
|
|
07-31-2013, 11:32 PM
|
#7
|
Senior Member
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482
Original Poster
|
Quote:
I cannot answer that, but in case it is pertinent, when I run "upower -d," I get "can-suspend: yes."
|
Huh. I wonder why that does not happen on my systems? I wonder whether I've configured something that causes that effect.
I might have to create a quick temporary VM and fresh install to see what happens to can-suspend.
|
|
|
08-01-2013, 05:55 AM
|
#8
|
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467
Rep: 
|
I think it's just a permissions thing in the /proc and /sys files that actually do the suspend/hibernation. If you chown/chmod those at boot you should be able to suspend as normal user like I do. My suspend script:
Code:
killall ssh
sync
echo "0 blink" > /proc/acpi/ibm/led
echo -n mem > /sys/power/state
I have an entry in fluxbox menu for this, but I also use an acpi script that gets called when I press the power button, and which runs as root.
|
|
|
08-01-2013, 08:20 AM
|
#9
|
Member
Registered: Jan 2011
Location: Czech Republic
Distribution: Slackware, Gentoo, FreeBSD
Posts: 176
Rep:
|
Quote:
Originally Posted by Woodsman
When I run upower -d I see the following at the end:
can-suspend: no
|
Oh, sorry. I don't use pm-suspend/hibernate so it didn't realized at first what that meant.
Quote:
Originally Posted by Woodsman
Are you saying a non-root user has to type that entire gobbledygook string to suspend to ram? Or place that string into a script wrapper?
|
I use bash script as wrapper and as far as I know, there isn't better way. I don't like it much either, but once it's set up, it just works  I have menu entry for suspend and hibernation in Fluxbox and sometimes I forget that these scripts are there.
I wonder why it doesn't work on your system. On both 14.0 and current it works like a charm without any polkit configuration file. It works from either console or XFCE logout GUI, which I believe uses the same thing under the hood.
|
|
|
08-01-2013, 02:11 PM
|
#10
|
Member
Registered: Sep 2012
Distribution: Slackware
Posts: 88
Rep: 
|
On my computer, I went the "sudo" way.
with visudo I've added:
Code:
elesmod ALL=NOPASSWD: /usr/sbin/pm-suspend
and I've made an alias for it:
Code:
alias susp='sudo /usr/sbin/pm-suspend'
so whenever I want to suspend my machine to RAM, I just type "susp" in xterm 
|
|
|
08-03-2013, 03:03 PM
|
#11
|
Member
Registered: Aug 2012
Posts: 484
Rep: 
|
Quote:
Originally Posted by Woodsman
Thanks.  That pkla file did the trick. Now upower -d shows can-suspend: yes. No reboot required, just logout/login.
Now, where in the Slackware documentation would I have found that solution?

|
You can get more information with man pklocalauthority. There's also the polkit reference @freedesktop.org.
--mancha
|
|
|
08-03-2013, 04:56 PM
|
#12
|
Member
Registered: May 2007
Posts: 776
|
I don't use PolicyKit, or polkit, or whatever it will end up being.
In /etc/rc.d/rc.local, I set my permissions
chmod 664 /sys/power/state
chgrp power /sys/power/state
Now anyone that logs in with the power group can do
echo 'mem' > /sys/power/state
This makes it dead simple.
|
|
1 members found this post helpful.
|
08-03-2013, 06:20 PM
|
#13
|
Senior Member
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482
Original Poster
|
Quote:
This makes it dead simple.
|
Well, sort of --- to experienced users. My "confusion" is why aren't those settings the default? This is similar to Torvalds' rant months ago about not letting non-root users configure printers.
|
|
|
08-03-2013, 07:26 PM
|
#14
|
Member
Registered: Jan 2011
Location: Czech Republic
Distribution: Slackware, Gentoo, FreeBSD
Posts: 176
Rep:
|
Quote:
Originally Posted by Woodsman
Well, sort of --- to experienced users. My "confusion" is why aren't those settings the default? This is similar to Torvalds' rant months ago about not letting non-root users configure printers.
|
Is your slackware 14.0 clean install or upgraded from previous version? I just checked one machine with slack 14.0 (32 bit, but it shouldn't matter) and it lets me suspend or hibernate as regular user. Well, suspend doesn't work quite right as it freeze on black screen after wakeup, but at least it lets me suspend system to ram.
Are you sure you don't have any leftover or old configuration files from older slack?
Try these commands and compare output with this.
Code:
[user] $ groups
users lp floppy audio video cdrom plugdev power netdev scanner
[root] # tree /etc/polkit-1/
/etc/polkit-1/
|-- localauthority
| |-- 10-vendor.d
| |-- 20-org.d
| |-- 30-site.d
| |-- 50-local.d
| | |-- 10-org.freedesktop.NetworkManager.pkla
| | `-- 20-plugdev-group-mount-override.pkla
| `-- 90-mandatory.d
|-- localauthority.conf.d
| `-- 50-localauthority.conf
`-- nullbackend.conf.d
`-- 50-nullbackend.conf
|
|
|
08-03-2013, 07:57 PM
|
#15
|
Member
Registered: May 2007
Posts: 776
|
On my eeepc, suspend works fine from the lid and the dock on XFCE when I got the appropriate environment running on the stock Slackware 14.0. I have my eeepc set up this way so the wife won't get frustrated with me. I think some of this polkit desktop integration must be untested, as I've seen your question asked before (why permissions for can-suspend is no for no good reason). If I was in your boat, I would probably be ranting like Torvalds.
I'm not sure what DE your are using. If you are using XFCE, I am seriously contemplating forking xfce4-session to bypass polkit/consolekit for stuff like suspend when I upgrade to Slackware 14.1. I'm doing this to try to get a system that is future proof to this userspace madness. This should make the same functions transparent to less experience users, and work at least more often than polkit.
|
|
|
All times are GMT -5. The time now is 01:26 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|