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

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".

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.

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.

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.

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.

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

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])

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.]

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).

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.

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.