I had a laptop with ubuntu 16.04 and I upgraded to Ubuntu 18.04 a few days ago. I usually work with a second screen connected to the laptop, and when I close the laptop I would like to suspend it.
When I still had Ubuntu 16.04 this worked fine, and the laptop was suspended. However, after upgrading to Ubuntu 18.04, when I close the lid the computer switches to the second screen and displays there, without suspending.
I have looked at this question, but I had every parameters set as in the answer, so I don't understand where is the problem. Any ideas? Thanks in advance.
As additional information, suspending works fine when the second screen is not connected. Also, as a strange fact, when I have the second screen connected, after closing and reopening the lid, the airplane mode gets activated.
Here there are the parameters in my /etc/systemd/logind.conf:
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#UserTasksMax=12288
And the lid options in dconf-editor, as suggested in the answer:
lid-close-ac-action: suspend
lid-close-battery-action: suspend
lid-close-suspend-with-external-monitor: true