You are not logged in.

#1 2009-04-18 15:46:32

mgangav
Member
Registered: 2009-04-18
Posts: 21

Getting Arch to pm-suspend on lid close [SOLVED]

Hello,

I want Arch to suspend to RAM when I close my laptop lid. Here is what I did:

I installed pm-utils. I also followed the wiki and set it up so that I can just say

sudo pm-suspend

and the computer suspends with the need to type in your password.

Then, I installed acpid to have a way to capture acpi events.

Now, from what I read on the wiki and in these forums, I had to edit /etc/acpi/handler.sh
Here is the pertinent code that I edited:

button/lid)
        #echo "LID switched!">/dev/tty5
        logger "ACPI lid switched $1 $2"
        if [ -n "`grep close /proc/acpi/button/lid/LID/state`" ]; then
            /usr/sbin/pm-suspend
            logger -s "ACPI lid closed";
        elif [ -n "`grep open /proc/acpi/button/lid/LID/state`" ]; then
            logger -s "ACPI lid opened"
        else
            logger -s "Couldn't detect Lid state"
        fi
        ;;

but the problem is that when I close the lid, it writes "ACPI lid closed" to the logfile, but instead of suspending the laptop, it just blanks the screen. Here is what it says in the log file

Apr 18 11:02:45 Treadstone logger: ACPI lid closed
Apr 18 11:02:45 Treadstone acpid: client connected from 4790[0:1000]
Apr 18 11:02:45 Treadstone acpid: 1 client rule loaded
Apr 18 11:02:47 Treadstone acpid: client 4790[0:1000] has disconnected
Apr 18 11:02:47 Treadstone logger: ACPI lid switched button/lid LID
Apr 18 11:02:47 Treadstone logger: ACPI lid opened

Any help will be greatly appreciated.

Last edited by mgangav (2009-04-18 19:46:01)

Offline

#2 2009-04-18 15:50:06

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Getting Arch to pm-suspend on lid close [SOLVED]

You need check the pm-suspend log for pointers smile.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#3 2009-04-18 16:01:02

mgangav
Member
Registered: 2009-04-18
Posts: 21

Re: Getting Arch to pm-suspend on lid close [SOLVED]

B wrote:

You need check the pm-suspend log for pointers smile.

Ok, I checked the pm-suspend.log Here are it's contents:

Initial commandline parameters: 
Sat Apr 18 11:45:03 EDT 2009: Running hooks for suspend.
/usr/lib/pm-utils/sleep.d/00auto-quirk suspend suspend: Adding quirks from HAL: --quirk-dpms-on --quirk-dpms-suspend --quirk-vbe-post --quirk-vbemode-restore --quirk-vbestate-restore --quirk-vga-mode-3 
success.
/usr/lib/pm-utils/sleep.d/00logging suspend suspend: Linux Treadstone 2.6.28-ARCH #1 SMP PREEMPT Sun Mar 8 10:18:28 UTC 2009 i686 Intel(R) Core(TM)2 CPU T5500 @ 1.66GHz GenuineIntel GNU/Linux
Module                  Size  Used by
ipv6                  260340  10 
i915                   58372  2 
drm                    83880  3 i915
fuse                   53020  2 
joydev                 11712  0 
snd_seq_oss            31872  0 
snd_seq_midi_event      8192  1 snd_seq_oss
snd_seq                49968  4 snd_seq_oss,snd_seq_midi_event
snd_seq_device          8204  2 snd_seq_oss,snd_seq
snd_pcm_oss            40192  0 
uvcvideo               57736  0 
compat_ioctl32          3072  1 uvcvideo
videodev               34176  1 uvcvideo
v4l1_compat            15364  2 uvcvideo,videodev
snd_mixer_oss          16512  1 snd_pcm_oss
arc4                    3712  2 
ecb                     4608  2 
b44                    28560  0 
ssb                    40964  1 b44
pcmcia                 35532  1 ssb
sdhci_pci               9088  0 
sdhci                  17028  1 sdhci_pci
container               5248  0 
mii                     6528  1 b44
iwl3945                91128  0 
mmc_core               46876  1 sdhci
uhci_hcd               24592  0 
yenta_socket           25996  1 
rsrc_nonstatic         13056  1 yenta_socket
pcmcia_core            34452  4 ssb,pcmcia,yenta_socket,rsrc_nonstatic
snd_pcsp               11048  0 
sg                     26804  0 
mac80211              161184  1 iwl3945
snd_hda_intel         412980  0 
snd_hwdep               9092  1 snd_hda_intel
psmouse                55828  0 
ehci_hcd               36876  0 
video                  18704  0 
output                  4608  1 video
snd_pcm                70020  3 snd_pcm_oss,snd_pcsp,snd_hda_intel
snd_timer              21384  2 snd_seq,snd_pcm
snd_page_alloc         10120  2 snd_hda_intel,snd_pcm
snd                    50852  10 snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_pcsp,snd_hda_intel,snd_hwdep,snd_pcm,snd_timer
soundcore               8160  1 snd
cfg80211               31760  2 iwl3945,mac80211
serio_raw               7172  0 
usbcore               136848  4 uvcvideo,uhci_hcd,ehci_hcd
i2c_i801               10896  0 
i2c_core               22804  1 i2c_i801
intel_agp              27836  1 
agpgart                31572  3 drm,intel_agp
iTCO_wdt               12836  0 
iTCO_vendor_support     4996  1 iTCO_wdt
acer_wmi               16320  0 
rfkill                 11596  4 iwl3945,acer_wmi
led_class               5508  2 iwl3945,acer_wmi
wmi                     7848  1 acer_wmi
evdev                  11296  7 
thermal                17180  0 
processor              41388  3 thermal
fan                     6276  0 
button                  7824  0 
battery                12036  0 
ac                      6020  0 
rtc_cmos               12332  0 
rtc_core               17564  1 rtc_cmos
rtc_lib                 4480  1 rtc_core
ext3                  127112  2 
jbd                    46996  1 ext3
mbcache                 8708  1 ext3
sr_mod                 16708  0 
cdrom                  35360  1 sr_mod
sd_mod                 26904  5 
pata_acpi               6016  0 
ata_piix               23300  4 
ata_generic             6788  0 
libata                157856  3 pata_acpi,ata_piix,ata_generic
scsi_mod              102164  4 sg,sr_mod,sd_mod,libata
             total       used       free     shared    buffers     cached
