[regression] Suspend on lid close broken on Oneiric

Bug #863834 reported by gpothier
292
This bug affects 59 people
Affects Status Importance Assigned to Milestone
upower (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

With Oneiric, I cannot have my laptop go into suspend mode by closing the lid anymore. In the gnome settings, the lid close action is configured to suspend (both on AC and on battery), but closing the lid does nothing.
Here is the output of "acpid -d" when I close the lid:
No protocol specified
xset: unable to open display ":0"

And here it what it says when I open the lid:
Sessions still open, not unmounting

Here is the output of acpi_listen when I close/open the lid:
button/lid LID0 00000080 00000009
button/lid LID0 00000080 0000000a

Here is what /proc/acpi says with the lid open and closed:
gpothier@tadzim:~$ cat /proc/acpi/button/lid/*/state
state: open
gpothier@tadzim:~$ cat /proc/acpi/button/lid/*/state
state: closed

Suspending in itself works fine with the laptop's suspend button.

Suspend on lid close worked fine in Natty.

Revision history for this message
tsg1zzn (tsg1zzn) wrote :

This is funny, because I have the exact reverse problem (I turned off suspend on lid close, and it still suspends when I close the lid).

affects: ubuntu → gnome-power-manager (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-power-manager (Ubuntu):
status: New → Confirmed
Revision history for this message
gpothier (gpothier) wrote :

I just noticed the problem seems to happen only when I have an external monitor connected. Is this by design? If so, I guess it should be configurable, or at least something should appear on the external monitor saying that the machine is not going to sleep, otherwise it is quite confusing, as there is a setting that explicitly says "suspend when lid is closed".

Revision history for this message
Alfrenovsky (alfredo-fing) wrote :

This happens when I close the lid on ASUS1215.
Upgrade to oneiric didn't work so this is a fresh install

acpid: 32 rules loaded
acpid: waiting for events: event logging is off
acpid: client connected from 26051[0:0]
acpid: 1 client rule loaded

awk: line 1: regular expression compile failed (missing '(')
:0)
awk: line 1: regular expression compile failed (missing '(')
:0)

Revision history for this message
James (loope) wrote :

I have the exact same behavior on Oneiric with a thinkpad X220 running an non-unity wm (wmii). When the lid is closed in unity, suspend works, however in wmii acpid outputs the following:

acpid: 32 rules loaded
acpid: waiting for events: event logging is off
acpid: client connected from 11123[0:0]
acpid: 1 client rule loaded
awk: line 1: regular expression compile failed (missing '(')
:0)
awk: line 1: regular expression compile failed (missing '(')
:0)
awk: line 1: regular expression compile failed (missing '(')
:0)
awk: line 1: regular expression compile failed (missing '(')
:0)

Revision history for this message
James (loope) wrote :

The awk error is caused by a typo in one of the acpid scripts. I've filed a bug here: https://bugs.launchpad.net/ubuntu/+source/acpid/+bug/875447

Fixing it doesn't solve this problem though. acpid acknowledges the lid close event, but no suspend occurs.

Revision history for this message
James (loope) wrote :

I fixed this on my system by adding a script with the following content to /etc/acpi/local/lid.sh.post

#!/bin/bash

grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then

/usr/sbin/pm-suspend

fi

Revision history for this message
Michel Filipe (mfilipe) wrote :

Guys, I found the origin of "problem". Gnome3 changed your politics about power management and now, when an external monitor is connected, gnome-settings-daemon doesn't suspend/hibernate the laptop. See it: http://blogs.gnome.org/hughsie/2011/02/02/is-gnome-3-going-to-melt-your-laptop/

So, either close the bug or convince the gnome devs change this behavior.

Revision history for this message
RPHegde (rphegde) wrote :

I have the exact same issue on a System 76 pangolin laptop. Issue occurs even without connecting to external monitor. Laptop does not suspend on lid close. I doubt it is gnome issue - It happens on a pure KDE (kubuntu 11.10) install as well.

Changed in gnome-power-manager (Ubuntu):
importance: Undecided → Medium
Revision history for this message
carlosv (cvedovatti) wrote :

Hi there, same problem here.
I have switchable graphics HP tm2 Intel/ATI graphic cards.
Closing the lid worked OK on Natty, just upgraded to Oneric, doesn’t work. When I close the lid just turn the screen off.
Now, I don't think is a problem with kernel, drivers, etc. because the function suspends works on both graphic cards if it is done on the menu. But suspend doesn’t work if you close the lid. So it is a problem with the function on this distribution of Ubuntu.
Hope to see it fix soon.

