0

I'm suspending my laptop very often, by manually calling pm-suspend command. Most of the times it works without problems.

However, sometimes it resumes with a blank screen. Either a reboot or issuing sudo /etc/init.d/lightdm restart on TTY1 (Ctrl+ALT+F1) makes it work, but I loose all of my unsaved documents and working layout of course.

Is there a way to make LightDM start on TTY1 without restarting it?

ceremcem
  • 2,231
  • 1
  • 23
  • 53

1 Answers1

3

Root of the problem

It turns out that the exact problem was issuing a screen lock command while the laptop's lid is closed:

sleep 5s; physlock -d

Run above command and immediately close the laptop lid. Wait like 10 seconds, then open the lid. A password prompt will wait for your password input. When the correct password is entered, you'll end up with a totally blank screen.

Actual Solution

Current workaround is running xrandr --auto on TTY7, within the same my-suspend script:

echo "Locking display"
physlock -d 

echo "suspending..."
pm-suspend

echo "Performing workaround for LightDM bug"
while :; do
    xrandr --auto && break || sleep 1s
done

Answer to the original issue

When this xrandr --auto command is issued on another tty, it doesn't work even though DISPLAY=:0 is set beforehand. However, the following procedure works:

  1. Switch to TTY1 (Ctrl + Alt + F1):
  2. Issue the following command:
$ while :; do DISPLAY=:0 xrandr --auto && break || sleep 1s; done

This command will keep failing every second with the following error:

xrandr: Configure crtc 0 failed
xrandr: Configure crtc 0 failed
xrandr: Configure crtc 0 failed
...
  1. Switch to TTY7 (Ctrl + Alt + F7)
  2. Wait 1 second
  3. Voila!
ceremcem
  • 2,231
  • 1
  • 23
  • 53
  • Hi, thanks for this, I have to use this workaround since I upgraded Xubuntu 20.04 to 22.04. Do you know the "proper" solution? It happens for me just suspending by closing the lid which is handled by `xfce4-power-manager`. – antgel Mar 15 '23 at 14:05