Ubuntu – Ubuntu 18.04 Hdmi not detected


I have a problem since upgrading to 18.04 LTS version.After a fresh Ubuntu installation, when I plug the screen on my laptop (Dell xps 9560) nothing happens. On the screen it tells me there is no signal. Here is what xrandr command display:

xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080
default connected primary 1920x1080+0+0 0mm x 0mm
   1920x1080     77.00*

Here is the NVIDIA driver I'm using: Driver (GTX 1050)

Here are my display settings with or without HDMI connected: Display settings
Thanks for your help!

Best Answer

There is a possibility that this is related to this answer, as it is explained in more details here, it seems that you have to enable the GPU's PCI audio function.

Here is one posible solution to this problem, copied from that other answer

  1. Create file /etc/systemd/system/fix-hdmi-audio.service

    Description=nVidia HDMI Audio Fixer
    Before=systemd-logind.service display-manager.service
  2. Create file /usr/local/bin/fix-hdmi-audio.sh

    setpci -s 01:00.0 0x488.l=0x2000000:0x2000000
    rmmod nvidia-uvm nvidia-drm nvidia-modeset nvidia
    sh -c 'echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove'
    sh -c 'echo 1 > /sys/bus/pci/devices/0000:00:01.0/rescan'
    modprobe nvidia nvidia-modeset nvidia-drm nvidia-uvm
  3. and set it to runnable: chmod +x /usr/local/bin/fix-hdmi-audio.sh

  4. Enable the service: systemctl enable fix-hdmi-audio.service
  5. Install apt install pavucontrol then start "PulseAudio Volume Control". In "Configuration" tab, you can see only "Internal Audio".
  6. Reboot. Plug HDMI and play some music. Start "PulseAudio Volume Control". In "Configuration" tab, you should see "Internal Audio" and "HDA NVidia". In "Playback" tab, there is a button on the right side of your music player. You can choose "Internal Audio" or "HDA NVidia". Choose "HDA NVidia".
Related Question