You are not logged in.

#1 2011-11-20 15:55:28

spo11
Member
From: breaking your strands
Registered: 2011-02-23
Posts: 30
Website

[SOLVED]A few seconds after resume from suspend, system suspends again

I have xscreensaver lock setup to lock the screen when resuming. Xscreensaver-lock shows up successfully, I log in, etc. But just a few seconds after logging in, the system suspends again.

I'm not really sure what's causing this.

I used the shell script from the wiki to have Xscreensaver lock my screen on resume:

 #!/bin/sh
 #
 # 00screensaver-lock: lock workstation on hibernate or suspend
  
 DBUS=$(ps aux | grep 'dbus-launch' | grep -v root)
 if [[ ! -z $DBUS ]];then
  USER=$(echo $DBUS | awk '{print $1}')
  USERHOME=$(getent passwd $USER | cut -d: -f6)
  export XAUTHORITY="$USERHOME/.Xauthority"
  for x in /tmp/.X11-unix/*; do
    DISPLAYNUM=$(echo $x | sed s#/tmp/.X11-unix/X##)
    if [[ -f "$XAUTHORITY" ]]; then
            export DISPLAY=":$DISPLAYNUM"
    fi
  done
 else
  USER=username
  USERHOME=/home/username
  export XAUTHORITY="$USERHOME/.Xauthority"
  export DISPLAY=":0"
 fi
 
 case "$1" in
    hibernate|suspend)
       su $USER -c "/usr/bin/xscreensaver-command -lock" & # or any other such as /usr/bin/xscreensaver-command -lock
       ;;
    thaw|resume)
       ;;
    *) exit $NA
       ;;
 esac

How do I prevent the system from suspending again after logging in?

Last edited by spo11 (2011-11-20 22:20:10)

Offline

#2 2011-11-20 19:20:27

ri
Member
Registered: 2008-10-09
Posts: 73

Re: [SOLVED]A few seconds after resume from suspend, system suspends again

Are you using a laptop? I had the same problem with my computer but solved it after some research.
In /etc/acpi/handler.sh at the end it looks something like:

button/lid)
/usr/sbin/pm-suspend
#echo "LID switched!">/dev/tty5
;;

Edit it to:

button/lid)
if [[ `cat /proc/acpi/button/lid/LID/state | awk '{print $2}'` = "closed" ]]
then
/usr/sbin/pm-suspend
fi
#echo "LID switched!">/dev/tty5
;;

I hope that'll help you smile

Offline

#3 2011-11-20 21:35:22

vladthedog
Member
Registered: 2010-12-03
Posts: 45

Re: [SOLVED]A few seconds after resume from suspend, system suspends again

i was just hopping online because lately i've been having the same issue.  This seems to have worked for me.  Thanks.

Offline

#4 2011-11-20 22:19:41

spo11
Member
From: breaking your strands
Registered: 2011-02-23
Posts: 30
Website

Re: [SOLVED]A few seconds after resume from suspend, system suspends again

ri wrote:

Are you using a laptop? I had the same problem with my computer but solved it after some research.
In /etc/acpi/handler.sh at the end it looks something like:

button/lid)
/usr/sbin/pm-suspend
#echo "LID switched!">/dev/tty5
;;

Edit it to:

button/lid)
if [[ `cat /proc/acpi/button/lid/LID/state | awk '{print $2}'` = "closed" ]]
then
/usr/sbin/pm-suspend
fi
#echo "LID switched!">/dev/tty5
;;

I hope that'll help you smile

That worked like a charm! smile

Thank you so much. I was unable to find a solution elsewhere.

For others who might be having this problem, you might need to change LID in the code ri posted above to whatever it is listed as for your system. Mine was LID0. To check, just

$ cd /proc/acpi/button/lid
$ ls
LID0

Offline

#5 2011-11-21 04:43:18

archtaku
Member
Registered: 2010-07-02
Posts: 84

Re: [SOLVED]A few seconds after resume from suspend, system suspends again

For those who have modified /etc/acpi/handler.sh to add a suspend action on "button/lid", kernel 3.1 has changed the ACPI events slightly, causing similar behavior. Perhaps the events are linked in some way?

I've filed a bug report: https://bugs.archlinux.org/task/27201

Offline

#6 2012-04-24 04:23:33

santodelaespada
Member
Registered: 2009-04-15
Posts: 50

Re: [SOLVED]A few seconds after resume from suspend, system suspends again

the use of acpid always brings up this issue.
It duplicates the desktop manager's call for pm-suspend, one arrives first, the other arrives after resuming the system.
The cure: remove one of the methods to call pm-suspend.
I rather not to use acpid, I don't need it anyway.

Offline

Board footer

Powered by FluxBB