6

I am running kernel v4.13.0-36-generic on Ubuntu 17.10 on an HP Omen 15. I have a hybrid NVIDIA Optimus graphics card. I dual-boot Windows 10, which can play audio from the same external monitor over the same HDMI cable I am attempting to use in Ubuntu. I can see video on my external monitor in Ubuntu.

I have tried switching my audio output device in Ubuntu's built-in sound settings GUI and Pulse Audio Volume Control, but in the former no HDMI audio device appears, and in the latter all HDMI devices show up as unplugged.

I have had the most success using the proprietary nvidia-384 driver installed via the Additional Drivers tab of Software & Updates. Using this driver I am able to see video on my external monitor, play audio through my laptop speakers, and boot reliably.

I have tried using nvidia-387 and nvidia-390 from ppa:graphics-drivers/ppa with bumblebee, bumblebee-nvidia, and primus installed, but I can't even boot or see video on my external monitor reliably using these drivers. I observed that /etc/bumblebee/xorg.conf.nouveau and /etc/bumblebee/xorg.conf.nvidia detected my GeForce GTX 1050 Ti as a discrete graphics card, which I believe is incorrect, but am unsure how to override these settings to indicate that my graphics card is a hybrid.

I have blacklisted nouveau, because I am unable to boot reliably with nouveau enabled.

I installed NVIDIA-Linux-x86_64-390.25.run, but after rebooting was stuck in a boot loop, so I ran sudo nvidia-uninstall.

I don't have a lowlatency kernel installed.

I disabled Wayland in case it was causing problems.

I disabled Secure Boot.

I tried using kernel v4.15.4, but only found it even more difficult to boot reliably.

I tried rescanning the PCI bus on the PCI bridge my GPU is connected to. I do not know how to switch from hybrid to dedicated graphics mode as the author of that solution suggests though, so that may be why it didn't work for me.

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC295 Analog [ALC295 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05)
00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 05)
00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
00:04.0 Signal processing controller: Intel Corporation Skylake Processor Thermal Subsystem (rev 05)
00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-H Thermal subsystem (rev 31)
00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA Controller [AHCI mode] (rev 31)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #1 (rev f1)
00:1c.4 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #5 (rev f1)
00:1c.5 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #6 (rev f1)
00:1c.6 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #7 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31)
00:1f.3 Audio device: Intel Corporation Device a171 (rev 31)
00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01)
04:00.0 Network controller: Intel Corporation Wireless 7265 (rev 61)
05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)

A big thank you to anyone who made it to this point. Any suggestions would be greatly appreciated.

4 Answers 4

5

Many thanks to Rudi Daemen. The audio problem on my GTX 1060 was solved by his solution. You can try his solution:

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

    [Unit]
    Description=nVidia HDMI Audio Fixer
    Before=systemd-logind.service display-manager.service
    After=module-init-tools.service
    
    [Service]
    Type=oneshot
    ExecStart=/usr/local/bin/fix-hdmi-audio.sh
    
    [Install]
    WantedBy=multi-user.target
    
  2. Create file /usr/local/bin/fix-hdmi-audio.sh

    #!/bin/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
    

    and set it to runnable: chmod +x /usr/local/bin/fix-hdmi-audio.sh

  3. Enable the service: systemctl enable fix-hdmi-audio.service

  4. Install apt install pavucontrol then start "PulseAudio Volume Control". In "Configuration" tab, you can see only "Internal Audio".

  5. 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".

Note

After rebooting, you can see

01:00.1 Audio device: NVIDIA Corporation Device 10f1 (rev a1)

in the outputs of lscpi.

6
  • Thank you for trying to help me. This is one of the many solutions I tried, but it didn't work in my case. sudo systemctl status fix-hdmi-audio.service shows that the service ran successfully, but I don't see "Internal Audio" or "HDA NVidia" in the "Configuration" tab of "PulseAudio Volume Control." I see the same options as before, and all of the options for HDMI are annotated "unplugged." I do not see an NVIDIA audio device in the output of lspci. Mar 7, 2018 at 6:29
  • Have you rebooted after enabling fix-hdmi-audio.service? Or can you see some error messages in systemctl status fix-hdmi-audio.service? Mar 7, 2018 at 8:48
  • Yes, I rebooted after enabling fix-hdmi-audio.service. No, there was no error message in the output of sudo systemctl status fix-hdmi-audio.service. Mar 8, 2018 at 19:08
  • I suggest adding a line in fix-hdmi-audio.sh: touch /tmp/fix-hdmi-audio. After rebooting, check if /tmp/fix-hdmi-audio exists. Mar 9, 2018 at 2:59
  • Thanks! I've tried (well, everything you tried) and failed. This just worked. Ubuntu 18.10 on a Lenovo W530 laptop.
    – Tal Weiss
    Dec 29, 2018 at 19:31
2

Note this is for a GTX 970M but applies to 1060 and others.

The problem for me with the setpci route is multiple screen resets as lightdm is reloaded. Perhaps because I have three monitors:

  • 50" TV attached via built-in HDMI hardwired to nVidia card
  • 17" internal display driven by Intel iGPU
  • 32" TV attached via Thunderbolt and driven by Intel iGPU

The larger problem is complexity of setting up systemd and bash scripts.

The c language, kernel based solution found on this link: https://bugs.freedesktop.org/show_bug.cgi?id=75985#c33 is far superior. I've included the bulk of the link below with some modifications to my platform.


My system specs:

i7-6700HQ + GTX 970M
Linux kernel version: 4.13.0-26-generic
Nvidia driver Version: 384.130
OS: Ubuntu 16.04.5 LTS

I can confirm that kernel module, posted by Maik Freudenberg [Comment 27], is working fine on my system. Thank you for the fix. The HDMI audio device now works as it should.

I download and extracted the file nvhda.tar.xz. I created the directory ~/nVidia for extraction.

Run commands in terminal:

cd ~/nVidia
make
sudo make install
echo nvhda | sudo tee -a /etc/initramfs-tools/modules
echo "options nvhda load_state=1" | sudo tee /etc/modprobe.d/nvhda.conf
sudo update-initramfs -u # This updated newest kernel 4.15.0-26
sudo update-initramfs -u -k `uname -r` # Update booted 4.13.0-36
reboot

With this fix, I did not notice any problems with power management or system stability. HDMI audio works at system startup, after resume from sleep, after plugging/unplugging HDMI cable.

1

https://github.com/hhfeuer/nvhda#install-using-dkms solved my problem. It leverages the same strategy linked above by both Ping and myself. Most likely setpci -s 01:00.0 0x488.l=0x2000000:0x2000000 didn't work with my hardware setup.

1
1

Just wanted to share what worked for me:

sudo apt-get remove --purge alsa-base pulseaudio
sudo apt-get install alsa-base pulseaudio
sudo alsa force-reload

I am using HDMI connected to an external monitor with speakers; had video but HDMI sound output did not show up anywhere, so it could not be selected. After I ran these commands the HDMI output showed up in System Settings and I was able to select it.

Original Link: broadwell-rt286 no audio after upgrade to 19.10 - haswell-pcm-audio error

Good Luck!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .