You are not logged in.

#1 2007-12-28 16:11:15

Cippa Lippa
Member
From: Toronto, ON
Registered: 2007-04-12
Posts: 159

Suspend to RAM works only if run as root

Hi all

I have this problem. I can perfectly suspend to Ram with s2ram -f but only if I run it as root
If I run it as a normal user I get

fgconsole: getconsolefd: Invalid argument
Switching from vt-1 to vt1
chvt: VT_ACTIVATE: Bad file descriptor
VT_WAITACTIVE: Bad file descriptor
Segmentation fault


Any idea??

Cheers

Offline

#2 2007-12-28 19:52:36

vogt
Member
From: Toronto, Canada
Registered: 2006-11-25
Posts: 389

Re: Suspend to RAM works only if run as root

users do not have the permissions to suspend to ram.

The solution would seem to be sudo.

Just check out the examples in /etc/sudoers with visudo. (pacman -Sy sudo)

Offline

#3 2007-12-28 20:25:43

pelle.k
Member
From: Åre, Sweden (EU)
Registered: 2006-04-30
Posts: 667

Re: Suspend to RAM works only if run as root

I usually suspend with pm-utils (pm-suspend), and that works if you are a member of the "power" group. I don't  know if that is applicable to s2ram though...


"Your beliefs can be like fences that surround you.
You must first see them or you will not even realize that you are not free, simply because you will not see beyond the fences.
They will represent the boundaries of your experience."

SETH / Jane Roberts

Offline

#4 2007-12-28 23:01:08

Cippa Lippa
Member
From: Toronto, ON
Registered: 2007-04-12
Posts: 159

Re: Suspend to RAM works only if run as root

I checked that and I get the same problem even after adding my account to the power group... :-(

Offline

#5 2007-12-28 23:02:09

Cippa Lippa
Member
From: Toronto, ON
Registered: 2007-04-12
Posts: 159

Re: Suspend to RAM works only if run as root

yep, I am already using sudo to suspend to ram but it is annoying to type a password just to suspend

Offline

#6 2007-12-28 23:20:59

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: Suspend to RAM works only if run as root

You can set sudo so it doesn't ask for password for particular commands.  You have to run "visudo" as root, to edit the sudoers file and add something like this:

[your user]   ALL = NOPASSWD: /usr/sbin/s2ram

to the "User privilege specification" section.

Offline

#7 2007-12-29 14:34:11

Cippa Lippa
Member
From: Toronto, ON
Registered: 2007-04-12
Posts: 159

Re: Suspend to RAM works only if run as root

fwojciec wrote:

You can set sudo so it doesn't ask for password for particular commands.  You have to run "visudo" as root, to edit the sudoers file and add something like this:

[your user]   ALL = NOPASSWD: /usr/sbin/s2ram

to the "User privilege specification" section.

Thanks man, this worked!, you rock!
Now, if I can use a little more of your patience, how to link the s2ram command to the closing of the lid?

cheers

Offline

#8 2007-12-29 14:49:04

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: Suspend to RAM works only if run as root

Run the acpid service and define an action fro the lid event in /etc/acpi


Mortuus in anima, curam gero cutis

Offline

#9 2007-12-29 15:24:58

delphiki
Member
Registered: 2007-11-17
Posts: 66
Website

Re: Suspend to RAM works only if run as root

I can add my confidence that defining the action even in /etc/acpi is probably the best method to go for, especially if you want to have the seamless "set it and forget it" mentality.

I've used the acpid daemon and utils for at least 2 years without any issue.

Offline

#10 2007-12-29 15:25:25

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: Suspend to RAM works only if run as root

What patroclo7 said, but in more detail...

Make sure that you have acpid daemon installed and enabled.  Edit the file /etc/acpi/handler.sh and look for the section of the script that says "button/lid)".  Add a new line with "sudo s2ram" (or whatever the command you use for for suspending) to that section (before the ";;") and restart the acpid daemon.  This should work, as long as acpid correctly identifies that when the lid is closed/opened which should be the case on most laptops.

Offline

#11 2007-12-29 17:04:20

Cippa Lippa
Member
From: Toronto, ON
Registered: 2007-04-12
Posts: 159

Re: Suspend to RAM works only if run as root

thanks fwojciec for the great input as I had no idea how to do that otherwise.
The lid closing correctly put the system in standby. When I reopen it the system tries to awaken but then goes in standby again... I guess the closing and opening are giving the same message to acpid. Is there a way we can avoid that?

Offline

#12 2007-12-29 17:48:26

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: Suspend to RAM works only if run as root

Sorry - I've never had a problem of this kind with any of my laptops, so no idea how to fix that.  A crude workaround would be to assign the suspend command to a key combination and to suspend that way while you're looking for a solution to the acpi method.

Offline

#13 2007-12-30 16:16:27

briest
Member
From: Katowice, PL
Registered: 2006-05-04
Posts: 468

Re: Suspend to RAM works only if run as root

Cippa Lippa wrote:

When I reopen it the system tries to awaken but then goes in standby again... I guess the closing and opening are giving the same message to acpid

On my laptop, I have experienced the same behaviour, due to 'lid' event being generated during opening and closing as well. The solution was to put

fgrep -q closed /proc/acpi/button/lid/LID/state || exit 0

before putting laptop to sleep.

Offline

#14 2007-12-31 05:27:35

Cippa Lippa
Member
From: Toronto, ON
Registered: 2007-04-12
Posts: 159

Re: Suspend to RAM works only if run as root

where should I "put" this???
is this a terminal command?

Offline

#15 2007-12-31 05:39:39

Cippa Lippa
Member
From: Toronto, ON
Registered: 2007-04-12
Posts: 159

Re: Suspend to RAM works only if run as root

I tried to run this

fgrep -q closed /proc/acpi/button/lid/LID/state || exit 0

as a command but now when I reopen the lid the system doesn't awaken anymore by itself and when I wake it manually it takes forever to do it... mmmm....

Offline

#16 2007-12-31 05:47:13

Cippa Lippa
Member
From: Toronto, ON
Registered: 2007-04-12
Posts: 159

Re: Suspend to RAM works only if run as root

no, ok... I got it it put it in the handler.sh file before the sudo s2ram -f command

works like a charm!

Offline

#17 2007-12-31 10:52:38

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: Suspend to RAM works only if run as root

Yes, this is a quite common scenario in acpi, sadly, also in passing from battery to ac: two events are seen in both cases (battery and ac), and so acpid needs to check the final state after the two events to see if the system is actually on battery or on AC. Something analogous seems to happen with your lid.


Mortuus in anima, curam gero cutis

Offline

#18 2008-01-01 12:30:36

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Suspend to RAM works only if run as root

I use KLaptop, and I believe it made the KDE ACPI Helper application set-uid root smile Or you can make /proc/acpi/sleep writable everytime at boot via rc.local if you so desire.

My lid is BIOS-handled so that's good for me big_smile

Last edited by schivmeister (2008-01-01 12:31:03)


I need real, proper pen and paper for this.

Offline

Board footer

Powered by FluxBB