2

I have an external monitor connected to my Dell XPS 13 9350 laptop. Whenever I close my laptop lid, the laptop's monitor will turn off but the external monitor will stay on and become the primary monitor. I tested what happens when I close the lid without an external monitor and found out that there is a 20-30 second delay before the laptop will suspend. If I close the lid and open it again within 10-15 seconds, the laptop will not even lock. I am wondering if this delay is the reason why my laptop will not suspend with an external monitor?

Someone with a similar computer asked a similar question here: Ubuntu 18.04 + Dell XPS 9360 = Suspension doesn't work when I close the lid

That doesn't appear to be the same problem, though, as their computer wouldn't suspend at all. I did try many of the suggestions.

My computer is going into a "deep" sleep and not "s2idle" mode. When I run sudo journalctl | grep "PM: suspend" | tail -2, I get the following result:

Feb 11 14:09:11 MyComp kernel: PM: suspend entry (deep)
Feb 11 14:09:17 MyComp kernel: PM: suspend exit

I tried editing /etc/systemd/logind.conf and uncommenting the following 2 lines so that it reads:

HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend

I also tried to create /etc/systemd/sleep.conf as mentioned in one of the answers in the link above, but nothing changed.

I don't have nVidia graphics, so any solution for nVidia graphic cards doesn't help me. If it helps, my graphics card is Intel HD Graphics 520 (Skylake GT2).

I downloaded the Gnome Tweaks tool and made sure the "Suspend when laptop lid is closed" setting under Power is turned on.

If it helps, I am using kernel 4.15.0-45-generic.

I know it's not a hardware issue as my computer is a dual boot with Windows 10, and my laptop has not problem going to sleep when I close the lid with or without an external monitor on Windows 10.

Mainly, I would like to close my laptop and it puts my computer to sleep without having to unplug the external monitor. The delay in my laptop suspending without an external monitor is something I can live with.

1 Answers1

0

Try pm-utils. As root run the command

$ pm-suspend

In /var/log/pm-suspend.log you should see something similar to

Initial commandline parameters: 
Thu Aug  1 09:46:07 CEST 2019: Running hooks for suspend.
Running hook /usr/lib/pm-utils/sleep.d/000kernel-change suspend suspend:
/usr/lib/pm-utils/sleep.d/000kernel-change suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/000record-status suspend suspend:
/usr/lib/pm-utils/sleep.d/000record-status suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00logging suspend suspend:
Linux planb 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Module                  Size  Used by
ccm                    20480  6
rfcomm                 77824  32
...
Thu Aug  1 09:46:07 CEST 2019: performing suspend

Then wake up the system. In /var/log/pm-suspend.log you should see something similar to

Thu Aug  1 09:46:31 CEST 2019: Running hooks for resume
Running hook /usr/lib/pm-utils/sleep.d/99video resume suspend:
/usr/lib/pm-utils/sleep.d/99video resume suspend: success.
...

/usr/lib/pm-utils/sleep.d/000kernel-change resume suspend: success.
Thu Aug  1 09:46:32 CEST 2019: Finished.

Customize pm-utils to your needs, create a shortcut to pm-suspend (e.g. Ctrl-Alt-S) and disable lid

$ grep -i Lid /etc/systemd/logind.conf
#HandleLidSwitchDocked=ignore
HandleLidSwitch=ignore
LidSwitchIgnoreInhibited=no

.

$ grep -i lid /etc/UPower/UPower.conf
IgnoreLid=true

I don't have XPS 13 atm, but I remember it worked for me with 18.04 this way. YMMV. There is one more advantage. You can close the lid when an external monitor is attached.


FWIW. Here are the links to Ansible role linux_postinstall and to the tasks pm-utils and lid in particular. I use the configuration data below
$ cat lp-lid.yml 
lp_lid: true
lp_lid_logind_conf: "/etc/systemd/logind.conf"
lp_lid_upower_conf: "/etc/UPower/UPower.conf"
lp_lid_logind_conf_vars:
  - { var: "HandleLidSwitch", value: "ignore" }
  - { var: "LidSwitchIgnoreInhibited", value: "no" }
lp_lid_upower_conf_vars:
  - { var: "IgnoreLid", value: "true" }

$ cat lp-pm.yml 
lp_pm: true
lp_pm_sleepd: {}
Vladimir Botka
  • 283
  • 1
  • 8