Mem:       2065460     482372    1583088          0      60728     194692
-/+ buffers/cache:     226952    1838508
Swap:      2931852          0    2931852
success.
/usr/lib/pm-utils/sleep.d/00powersave suspend suspend: success.
/usr/lib/pm-utils/sleep.d/01grub suspend suspend: not applicable.
/usr/lib/pm-utils/sleep.d/11netcfg suspend suspend: /bin/stty: standard input: Inappropriate ioctl for device
success.
/usr/lib/pm-utils/sleep.d/49bluetooth suspend suspend: not applicable.
/usr/lib/pm-utils/sleep.d/55NetworkManager suspend suspend: success.
/usr/lib/pm-utils/sleep.d/75modules suspend suspend: not applicable.
/usr/lib/pm-utils/sleep.d/90chvt suspend suspend: success.
/usr/lib/pm-utils/sleep.d/90clock suspend suspend: not applicable.
/usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend: success.
/usr/lib/pm-utils/sleep.d/95led suspend suspend: not applicable.
/usr/lib/pm-utils/sleep.d/98smart-kernel-video suspend suspend: success.
/etc/pm/sleep.d/99lock suspend suspend: xscreensaver-command: warning: $DISPLAY is not set: defaulting to ":0.0".
No protocol specified
xscreensaver-command: can't open display :0.0
Returned exit code 1.
Sat Apr 18 11:45:05 EDT 2009: Inhibit found, will not perform suspend
Sat Apr 18 11:45:05 EDT 2009: Running hooks for resume
/usr/lib/pm-utils/sleep.d/98smart-kernel-video resume suspend: success.
/usr/lib/pm-utils/sleep.d/95led resume suspend: not applicable.
/usr/lib/pm-utils/sleep.d/94cpufreq resume suspend: success.
/usr/lib/pm-utils/sleep.d/90clock resume suspend: not applicable.
/usr/lib/pm-utils/sleep.d/90chvt resume suspend: success.
/usr/lib/pm-utils/sleep.d/75modules resume suspend: success.
/usr/lib/pm-utils/sleep.d/55NetworkManager resume suspend: success.
/usr/lib/pm-utils/sleep.d/49bluetooth resume suspend: not applicable.
/usr/lib/pm-utils/sleep.d/11netcfg resume suspend: /bin/stty: standard input: Inappropriate ioctl for device
success.
/usr/lib/pm-utils/sleep.d/01grub resume suspend: not applicable.
/usr/lib/pm-utils/sleep.d/00powersave resume suspend: success.
/usr/lib/pm-utils/sleep.d/00logging resume suspend: success.
/usr/lib/pm-utils/sleep.d/00auto-quirk resume suspend: success.

From what I can tell, it seems that xscreensaver doesn't want to start for some reason. By the way here are the contents of my /etc/pm/sleep.d/

#!/bin/bash
case $1 in
    suspend)
        xscreensaver-command -l
    ;;
    resume)
        echo "Coming out of sleep mode"
    ;;
    *)
        echo "Doing something else"
    ;;
esac

I wonder if xscreensave has anything to do with this?

Offline

#4 2009-04-18 16:06:35

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Getting Arch to pm-suspend on lid close [SOLVED]

