No sound trough NVIDIA HDMI (SOLVED)

This is an annoying issue i’ve been facing, thankfully a guy namedĀ Fludizz on nvidia devtalk provided a clean solution in thisĀ devtalk post.

Create a new service 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=/root/fix-hdmi-audio.sh
[Install]
WantedBy=multi-user.target

Create the script the service will run /root/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

make the script executable, enable the service and reboot!

chmod +x /root/fix-hdmi-audio.sh
systemctl enable fix-hdmi-audio.service
reboot

Leave a Reply