Revision history for this message
Endri Hysenaj (endrih) wrote :

Same problem. I remember it was working on 11.10 up to a certain update but now it is not working anymore. The suspend operation by itself is working perfectly, just it does not react to the close the lid action. I should note that the laptop senses the close the lid operation but does actually nothing on it. I have tried setting the values manually also, no effect.

Revision history for this message
Endri Hysenaj (endrih) wrote :

Guys, i don't know much and i maybe very wrong, but i think i managed to partially solve it. If you open /etc/acpi/lid.sh, which is the script being called when the lid is closed, has nowhere pm-suspend command which actually suspends the computer. I added the line pm-suspend after all the ifs are closed and it suspends, but on wake up it does not ask for password. This leads me to think that this is not a good solution, however maybe it is a clue.

Revision history for this message
RPHegde (rphegde) wrote :

I have reinstalled 11.04 where suspend works fine. I looked at lid.sh and there is no sign of pm-suspend either

#!/bin/bash
# TODO: Change the above to /bin/sh

test -f /usr/share/acpi-support/state-funcs || exit 0

. /usr/share/acpi-support/power-funcs
. /usr/share/acpi-support/policy-funcs
. /etc/default/acpi-support

[ -x /etc/acpi/local/lid.sh.pre ] && /etc/acpi/local/lid.sh.pre

if [ `CheckPolicy` = 0 ]; then exit; fi

grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
    for x in /tmp/.X11-unix/*; do
 displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
 getXuser;
 if [ x"$XAUTHORITY" != x"" ]; then
     export DISPLAY=":$displaynum"
     . /usr/share/acpi-support/screenblank
 fi
    done
else
    for x in /tmp/.X11-unix/*; do
 displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
 getXuser;
 if [ x"$XAUTHORITY" != x"" ]; then
     export DISPLAY=":$displaynum"
     grep -q off-line /proc/acpi/ac_adapter/*/state
     if [ $? = 1 ]
  then
  if pidof xscreensaver > /dev/null; then
      su $user -c "xscreensaver-command -unthrottle"
  fi
     fi
     if [ x$RADEON_LIGHT = xtrue ]; then
  [ -x /usr/sbin/radeontool ] && radeontool light on
     fi
     if [ `pidof xscreensaver` ]; then
  su $user -c "xscreensaver-command -deactivate"
     fi
     su $user -c "xset dpms force on"
 fi
    done
fi
[ -x /etc/acpi/local/lid.sh.post ] && /etc/acpi/local/lid.sh.post

Revision history for this message
RPHegde (rphegde) wrote :

And I am not sure whether this is related, if I pull the power cable, laptop does not say it is unplugged...

Revision history for this message
Endri Hysenaj (endrih) wrote :

Since you have 11.04, can you please see if you have the folder /etc/acpi/local ? because I don't have it for an unknown reason and maybe that is causing the problem. thank you

Revision history for this message
RPHegde (rphegde) wrote :

No, the folder /etc/acpi/local does not exist.

Revision history for this message
Seby (nekoss) wrote :

anyone post the result of command "upower --dump" ?

