4K display black screen when updated NVIDIA driver from 340 to any 340+ driver

Here’s what happened: I had Ubuntu 19.10 installed + NVIDIA driver 340 + 4K screen. Everything worked file. I upgraded my NVIDIA driver to 435 and then everything is still fine until the login screen (the login screen itself shows perfectly fine). Now, when I enter my password, the screen goes black and after a short while switches to stand-by mode. So, I connected my old HD monitor, rebooted, and everything was just working again!

Funny thing is that, when I’m logged in the OS, if I reconnect my 4K monitor, it works fine! But if I restart the system, the problem persists.

I’ve also posted this question on Ubuntu bug report forum w/ more details about my system configuration, etc. Here’s the link to that thread.
https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-435/+bug/1854114

In that bug report you attached the old Xorg.0.log, which is the one from the working GDM session. Please attach/post old the Xorg.1.log from the non-working session.

Coming to think of it, maybe this is a bug that should have been fixed, try this:
Please run

grep modeset /etc/modprobe.d/* /lib/modprobe.d/*

to find the file containing

options nvidia-drm modeset=1

and change it to

options nvidia-drm modeset=0

then run

sudo update-initramfs -u

and reboot.

Thank you for your quick reply. When I run

grep modeset /etc/modprobe.d/* /lib/modprobe.d/*

nothing is returned. Where should I add the following?

options nvidia-drm modeset=0

Many thanks.

If it’s not there, please don’t add anything. Please post the output of
sudo cat /sys/module/nvidia_drm/parameters/modeset
(should return ‘N’)
and attach Xorg.1.log from a failed boot.

“sudo cat /sys/module/nvidia_drm/parameters/modeset” returns “N”.

Since I didn’t know if Xorg.1.log contains the previous boots, here’s what I did: I reproduced a failed boot (by connecting my 4K monitor), then turned off my PC, and connected back the HD monitor, and then saved the Xorg.1.log. I also attached the journalctl log from the previous boot.

https://gist.github.com/ma-sadeghi/8c1c4bbb5a6364dc1dafc59217b8af67

All xorg logs are from a boot with only the Dell HD monitor connected.
Please connect the HP monitor, boot, log into black screen, reboot with HD monitor and immediately run nvidia-bug-report.sh as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post of yours will reveal a paperclip icon.
https://devtalk.nvidia.com/default/topic/1043347/announcements/attaching-files-to-forum-topics-posts/

I really appreciate your help. I did as you requested. Here’s the .gz file.
nvidia-bug-report.log.gz (303 KB)

I really appreciate your help. I did as you requested. Here’s the .gz file.
nvidia-bug-report.log.gz (303 KB)

Ok, the logs showed the problem, on login, the second Xserver is freezing and the nvidia driver is erroring out:

Dec 04 06:37:25 mcgill kernel: nvidia-modeset: ERROR: GPU:0: Display engine push buffer channel allocation failed: 0x65 (Call timed out [NV_ERR_TIMEOUT])
Dec 04 06:37:25 mcgill kernel: nvidia-modeset: ERROR: GPU:0: Failed to allocate display engine core DMA push buffer

Looks like a variant of this bug:
https://devtalk.nvidia.com/default/topic/1055565/linux/-430-26-black-screen-on-changing-virtual-terminal/
Do you remember which driver version worked before?
Does enabling CSM in bios (if possible) work around it?

Thank you! You saved me lots of headache! As you suggusted, I enabled the legacy mode in bios, and it worked like a charm! Thanks once again!

[for the record] v340 worked fine, but I tried 3 different v340+ drivers, and none of them worked.