Multiple Monitors – Cannot Login After Suspend with Multiple Monitors

16.04lightdmmultiple-monitorssuspend

Since I attached an external monitor to my laptop I'm no longer able to login when resuming from suspend. LightDM appears on both screens and shows my name in the login box, but the password field is not visible and entering the password anyway has no effect.

The machine is still running, and I can access it by SSH or an alternative shell (with ctrl-alt and function keys), but I can't get back to my previous Unity session.

Logging out and in again without suspending works correctly.

The laptop is a Dell Precision M6700 with an nVidia Quadro K4000M and the external monitor is connected via DisplayPort 1.2. The OS is Ubuntu 16.04 and the problem occurs with both the latest nVidia drivers and the Nouveau display driver.

What can I do to fix LightDM?

Best Answer

Here is a workaround that uses the idea from Malith's answer, but automates a few steps, let me know if it works for you, and if not, I have some other ideas that may work.

Create a file named /etc/systemd/system/suspend-workaround.service, with the following content:

[Unit]
Description=suspend lightdm workaround
Before=sleep.target
StopWhenUnneeded=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/chvt 1
ExecStop=/bin/chvt 7

[Install]
WantedBy=sleep.target

Type the following on a terminal to reload systemd files and enable the unit above:

sudo systemctl enable suspend-workaround.service
sudo systemctl daemon-reload

Try to suspend and report your results.

EDIT: If the above unlocks your session (it shouldn't), you can make your session lock post resume, by replacing the ExecStop=/bin/chvt 7 with ExecStop=/bin/chvt 7 ; /bin/loginctl lock-sessions.

You can also disable session locking on system settings, and force it to lock post resume using a systemd script like the one above, by calling /bin/loginctl lock-sessions and leaving all the chvt stuff out.

Related Question