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:
- Switch to
TTY1 (Ctrl + Alt + F1):
- 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
...
- Switch to
TTY7 (Ctrl + Alt + F7)
- Wait 1 second
- Voila!