Bug 1092905

Summary: Laptop won't suspend when undocked with lid closed
Product: Red Hat Enterprise Linux 7 Reporter: Michal Domonkos <mdomonko>
Component: xorg-x11-drv-intelAssignee: Adam Jackson <ajax>
Status: CLOSED NEXTRELEASE QA Contact: Desktop QE <desktop-qa-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.0CC: cbm, jkoten, lmiksik, lnykryn, mclasen, mdomonko, ofourdan, rmatos, svashisht, systemd-maint-list, tpelka, vbenes
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-06 17:17:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1203710    
Attachments:
Description Flags
inhibit locks
none
xrandr output none

Description Michal Domonkos 2014-04-30 08:29:39 UTC
Description of problem:
Normally, when a laptop is undocked with its lid being already closed, it is expected to suspend after 30 seconds.  This really works, except for the case when the lid was already closed at the time the current GNOME session started.

I originally filed this as bug 1081093 against gnome-settings-daemon but according to comment 28 in that bug it seems like systemd might be a better place to look.

The culprit seems to be logind that, once its lid inhibitor is released by g-s-d on undocking, won't poll the lid state again (since there was no lid open event before) and thus won't issue a suspend call.

Version-Release number of selected component (if applicable):
systemd-208-11.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. Have the laptop docked and the lid closed
2. Log in to GNOME
3. Undock
4. Wait for ~30 seconds

Actual results:
Laptop doesn't suspend (waiting any longer makes no difference).

Expected results:
Laptop suspends.

Comment 2 Lukáš Nykrýn 2014-06-12 15:56:22 UTC
Would it be possible in g-s-d to react on the "undock" event, check state of the lid and accordingly initiate suspend (well after some safe period of time)?

Comment 3 Rui Matos 2014-06-13 09:32:30 UTC
(In reply to Lukáš Nykrýn from comment #2)
> Would it be possible in g-s-d to react on the "undock" event, check state of
> the lid and accordingly initiate suspend (well after some safe period of
> time)?

It's possible but note that this is still an issue if you're not running GNOME.

Comment 4 Bastien Nocera 2014-06-16 15:25:54 UTC
(In reply to Lukáš Nykrýn from comment #2)
> Would it be possible in g-s-d to react on the "undock" event, check state of
> the lid and accordingly initiate suspend (well after some safe period of
> time)?

We don't listen to any dock related events, only to displays coming and going.

Comment 5 Bastien Nocera 2014-12-17 09:10:37 UTC
Seems that the X server isn't detecting that you're disconnecting the display (through disconnecting the laptop from the dock).

What display chipset does your laptop use? What's the output of "xrandr -q" once the docking station is disconnected? You can do that by running:
sleep 10; xrandr -q ; systemd-inhibit --list
before disconnecting the machine from the dock, and disconnecting it straight away. Wait a little while until the command gets run, and attach the output here.

(In reply to Lukáš Nykrýn from comment #2)
> Would it be possible in g-s-d to react on the "undock" event, check state of
> the lid and accordingly initiate suspend (well after some safe period of
> time)?

gnome-settings-daemon shouldn't have to do that. From the moment that it drops the inhibitor, it's up to logind to act upon the state of the machine.

Comment 7 Michal Domonkos 2015-01-06 16:41:54 UTC
(In reply to Bastien Nocera from comment #5)
> Seems that the X server isn't detecting that you're disconnecting the
> display (through disconnecting the laptop from the dock).
> 
> What display chipset does your laptop use? What's the output of "xrandr -q"
> once the docking station is disconnected? You can do that by running:
> sleep 10; xrandr -q ; systemd-inhibit --list
> before disconnecting the machine from the dock, and disconnecting it
> straight away. Wait a little while until the command gets run, and attach
> the output here.

I'm attaching the requested outputs.

Note that physically I had one monitor attached to the docking station (via the DisplayPort) that corresponds to DP2 in the xrandr output.  So apparently it was recognized being disconnected when I undocked the laptop.

Comment 8 Michal Domonkos 2015-01-06 16:42:54 UTC
Created attachment 976865 [details]
inhibit locks

Output of "systemd-inhibit --list" after undocking.

Comment 9 Michal Domonkos 2015-01-06 16:43:20 UTC
Created attachment 976866 [details]
xrandr output

Output of "xrandr -q" after undocking.

Comment 10 Michal Domonkos 2015-01-06 16:45:54 UTC
Regarding the display chipset, it's a ThinkPad T520 with a single GPU being an onboard Intel.

Comment 11 Bastien Nocera 2015-02-16 13:01:05 UTC
"Multiple displays attached" and the xrandr output shows:
DP3 disconnected (normal left inverted right x axis y axis)
  1920x1080 (0x53)  148.5MHz
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock   67.5KHz
        v: height 1080 start 1084 end 1089 total 1125           clock   60.0Hz

Seems like X server can't see the output disappearing. Reassigning to the xorg intel driver.