System goes to sleep with external monitor and lid closed after login

Bug #1716160 reported by Franck
94
This bug affects 19 people
Affects Status Importance Assigned to Milestone
Mutter
Fix Released
High
gdm3 (Ubuntu)
Invalid
Undecided
Andrea Azzarone
Nominated for Zesty by Daniel van Vugt
Artful
Invalid
Undecided
Andrea Azzarone
gnome-settings-daemon (Ubuntu)
Fix Released
High
Andrea Azzarone
Nominated for Zesty by Daniel van Vugt
Artful
Fix Released
High
Andrea Azzarone
mutter (Ubuntu)
Fix Released
Undecided
Unassigned
Nominated for Zesty by Daniel van Vugt
Artful
Invalid
Undecided
Unassigned

Bug Description

Using a laptop with lid closed and an external monitor, you can boot.
Bios will show on the external monitor, as well as gdm when boot is finished.
You can then choose a user and type in your password, which is accepted.
But then, system goes to sleep (as the lid is cloesd I guess).

Going out of sleep with the power button shows the gnome shell.

Franck (alci)
tags: added: artful
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yes it appears that the default behaviour is to suspend when the lid is closed. And most surprisingly, Settings (3.24 at least) provides no option to change that.

WORKAROUND:
sudo apt install gnome-tweak-tool
then in gnome-tweak-tool > Power > Suspend when laptop lid is closed = OFF

tags: added: gnome-17.10
Revision history for this message
Franck (alci) wrote :

Thanks @Daniel for the workaround, it does the trick.

Notice however, as I'm not sure I was clear enough, that the lid is already closed when the session begins, it's not an event that happens while the session has began.

Also notice it is a regression regarding the behaviour of Unity 7...

Revision history for this message
Sebastien Bacher (seb128) wrote :

indeed and that's quite annoying

it would be good if somebody reported it upstream on https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-settings-daemon

