Ubuntu doesn't detect my second HDMI display

Hi i updated from Ubuntu 18.04 to 19.04 and it seemed like it was working perfectly, but after a couple of restarts I noticed that my second monitor it’s just black and can’t be detected by settings.
I really looked into multiple log files and tried a bunch of things but I really don’t know what to do. Please help

Nvidia bug report.log here:
https://pastebin.ubuntu.com/p/hx3ty6DmCt/

Looks like GDM is running in a Wayland session and blocking the external outputs.
Try this: https://askubuntu.com/questions/975094/how-to-disable-wayland-in-17-10-in-gdm3-login-screen
and if it still doesn’t work, replace GDM with lightdm

sudo apt install lightdm

and choose lightdm when it asks what to use as default.

I already have tried lightdm, and now is set instead of GDM3.
I’ve tried most of the solutions I’ve found on the net. please help,…

Ok, please try this:
switch to nvidia

sudo prime-select nvidia

remove stray blacklist files

sudo rm /etc/modprobe.d/blacklist-nvidia.conf /lib/modprobe.d/blacklist-nvidia.conf

update the initrd

sudo update-initramfs -u

reboot.
If it still doesn’t work, please create a new nvidia-bug-report.log

Still not working.
The new nvidia bug report log
https://pastebin.ubuntu.com/p/W4scsC2g5H/

The driver has been built for a 5.0 kernel but you’re running a 4.18 kernel. Please reinstall the driver running
sudo apt install nvidia-driver-418
or
sudo apt install nvidia-driver-430

sudo apt install nvidia-driver-418
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nvidia-driver-418 is already the newest version (418.56-0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

I already have this version
I typed apt remove nvidia-driver-418 and then sudo apt install nvidia-driver-418 so i reinstalled back again but nothing happened.

Try rebuilding the module:
sudo /usr/lib/dkms/dkms_autoinstaller start

sudo /usr/lib/dkms/dkms_autoinstaller start
 * dkms: running auto installation service for kernel 4.18.0-18-generic                                  Error! Your kernel headers for kernel 4.18.0-18-generic cannot be found.
Please install the linux-headers-4.18.0-18-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
                                                                                                  [ OK ]

I don’t know what to do after that. What should I do now?

I tried to download the latest headers

sudo apt-get install linux-headers-5.0.0-15-generic 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-headers-5.0.0-15-generic is already the newest version (5.0.0-15.16).
linux-headers-5.0.0-15-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Why did you install the 5.0 kernel headers? You’re running a 4.18 kernel, so you should install linux-headers-4.18.0-18-generic like the dkms installer told you.

Because when i try to install it it says:

Package linux-headers-4.18.0-18-generic is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'linux-headers-4.18.0-18-generic' has no installation candidate

And i also tried installing it by ubuntu software program after downloading a package.deb, but it doesnt start my installation.

I don’t know what to do, maybe I just should reinstall the SO and forget about this nightmare

Ok, investigation done, Ubuntu 19.04 has kernel 5.0 per default. The 4.18 kernel must be a left-over from 18.04, there’s probably just the grub config messed up. After turning on your computer, hold down shift to get to the grub menu, then look for an entry with the 5.0 kernel and boot that.

Thank you generix, I have already solved the problem by reinstalling ubuntu and keeping the data. I really do think the problem was the headers. So much thanks for your job and support anyway!

I’m having a similar issue but with ubuntu 20.04. My computer doesn’t recognize my HDMI port

Please run nvidia-bug-report.sh as root and attach the resulting nvidia-bug-report.log.gz file to your post. You will have to rename the file ending to something else since the forum software doesn’t accept .gz files (nifty!).

I have the same issue with Kubuntu 20.04 on Thinkpad 53. The second display detected but keep saying “No signal”.
I have to switch displays many times with Fn + F7 to make it works.

nvidia-bug-report.log.compressed (303.9 KB)

Not really anything noticeable in the logs. Looks like you tried connecting it to the HDMI and the DisplayPort, did you notice any different behaviour depeding on connection?

I tried with thunderbolt docking station with HDMI. Behavior is the same in both cases. After some amount of display switches it works. May be some kind of issue with DPMS?