7

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?

  • 1
    Does this answer help? – Karsus Jul 4 '16 at 13:54
  • @Karsus, no, right-clicking does not have any effect. Also disconnecting the external monitor as mentioned in that question does not help (after reconnecting, both screens are black with just a cursor). – Ian Mackinnon Jul 4 '16 at 14:04
  • If you just lock your screen (clicking your own name on the menu, or Ctrl+Alt+L), without suspending, does it work? – Daniel Jul 5 '16 at 14:32
  • @Daniel, yes, I can lock the screen and log in again without any issues, even if I wait for the monitors to be power down in between. – Ian Mackinnon Jul 5 '16 at 15:10
  • A workaround that locks the screen immediately after resume instead of before suspend is acceptable for you? Do you even need the screen lock feature during suspend or disabling it entirely is acceptable? – Daniel Jul 5 '16 at 15:59
2
+100

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.

  • This does indeed work, though as you predicted, at the expense of the session not being locked during suspend. Certainly a more convenient workaround though. – Ian Mackinnon Jul 11 '16 at 14:22
  • This workaround shouldn't affect session locking at all, it didn't when I tested it here. (although i dont have the original issue) – Daniel Jul 12 '16 at 4:54
  • Anyway... if you get an undesired unlock with the solution above, you can still lock the screen post resume. Check the answer edit for an alternative that does that. – Daniel Jul 12 '16 at 4:57
  • After a restart the lock screen is activating now, without needing to apply the edit. Great work! – Ian Mackinnon Jul 12 '16 at 10:43
1

When you needed to suspend, do it using the shell opened by Ctrl + Alt + F2 login to that shell using your username and password. Then type sudo pm-suspend to suspend the machine. (If not, try installing pm-utils using sudo apt-get install pm-utils) To resume, press any key and you will see the last shell window. Now you can press Ctrl + Alt + F7 to get your Unity session.

  • 3
    Hmm, sounds more like a workaround than a solution. – anonymous2 Jul 4 '16 at 15:29
  • This is a pretty tedious workaround, but it is a lot better than not being able to log in, or having to disable the external display before suspending and then rearranging all my windows again after resuming. – Ian Mackinnon Jul 5 '16 at 15:14
0

I've been frustrated by this and found a solution that worked just now. I don't know if it will work reliably. I'm on Ubuntu 14.04 but it apparently happens on later versions also.

Use cntrl-alt-f1 to get to an alternate console. Login as normal (doesn't need to be root). Use ps -aef and grep to find compiz. Then kill compiz with "kill -9 ". Be sure to enter compiz's pid not compiz's parent's pid (ppid). The "top" command can help you find the right process and k (for kill) can be used to do the work.

Go back to cntrl-alt-f7 and the screen flickers, redraws, etc (like when window manager gives up windows, dropping decorations, etc.). Then it displayed the greeter UI with my username and (Yes!) a Password text entry box. I typed my password and got back to my desktop. It looked a bit odd, and it started up a new instance of compiz without me doing that myself. I examined each window, saving work where needed, and exited each window. Finally all the windows are closed and I made whatever notes I needed. Then I did a restart of the linux system.

After reboot I see the normal greeting page with my user name AND the password text entry box. Yea!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.