affects: gnome-control-center (Ubuntu) → gnome-settings-daemon (Ubuntu)
Changed in gnome-settings-daemon (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in gdm3 (Ubuntu):
status: New → Confirmed
Changed in gnome-shell (Ubuntu):
status: New → Confirmed
Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

@Sebastien

There is nothing to be reported about. Gnome provides a gsettings key to change that. Why don't you change the default behavior for Ubuntu?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I agree the default setting is sane and it's configurable either way. The only problem is a lack of GUI to change it without having to install gnome-tweak-tool. So that's really just a bug in gnome-control-center.

affects: gnome-settings-daemon (Ubuntu) → gnome-control-center (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

And also a bug in gdm per comment #2... :)

Revision history for this message
Sebastien Bacher (seb128) wrote :

@Khurshid & @Daniel, that's a bug and not a configuration choice, suspending on lid close is not supposed to be the default when an external monitor is connected

tags: added: rls-aa-incoming
Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

It is a bug. System should not sleep when an external monitor is attached, whether lid is closed or not.

affects: gnome-control-center (Ubuntu) → gnome-settings-daemon (Ubuntu)
summary: - System goes to sleep with lid closed after login
+ System goes to sleep with external monitor and lid closed after login
Will Cooke (willcooke)
tags: removed: rls-aa-incoming
Changed in gdm3 (Ubuntu Artful):
assignee: nobody → Andrea Azzarone (azzar1)
Changed in gnome-settings-daemon (Ubuntu Artful):
assignee: nobody → Andrea Azzarone (azzar1)
Changed in gnome-shell (Ubuntu Artful):
assignee: nobody → Andrea Azzarone (azzar1)
Revision history for this message
Sebastien Bacher (seb128) wrote :

commenting ubuntu-lid-close-suspend.patch in g-s-d resolves the issue, thanks andyrock for pointing that out, I'm uploading without that patch for artful

Changed in gdm3 (Ubuntu Artful):
status: Confirmed → Invalid
Changed in gnome-settings-daemon (Ubuntu Artful):
status: Confirmed → Fix Committed
Changed in gnome-shell (Ubuntu Artful):
status: Confirmed → Invalid
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-settings-daemon - 3.26.1-0ubuntu3

---------------
gnome-settings-daemon (3.26.1-0ubuntu3) artful; urgency=medium

  * debian/patches/ubuntu-lid-close-suspend.patch:
    - comment that old Ubuntu patch, it's buggy and creating issues like
      laptops suspending when logging in while docked with the lid closed
      (lp: #1716160)
  * debian/patches/ubuntu_ibus_configs.patch:
    - use sunpinyin instead of pinyin for zh_CN since that's the ibus
      component which is preinstall nowadays

  [ Ikuya Awashiro ]
  * debian/patches/ubuntu_ibus_configs.patch: use mozc-jp instead of anthy
    for Japanese. ibus-anthy is not installed by default anymore.
    (lp: #1722681)

 -- Sebastien Bacher <email address hidden> Wed, 11 Oct 2017 13:57:31 +0200

Changed in gnome-settings-daemon (Ubuntu Artful):
status: Fix Committed → Fix Released
Revision history for this message
KyL416 (kyl416) wrote :

Ever since this fix was released my laptop now goes into standby mode anytime I close the lid on gnome-flashback. The only workaround was to use the gnome-tweak-tool like mentioned in comment 1.

Revision history for this message
Tessa (unit3) wrote :

Note that while gnome-tweak-tool seems to produce expected results for me under gnome-shell/xorg, it doesn't on gnome-shell/wayland. Under wayland, no configuration in gnome-tweak-tool seems to stop the machine from sleeping if the lid is/started closed.

I was trying to report that Wayland specific bug, and it got marked as a duplicate of this, but I'm not convinced it actually is the same problem.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Tessa, your bug report shows you're using 17.04. However the fix only exists in 17.10 right now.

Revision history for this message
Carlos Gomes (gocarlos) wrote :

This bug does not seem to be fixed with the release of gnome-settings-daemon (3.26.1-0ubuntu3) artful; urgency=medium

Running ubuntu 17.10 will all updates installed and after login with gdm the laptop goes into sleep. Loggin in to Xorg as I have a Nvidia card.

Within the gnome tweak tool the setting is to not suspend when the lid is closed.

Revision history for this message
Sebastien Bacher (seb128) wrote :

The bug described there is fixed and the fix has been verified, it was about the case where you boot with a laptop docked and lid close with stock configurations/options.

You mention tweak tool and lid close options so you changed configurations? If you still have an issue please open a new bug and describe what configuration options you are using exactly and the steps you take to trigger the bug

Revision history for this message
Carlos Gomes (gocarlos) wrote :

Basically is the same issue: I have a life book h760 with a docking station attached to it.
The laptop is closed and two external monitors are attached to the docking station.
After booting, the GDM appears on the correct monitors. After entering the password, one gets to gnome desktop and the desktop then goes into standby.

One has to press the turn on button on the docking station to wake up the laptop.
All settings are default. All updates done. As far as I understood this is the exactly reported bug here.

The gnome tweak tool is also set to default settings (done nothing there)

Revision history for this message
Tessa (unit3) wrote :

@seb128: yeah, this is my point. I don't think the ticket I was trying to report with different issues specific to gnome-shell on wayland is the same as this ticket. It certainly doesn't seem to be solvable by manually setting anything in gnome-tweak-tool. What should I do when I already opened a distinct ticket for that problem and it was merged as a duplicate to this one?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Tessa,

I know it's confusing but the way LaunchPad works is that you may still be suffering from a bug even after it shows as "Fix Released". This is because the fix has been released in the latest Ubuntu 17.10 (only). As you are using Ubuntu 17.04 you don't yet have the fix, we know.

I have nominated 17.04 to receive the fix for you, but it is not always guaranteed that a fix will get backported to previous releases. Still, the right place to discuss the problem is here.

Only if someone still experiences the problem in 17.10 should a new separate bug be opened.

Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

Why was the code removed? For me the issue was choosing a sane default and no to suspend computer when lid is closed. But now it breaks unity and unity control center.

Revision history for this message
Sebastien Bacher (seb128) wrote :

@khurshid, Unity and unity-control-center don't use gnome-settings-daemon, your issue must be something else

Revision history for this message
Tessa (unit3) wrote :

I'm on 17.10 now, and while it doesn't completely break like it did in 17.04, I'm getting the screen going to sleep within a few minutes of logging in, after booting with the laptop lid closed. I'm also finding if I leave the monitor sleeping overnight after doing a screen lock, it refuses to wake up in the morning, which may be a different issue, but seems suspiciously related.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

As this bug is effectively closed for 17.10, new issues should be logged as new bugs.

Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

@Sebastien

Unity use unity-settings-daemon which depends on gnome-settings-daemon-schemas and gsetting-ubuntu-schemas for power related settings.

How to reproduce:

1) Log in to unity-session

2) UCC-> Power

3) Choose "Do nothing" for lid is closed option.

It won't work. Certainly not without tweak-tool. But the Ubuntu autostart ignore-lid-switch-tweak (/usr/lib/gnome-tweak-tool/gnome-tweak-tool-lid-inhibitor) which needs to be disabled as well.

The patch only changes inhibit_lid_switch_action behavior. Gnome-shell can have tweak-tool, but other sessions are affected.

In short it's broken

Solution:
----------------

gsettings set org.gnome.settings-daemon.plugins.power.lid-close-ac-action 'nothing'
gsettings set org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false

These schemas needs to be set to make it work properly. And we can do that in "ubuntu-settings".

Also when laptop boots with lid-closed it's all gdm before login. So these settings needs to be changed on the behalf of the gdm.

That way there won't be any conflict, both gnome-tweak-tool and unity power settings will work properly.

Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

@Carlos

You need to disable ignore-lid-switch-tweak from autostart-manager to make tweak-tool-settings work.

See https://bugzilla.gnome.org/show_bug.cgi?id=715022

Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

@Sebastien

Ok. I found some fault in the old patch.

 suspend_on_lid_close (GsdPowerManager *manager)
 {
+ if (manager->priv->inhibit_lid_switch_action)
+ return FALSE;
+
         return !external_monitor_is_connected (manager->priv->rr_screen);
 }

@@ -1242,6 +1247,26 @@ restart_inhibit_lid_switch_timer (GsdPow
 }

 static void
+setup_lid_closed_action (GsdPowerManager *manager)
+{
+ GsdPowerActionType policy;
+
+ if (up_client_get_on_battery (manager->priv->up_client)) {
+ policy = g_settings_get_enum (manager->priv->settings, "lid-close-battery-action");
+ } else {
+ policy = g_settings_get_enum (manager->priv->settings, "lid-close-ac-action");
+ }
+
+ if (policy == GSD_POWER_ACTION_NOTHING) {
+ inhibit_lid_switch (manager);
+ manager->priv->inhibit_lid_switch_action = TRUE;
+ } else {
+ uninhibit_lid_switch (manager);
+ manager->priv->inhibit_lid_switch_action = FALSE;
+ }
+}
+

The issue was:

Every-time lid state is changed, "setup_lid_closed_action" is performed but it doesn't take account whether external monitor is connected or not and automatically uninhibit the lid_switch & hence even if "suspend_on_lid_close" = false; it can't work as we already performed "uninhibit_lid_switch (manager)"

I slightly modified it:

+
+ if (policy == GSD_POWER_ACTION_NOTHING) {
+ inhibit_lid_switch (manager);
+ manager->priv->inhibit_lid_switch_action = TRUE;
+ } else {
+ if (external_monitor_is_connected (manager->priv->rr_screen)) {
+ inhibit_lid_switch(manager);
+ manager->priv->inhibit_lid_switch_action = TRUE;
+ } else {
+ uninhibit_lid_switch (manager);
+ manager->priv->inhibit_lid_switch_action = FALSE;
+ }
+ }
+}

