External Monitor not working. Ubuntu, nvidia
I recently installed the nvidia-418 driver on my laptop which uses Ubuntu 18.04. At first the external monitor worked perfectly, but after I switched from power saving mode (sudo prime-select intel) back to performance mode (sudo prime-select nvidia), the second monitor was not detected anymore.
I discovered that prime-select writes a configuration file which causes the problem. It enables the nvidia-drm modeset option. You can simply undo the change made by prime-select by commenting out this option. It will not be reset, because prime-select only writes this file when it does not yet exists.
Open the file in your favorite editor (vim, nano, gedit, etc.).
sudo nano /lib/modprobe.d/nvidia-kms.conf
And comment out the the nvidia-drm modeset option.
# This file was generated by nvidia-prime
# Set value to 0 to disable modesetting
# options nvidia-drm modeset=1
Hope this also helps you and many others!
ps: It is completely normal that the second monitor is not detected in power saving mode when the connection is part of the nvidia graphics card.
I do prefer the solution by thomasnabgelis, but other working solution would be to use lightdm display manager. To do this just run
sudo apt-get install lightdm
and
sudo dpkg-reconfigure lightdm
if not configured after install.
Why this happens? I spent a lot of time trying to understand... nvidia-drm provides anti-tearing solution, though I didn't find any difference with this turning that off. Citation from nvidia forum (topic):
nvidia-drm modeset=1 is needed for tear-free display but since this is enabling linux kms for the nvidia driver, gdm thinks it can use wayland. Having a parallel wayland session makes it somehow impossible for X to detect any outputs on the nvidia gpu
Thanks for all your hints. My second monitor was dead a couple of days ago. I got it working again with the following steps:
- sudo nvidia-settings -> if this shows an error, then the nvidia driver is not active
- settings > info > software > additional drivers -> switch to current (or not so current) version of nvidia driver. If there is no error, skip step 3.
- install missing nvidia-drivers: sudo apt install nvidia-driver-450 (or similar)
- reboot
- it works (at least for me)
Hope that helps anyone. Cheers, Werner