Lightdm restart black screen (likely issue with Nvidia drivers and xorg)

I’m running Manjaro with xmonad and lightdm on Nvidia proprietary drivers, and I’m encountering weird black screen issues with lightdm.

When I boot up and systemd automatically starts lightdm, everything works just fine. However, once I’m logged into xmonad and I quit the xmonad session, or run sudo systemctl restart lightdm, a black screen will be thrown. The black screen is not a turned-off display, as I can clearly see the backlight bleed of my monitor. The way to get graphics to show up again is to switch to a tty terminal and then switch back.

Interestingly, I can still log in without seeing anything. That is, I can fill in my password, press enter, and I’m in my xmonad session, with a blank screen. I can also open up a few terminals with keyboard shortcuts as a test. After the tty trick, xmonad with my open terminals rather than lightdm shows up.

I tried sddm and the same issues appear. Using earlier kernels (5.4 lts) also didn’t help. I tried this on my laptop with intel integrated graphics, and it has no blank screen issues. So I think it’s some issues of xorg and Nvidia driver not liking each other. There has to be something happening during the switch to tty and back, and if I can run that in a script, I can put that in display-stopped-script or display-setup-script or session-cleanup-script and that should solve this issue.

I am stuck with the proprietary software as I need to run CUDA calculations, so the option of using mesa/Nouveau is out of question for me.

Attached are logs of lightdm and xorg after I do a clean restart, login, logout, and login again:
/var/log/Xorg.0.log
/var/log/lightdm/lightdm.log

Hi @6etacat :wink:

Sounds like a HiDPI issue. Could you add:

inxi -Gazy

Xorg says:

    22.541] (II) NVIDIA(0): Validated MetaModes:
[    22.541] (II) NVIDIA(0):     "nvidia-auto-select+0+0{ForceFullCompositionPipeline=On}"
[    22.541] (II) NVIDIA(0): Virtual screen size determined to be 1920 x 1080
[    22.590] (--) NVIDIA(0): DPI set to (92, 91); computed from "UseEdidDpi" X config
[    22.590] (--) NVIDIA(0):     option
[    22.591] (II) NVIDIA: Using 24576.00 MB of virtual memory for indirect memory
[    22.591] (II) NVIDIA:     access.
[    22.610] (II) NVIDIA(0): Setting mode "nvidia-auto-select+0+0{ForceFullCompositionPipeline=On}"

What screen are you using?

Just remove nvidia drivers, after reboot, install nvidia-dkms