Revision history for this message
chreko (chreko) wrote :

Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path: /sys/devices/LNXSYSTM:00/device:00/ACPI0003:00/power_supply/AC
  power supply: yes
  updated: Tue Nov 15 22:48:43 2011 (8665 seconds ago)
  has history: no
  has statistics: no
  line-power
    online: yes

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path: /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0
  vendor: Hewlett-Packard
  model: Primary
  serial: 00914 2010/05/13
  power supply: yes
  updated: Wed Nov 16 00:58:20 2011 (888 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    energy: 55.0412 Wh
    energy-empty: 0 Wh
    energy-full: 55.0412 Wh
    energy-full-design: 55.0412 Wh
    energy-rate: 0 W
    voltage: 16.762 V
    percentage: 100%
    capacity: 100%
    technology: lithium-ion

Daemon:
  daemon-version: 0.9.13
  can-suspend: yes
  can-hibernate yes
  on-battery: no
  on-low-battery: no
  lid-is-closed: no
  lid-is-present: yes
  is-docked: yes

Revision history for this message
chreko (chreko) wrote :

Is is-docked supposed to be True even if I do not have a docking station?

Revision history for this message
Seby (nekoss) wrote :

the problem is upower that sees docked when not is docked, isn't a gnome issue, see here: https://bugs.freedesktop.org/show_bug.cgi?id=36818

Revision history for this message
RPHegde (rphegde) wrote :

Regarding comment #7 and #12 - manually adding pm-suspend command; anyone knows how to make the laptop wakeup when the lid is opened without having to press any buttons ?

Revision history for this message
RPHegde (rphegde) wrote :

It is 3.0 kernel bug -> 874749
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/874749
I upgraded from 11.04 to 11.10 and use the 2.6.38 kernel, suspend works fine.

Revision history for this message
Sauthess (sauthess) wrote :

Hi all,

Same problem here with a pavilion dm4 1162sf.

acpi_listen give me this :
button/lid LID0 00000080 00000005 -> lid close event
button/lid LID0 00000080 00000006 -> lid open event
button/lid LID0 00000080 00000007 -> lid close event
button/lid LID0 00000080 00000008 -> lid open event

This is incremental, starting by "00000001" on the first close event...

the /proc/acpi/button/lid/*/state stays always "open" so the script will never catch it as it is today (on other systems like arch linux with 3.1.4-1-ARCH kernel) , the acpi events where clearer with "button/lid LID open" and "button/lid LID close".

I think all is due to this strange information given in acpi events...

Here are the 2 scripts I used for a workaround on my system (I didn't edit directly lid.sh as I want it solved without breaking my actual workaround...) :

cat /etc/acpi/events/lidbtn
# /etc/acpi/events/lidbtn
# Called when the user closes or opens the lid

event=button[ /]lid
action=/etc/acpi/lid2.sh "%e"

cat /etc/acpi/lid2.sh
#!/bin/bash
# TODO: Change the above to /bin/sh

test -f /usr/share/acpi-support/state-funcs || exit 0

. /usr/share/acpi-support/power-funcs
. /usr/share/acpi-support/policy-funcs
. /etc/default/acpi-support

[ -x /etc/acpi/local/lid.sh.pre ] && /etc/acpi/local/lid.sh.pre

PARAM=$(echo $1 | awk '{print $4}')
PARAM2=$(expr `echo $((0x$PARAM))` % 2)

if [ `CheckPolicy` = 0 ]; then exit; fi

if [ $PARAM2 != 0 ]
then
    for x in /tmp/.X11-unix/*; do
 displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
 getXuser;
 if [ x"$XAUTHORITY" != x"" ]; then
     export DISPLAY=":$displaynum"
     . /usr/share/acpi-support/screenblank
 fi
    done
    dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
else
    for x in /tmp/.X11-unix/*; do
 displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
 getXuser;
 if [ x"$XAUTHORITY" != x"" ]; then
     export DISPLAY=":$displaynum"
     grep -q off-line /proc/acpi/ac_adapter/*/state
     if [ $? = 1 ]
  then
  if pidof xscreensaver > /dev/null; then
      su $user -c "xscreensaver-command -unthrottle"
  fi
     fi
     if [ x$RADEON_LIGHT = xtrue ]; then
  [ -x /usr/sbin/radeontool ] && radeontool light on
     fi
     if [ `pidof xscreensaver` ]; then
  su $user -c "xscreensaver-command -deactivate"
     fi
     su $user -c "xset dpms force on"
 fi
    done
fi
[ -x /etc/acpi/local/lid.sh.post ] && /etc/acpi/local/lid.sh.post

after a reboot, all is ok now....

Revision history for this message
carlosv (cvedovatti) wrote :

I just tried the new alpha version of Ubuntu 12.04 and this bug (regression) stills present.

Revision history for this message
Alexei Colin (alexei.colin) wrote :

In my case (Gnome3 on Oneiric on Thinkpad T60 with Radeon X1400) this is a collusion of two issues pointed out separately above:
(1) Gnome3's intended behavior is to disallow suspend while more than one monitor is active (comment #8, comment #3, [1])
(2) upower returns a false positive when asked whether more than one monitor is active (aka the is-docked state) for *some* graphic devices (comment #20, Bug #854404 and [2] is related but my false positive manifests on a system with a single video card)

Potential fix for issue (2) is in a patched upower package available at ppa:alexei.colin/upower (details on the patch are in [2]). Run 'upower -d | grep docked'. Note that because of a known issue with notifications [3] you might have to restart upowerd daemon to see the effect of turning off a screen; also note that the monitor must be cleanly turned off from display settings, pulling the cable doesn't change any state in my experience).

RANT:
(1) see upower rant in [2]
(2) This Gnome3 behavior should be configurable. Once issue (2) is fixed, the Gnome3's *intended* behavior is actually working, but that just creates the issue of how to get rid of this behavior... anybody know if it's configurable at least manually if not in Gnome GUI settings? (I'm not hopeful for more GUI settings after [4])

[1] http://blogs.gnome.org/hughsie/2011/02/02/is-gnome-3-going-to-melt-your-laptop/
[2] https://bugs.freedesktop.org/show_bug.cgi?id=36818
[3] From comment on PollDockDevices in UPower.conf: Poll the kernel for dock state changes. Some drivers are still broken, and do not send out uvents when the connected state changes. default=false
[4] http://afaikblog.wordpress.com/2011/02/03/on-laptop-lids-and-power-settings/

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "upower is-docked detection; ppa:alexei.colin/upower upower_0.9.13-1ac2" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
tags: removed: patch
Revision history for this message
Michael Kogan (michael-kogan) wrote :

I think, I'm also observing this bug on Xubuntu 11.10 (so no Gnome3 here). In my case, suspend by lid close generally works, but it works only after one successful suspend&resume (e.g. by manually calling it via the xfce4-power-manager applet context menu).

Can anyone confirm this behavior?

Revision history for this message
Tim Sablin (tsablin) wrote :

Guys, i had the same problem until i decided to check out any upgrades made out to gnome-power-manager on my Lenovo x220.
It appeared that i automatically upgraded recently to version 3.2.1 and everything broke. Downgrading to 3.2.0 did the job - suspend on lid close is now fine.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in upower (Ubuntu):
status: New → Confirmed
Revision history for this message
Michael Backhaus (mb4ckhaus) wrote :

 /etc/acpi/events/lidbtn triggers /etc/acpi/lid.sh which triggers /etc/acpi/local/lid.sh.post at the end of the script. /etc/acpi/local/* allows you to add your own config (e.g. required for wmii).

generate /etc/acpi/local/lid.sh.post
make it executable
and add:

#!/bin/bash
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
/usr/sbin/pm-suspend
fi

wmii will now go to suspend mode when closing the lid. It'll automatically wake up when opening the lid.

Revision history for this message
Colin Law (colin-law) wrote :

@Michael, that worked perfectly for me (on Quantal). Many thanks.

Revision history for this message
Colin Law (colin-law) wrote :

Actually having said that Michael's suggestion works perfectly is not strictly true. Firstly note that for me it works best if I set the actions in System Settings > Power for lid close to Do Nothing, but even then I sometimes have problems with it not correctly recognising the external monitor on resume, so it starts up with the wrong resolution or not at all. If I hit Ctrl-Alt-F1 then Ctrl-Alt-F7 it generally recovers, sometimes I have to unplug the monitor for a few seconds and then plug it back in.

Revision history for this message
Kris Marien (marien-kris) wrote :

Creating the file "/etc/acpi/local/lid.sh.post" as Michael Backhaus indicates works for me!

Thanks.

Revision history for this message
Graeme Pietersz (fgpietersz) wrote :

Also affects Perfect as of a recent (not sure exactly when) update.

Not the sort of behaviour that should change without a version change IMO. This could lead to some laptops overheating/catching fire etc. so not a good idea at all.

Revision history for this message
Emre Sevinç (emre-sevinc) wrote :

The workaround given by Michael Backhaus (mb4ckhaus) also worked for me (running Ubuntu 12.10 on ThinkPad T500).

Revision history for this message
Robert Giglio (robgig1088) wrote :

I wanted to add that the workaround posted above by Michael Backhaus works perfectly on my X220 running 64-bit Ubuntu 12.10.

Revision history for this message
Colin Law (colin-law) wrote :

This is fixed for me in Saucy, it now suspends when the lid is closed, even with external monitor, without the workarounds.

Revision history for this message
Martin Pitt (pitti) wrote :

upower 0.99 (in Ubuntu 15.04) drops suspend handling, so this is obsolete.

Changed in upower (Ubuntu):
status: Confirmed → Invalid
no longer affects: gnome-power-manager (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.