/etc/pm/sleep.d/99lock suspend suspend: xscreensaver-command: warning: $DISPLAY is not set: defaulting to ":0.0".
No protocol specified
xscreensaver-command: can't open display :0.0
Returned exit code 1.
Sat Apr 18 11:45:05 EDT 2009: Inhibit found, will not perform suspend

looks like the culprit. It's not that it cannot run xscreensaver - it cannot suspend because of it.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#5 2009-04-18 16:09:57

mgangav
Member
Registered: 2009-04-18
Posts: 21

Re: Getting Arch to pm-suspend on lid close [SOLVED]

B wrote:
/etc/pm/sleep.d/99lock suspend suspend: xscreensaver-command: warning: $DISPLAY is not set: defaulting to ":0.0".
No protocol specified
xscreensaver-command: can't open display :0.0
Returned exit code 1.
Sat Apr 18 11:45:05 EDT 2009: Inhibit found, will not perform suspend

looks like the culprit. It's not that it cannot run xscreensaver - it cannot suspend because of it.

Shoot, well I guess that I could remove xscreensaver, but the problem is that I had would really like to have the screen lock while suspending.
The weird thing is that when I run "sudo pm-suspend" from the command line, it runs xscreensaver and suspends fine while locking the screen as well. Do you think that this could be a permissions problem? How can I fix this...

Offline

#6 2009-04-18 16:13:36

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Getting Arch to pm-suspend on lid close [SOLVED]

I think somehow you're having xscreensaver called while X is already shut down.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#7 2009-04-18 16:33:18

mgangav
Member
Registered: 2009-04-18
Posts: 21

Re: Getting Arch to pm-suspend on lid close [SOLVED]

B wrote:

I think somehow you're having xscreensaver called while X is already shut down.

Well, um, well, is there an alternative to using this?

Well, What I just want to do is: I want the laptop to lock the screen and suspend to RAM when I close the lid. How do you do it? I am looking for alternative solutions also

Offline

#8 2009-04-18 16:35:07

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Getting Arch to pm-suspend on lid close [SOLVED]

There is no point in locking the screen when suspending afaict - there is in locking the screen when resuming (you will suspend, but someone else might wake up your laptop).


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#9 2009-04-18 16:38:21

mgangav
Member
Registered: 2009-04-18
Posts: 21

Re: Getting Arch to pm-suspend on lid close [SOLVED]

B wrote:

There is no point in locking the screen when suspending afaict - there is in locking the screen when resuming (you will suspend, but someone else might wake up your laptop).

Oh yeah. So what I will try to do now is instead of having it lock on suspending. I will have it lock the screen after thawing.

Offline

#10 2009-04-18 16:50:37

mgangav
Member
Registered: 2009-04-18
Posts: 21

Re: Getting Arch to pm-suspend on lid close [SOLVED]

Ok, so changing xscreensaver from locking on suspending to locking on resuming has helped in that now the laptop suspends on closing the lid, but the problem is that while resuming, the $DISPLAY variable is still not set and xscreensaver fails to lock the screen. This is even though I have xscreensaver be one of the last things to start on resume...

Now I will try putting startx before starting xscreensaver. Hopes this works.

Offline

#11 2009-04-18 16:53:31

mgangav
Member
Registered: 2009-04-18
Posts: 21

Re: Getting Arch to pm-suspend on lid close [SOLVED]

Ok, that didn't help at all. Now I get the error message that it couldn't startx as an Xserver was already running....  But if this is the case, why was $DISPLAY not set to ":0.0" yet?

-Hoping for help..
-mgangav

Note: Once again, I dont know if the way I am getting my laptop to suspend is correct, I am looking for alternate solutions as well. How did YOU get your laptop to suspend to ram on closing the lid (and having it lock the screen on resuming)

Note2: Oh well, I guess that it must be some small thing that must must be causing some error. I mean, when I type "sudo pm-suspend" the laptop suspends fine and locks the screen on resuming. But when I close the lid, it is not able to lock the screen.

Last edited by mgangav (2009-04-18 17:44:18)

Offline

#12 2009-04-18 17:55:58

mgangav
Member
Registered: 2009-04-18
Posts: 21

Re: Getting Arch to pm-suspend on lid close [SOLVED]

SOLVED!!!! big_smile:D:D:D

I realized, that it was a permissions issue after all!!!

Instead of calling xscreensaver-command -l by itself, I had to change it to

su USERNAME -c "xscreensaver-command -l"

Now, it locks the screen on resuming no matter how I suspend my laptop.

Thanks

Oh yeah guys... How do you mark a thread as solved around here.....

~edited for clarity

Last edited by mgangav (2009-04-18 17:59:27)

Offline

#13 2009-04-18 18:21:40

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Getting Arch to pm-suspend on lid close [SOLVED]

Congrats. Just edit the title of your topic (first post).


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

Board footer

Powered by FluxBB