28

At each reboot, PulseAudio sets a sink (in my case, "HDMI Audio Output") as the default.

So, at each reboot, I don't hear any sound, and need to reconfigure the default sink each time to "Analog Output".

How do I remove/disable a specific sink such as HDMI, or set a default sink that overrides the existing sink?

2
  • 2
    Even if someone answers with a workaround please file a bug report for your issue as described at help.ubuntu.com/community/ReportingBugs. Thanks Nov 30, 2010 at 13:21
  • This is the second ranked question on Google for 'pulseaudio disable sink' and seems to be entirely within scope of using and administering official flavors of Ubuntu and doesn't fall into any of the avoided scope areas. Please reopen. Feb 18, 2017 at 20:04

6 Answers 6

15

Just set the soundcard's profile to "off", for example:

pactl set-card-profile alsa_card.usb-Generic_ThinkPad_Dock_USB_Audio-00 off

pavucontrol can do this is well in its "Configuration" tab:

enter image description here

An alternative is to completely disable any auto connect functionality in pulseaudio, however I like this functionality in the case of my bluetooth headset. With the above solution you can disable soundcards in a fine-grained manner.

4
  • 1
    What if your audio device doesn't have a profile? My on-board HDMI and analog sound don't have one.
    – einpoklum
    Feb 27, 2021 at 9:17
  • Never encountered that, can you show a screenshot of the screen used in the answer?
    – hbogert
    Feb 28, 2021 at 10:09
  • 1
    This would be a nice solution if it was remembered. I'm setting the profile on my HDMI Output and it just keeps resetting itself :( Extremely annoying. Kubuntu 21.04
    – piit79
    Sep 17, 2021 at 9:17
  • @piit79 it is definitely remembered in my case.
    – hbogert
    Sep 20, 2021 at 14:40
9

in 18.10 i was able to fix it

file /etc/modprobe.d/blacklist.conf
add

blacklist snd_hda_codec_hdmi
7

1. Delete User Settings

Another approach prior to editing the default.pa would be to rename the hidden directory ~/.pulseaudio to something like ~/.pulseaudio.000 in your /home directory. This is where your user defined setup is stored. If deleted or renamed it will immediately be recreated from the /etc/pulse/default.pa settings.

2. Edit Defaults

Only if this has no effect for your system then maybe udev loads the HDMI interface as default sink. Then one approach could be as already mentioned by HagenaarsDotNu to edit the default.pa. Mind to make a backup of the current default.pa. Look for this section which is pretty self-explaining (mind that hal-detect will not work in Ubuntu >10.04).

### Load audio drivers statically (it's probably better to not load
### these drivers manually, but instead use module-hal-detect --
### see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink
#
### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Alternatively use the static hardware detection module (for systems that
### lack udev support)
load-module module-detect
.endif

3. The Elegant Way

Another more elegant way to get audio working is to enable "Simultaneous Output" from paprefs as depicted here:

paprefs

This enables audio output on both, the internal audio, and the HDMI-Interface. Make this virtual output device your default and you have all options at your hands.

4
  • "Simultaneous Output" tend to be cpu intensive
    – Tomot
    Feb 18, 2018 at 17:27
  • "Simultaneous Output" also can potentially make audio quality terrible on at least one of the outputs. By terrible I mean it's really bad, arguably worse than no sound at all. Aug 25, 2020 at 14:13
  • 1
    For people with zero experience with pulseaudio, the section is NOT self-explaining. What do I actually change, to disable audio-via-HDMI? Mar 29, 2021 at 9:41
  • The last step of method 2 ends with "Look for this section which is pretty self-explaining". How does looking at that section have any impact on the system?
    – Jerome
    Jan 30 at 17:24
3

I found this suggestion on Launchpad

which states you should edit the pulseaudio settings

sudo nano /etc/pulse/default.pa

and replace #set-default-sink output with: set-default-sink {name of your device}

Name of the device can be found by looking at pactl list output in the Card sections name field.

I checked and the approach should still be valid in 10.10

1
  • How do you know exactly which device name to use?
    – einpoklum
    Feb 27, 2021 at 9:16
1

found a better option

using systemd as described below worked on startup but not when plugging devices in to an already running system.

To ignore audio when hot-plugging and on boot, udev rules are the better option.

Adapted from Tell PulseAudio to ignore a USB device using udev:

  1. use lsusb to identify the vendor/product id of the device you want to ignore

    $ lsusb
    Bus 006 Device 003: ID 17e9:4307 DisplayLink LAPDOCK
    # <other devices I don't care about>
    

    the ID part gives us the magic numbers

  2. create a udev rules file, e.g. /etc/udev/rules.d/80-ignore-audio-cards.rules that sets an environment variable for pulse audio.

    For me this looked like:

    ATTRS{idVendor}=="17e9", ATTRS{idProduct}=="4307", ENV{PULSE_IGNORE}="1"
    

    I chose the 80- prefix for the filename arbitrarily. If you any pulseaudio related rules, make sure your new file starts with a lower number

  3. reboot to ensure it takes effect

With the udev rule in place, pulseaudio ignores the device completely.


previous answer:

Ran into the same problem, and the given answers didn't work for me across restarts. I think my issue was delayed detection of cards; when pulseaudio started up it didn't see all the cards, and some combination of module-switch-on-connect and module-switch-on-port-available was always resetting my choices.

I solved this by making a systemd user unit to run pactl set_card_profile "$MY_CARD_NAME" off when I logged in.

  1. find the name of the card you don't want; hopefully the name should be enough to tell which one:

    $ pactl list cards | grep -E '(Card|Name:)'
    Card #0
        Name: alsa_card.usb-DisplayLink_LAPDOCK_U3D2338486250-02
    Card #1
        Name: alsa_card.pci-0000_01_00.1
    Card #2
        Name: alsa_card.usb-Plantronics_Plantronics_Blackwire_5220_Series_2961D11C621649939CED8BF57E910BA5-00
    Card #3
        Name: alsa_card.usb-HD_Web_Camera_HD_Web_Camera_Ucamera001-02
    Card #4
        Name: alsa_card.pci-0000_00_1f.3
    

    For me, it was the "LAPDOCK" that kept stealing my audio.

  2. create the systemd unit, to call pactl and disable the card:

    $ mkdir -p ~/.config/systemd/user
    $ nano ~/.config/systemd/user/disable-cards.service
    

    Add these contents, changing the ExecStart line to refer to the card you want to drop:

    [Unit]
    Description=Disable card
    
    [Service]
    Type=simple
    Restart=on-failure
    ExecStart=pactl set-card-profile "alsa_card.usb-DisplayLink_LAPDOCK_U3D2338486250-02" off
    
    [Install]
    WantedBy=default.target
    
  3. enable the service: systemctl --user enable disable-cards

Now when you restart systemd will keep trying to disconnect that card until it succeeds. There's probably better systemd config to get this running after the monitor is plugged in; each device shows up as a "unit" (e.g. in the output of systemctl --user) so this could be improved to work as you plug/unplug things.

The other alternative is to change your /etc/pulse/default.pa to use module-switch-on-connect blacklist="REGEX_MATCHING_THE_CARD_NAME", but that didn't work for me; there's no way to customize module-switch-on-port-available, and I think that's what was selecting it for me.

0

As a workaround please disable that feature by editing /etc/pulse/default.pa and comment out (with #) or remove:

load-module module-switch-on-port-available

and reboot the system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.