I am testing this now. I will reply here soon.

Revision history for this message
jhoechtl (johann-hoechtl) wrote :

@khurshid-alam Any update on that? The fix you described seems to fix the issue of mutually incompatible settings from tweak tool "Suspend when laptop lid is closed" and dconfs /org/gnome/settings-daemon/plugins/power/lid-close-suspend-with-external-monitor inhibiting proper suspend actions of Gnome 3.26 using a laptop, sometimes portable, where it is sensible if a lid close action triggers a suspend/hibernate and while docked/external monitor attached, where a lid close action should not trigger any sleep state.

Revision history for this message
cagara (cagara) wrote :

I can also confirm that bug on the latest 17.10.
It is getting old!

I got a T460p attached to a docking station. Whenever I try to log in, the laptop goes into sleep mode. The only way to get to the Desktop is to repeatedly press the power button and try to login in until it eventually - yet not deterministically - works.

I am a bit intimidated by the fact that other people with this problem are not being taken seriously. To clarify once again: this is not a configuration issue! We do not need to set anything in ubuntu-tweak-tool because - and here, I can only speak for myself - we really do want the sleep on lid close function; just not with a docking station attached.

Revision history for this message
Carlos Gomes (gocarlos) wrote :

@khurshid-alam
I don't think that a normal user should have to disable stuff after a fresh install i.o. to make ubuntu work. I believe that this should be patched here and the patch should be forwarded upstream.

@cagara
You seem to have the same problem as I have.
Though my problem is deterministic: after login (enter password and enter) I see the desktop for 1 second and then the external monitor & laptop goes sleep.
You can wake up the computer by pressing the power button on the docking station. You then have to enter the password and enter again to get into the desktop. The laptop should not sleep anymore.

Hope it helps until this is fixed

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This bug was marked as fixed 3 weeks ago. Whether that is right or wrong, please move all discussions into a new bug. It will help us to track any unresolved issues.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :
affects: gnome-shell (Ubuntu) → mutter (Ubuntu)
Changed in mutter (Ubuntu):
status: Invalid → Confirmed
assignee: Andrea Azzarone (azzar1) → nobody
Changed in mutter (Ubuntu Artful):
assignee: Andrea Azzarone (azzar1) → nobody
Changed in mutter:
importance: Unknown → High
status: Unknown → Fix Released
Changed in mutter (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Alexander Bischoff (omipo) wrote :

I am very sorry coz after studying many webpages I end up here since this pages covers my problem most. If it was wrong posting my problem here just give me a hint and delete my post.

I have the above described problem:

- laptop is in docking station and 2 monitors are connected (HDMI, DVI)

- If the lid is closed and I boot the laptop I can input my credentials in the login screen and after hitting ENTER the laptop goes to sleep

- If I then press the power button of the docking station the laptop wakes up and goes straight to the ubuntu environment w/o any user identification

The device is a Lenovo T420 with classic docking station. Ubuntu 18.04.3 LTS. Internal graphics Intel integrated grafics and dedicated Nvidia Quadro NVS 4200M with propriety driver 390.116. Behavior independent of the graphics used.

I do not know what to do now since the latest state is "fix released" and so I guess it should be part of the ubuntu version I use?

Thank you very much.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This bug is closed. If you experience any ongoing problems then please open a new bug by running:

  ubuntu-bug gnome-shell

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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