Default-sink hdmi audio device not default after using bluetooth device

Hi there,

i have read this post / tut

The command is working so far as expected.
During a session i activate my bluetooth headset -> notebook with enabled bluetooth connects
After disabling my bluetooth headset the notebook falls back to build in audio device but not to hdmi audio (my default -> audio conn to hdmi monitor)

my devices list says
pactl list short sinks

1	alsa_output.pci-0000_00_1b.0.analog-stereo	module-alsa-card.c	s16le 2ch 44100Hz	SUSPENDED
3	alsa_output.pci-0000_00_03.0.hdmi-stereo-extra2	module-alsa-card.c	s16le 2ch 44100Hz	SUSPENDED

in my ~/.config/pulse i have several files


a can't be found but exist in /etc/pulse/...

If i set manually or by command see above my default sink to hdmi it also survive a reboot all good so far.
Only the "fallback to hdmi audio after using bluetooth" during a running session will not work as expected.

Append info:

after disabling headset my f5cc....-default-sink still shows


I added the following to my /etc/pulse/

### Make some devices default
set-default-sink output alsa_output.pci-0000_00_03.0.hdmi-stereo-extra2
set-default-source alsa_output.pci-0000_00_03.0.hdmi-stereo-extra2

-> corresponding to this

but this does not solve the prob because my ~/.config/pulse/***-default-sink is not set propperly back to


after disabling headset.

I am really not sure on this one. The in /etc/pulse should work.
You might try creating a udev rule with a script, instead. This will then manage disconnecting from headphones to redirect to HDMI sound output.
Create new document in your home directory and name it.
For this example, I will name it
Open the file with text editor and paste in:

pacmd set-default-sink alsa_output.pci-0000_00_03.0.hdmi-stereo-extra2

Make the script file executable

chmod +x ~/

Create a new file in /etc/udev/rules.d

sudo touch /etc/udev/rules.d/99-bluetooth-audio.rules

Open it

sudo nano /etc/udev/rules.d/99-bluetooth-audio.rules

Paste in the following after you change $USER to your actual username in the path to your script:

ACTION=="remove", SUBSYSTEM=="bluetooth", RUN+="/home/$USER/"

Tap ctrl+o to overwrite, then enter to save current configuration. Then tap ctrl+x to exit the editor.
Now, you must run

sudo udevadm control --reload-rules && sudo udevadm trigger

to reload the udev rules.

Reboot (may be unnecessary) and test sound switching back to HDMI output...

1 Like

Hmh thanks so far, but i can't get it to work.

I configured the missing files as described and tested the *.sh if it does it's job - ok no errors and the ~/.config/pulse/**-default-sink switches (back) to hadmi audio.

I rebooted (weather nescessary or not) and tried to activate my bt headset (ok - as before) then turned it off ... waited a couple of seconds but the default-sink stays switched to bluez_sink.50_C2_75_E6_AD_3B.a2dp_sink

After several seconds i triggered the manual by terminal and after 3-4 seconds my default-sink was back on hdmi.

So the script work so far but does not be triggered automatically by the mechanism of switching on / off my bt headset.
It is a Jabra in Ear that switches of when i set the headset into its charging box.
The Bt Icon of ZorinOS disappear in the same moment i close the charging box.

Any further ideas?

i looked at my logs
journalctl -a | grep udevd

and see entries like
Okt 18 13:25:44 pc121 systemd-udevd[6758]: hci0:256: Process '/home/$USER/.config/pulse/' failed with exit code 1.

the file "" has following rights
-rwxrwxr-x 1 $USER $USERGROUP 83 Okt 18 12:29

and i can run it from user terminal without errors.
setting the rights of to $USER:root delivers same errors...

So the udev rule 99... is triggered but the RUN command fails...
Any ideas what causes udev to throw these errors?

I tried to run the script from a sudo shell (sudo su)
# /home/$USER/.config/pulse/
# sudo -u $USER /home/$USER/.config/pulse/

always delivers an error
Es läuft kein PulseAudio-Dienst oder nicht als Sitzungsdienst.
(no pulseaudio service running nor as session service)

So the udev rules run as system service? -> then the exit code 1 maybe reference to the circumstance that the ENV system service is unlike user context...
So i don't know how to tell udev to run the script as $USER instead of system service?

As mentioned above same script running in $USER shell works as expected!

Lately i got it working!!
:grinning: :grinning: :grinning:

Thanks Aravisian for your help!

The clue is that (as i guessed udev is always running in "root / sudo" mode)
So the udev "user" can not connect to the pulseaudio socket of the actual user.

Following helped me to get out of this cage

sleep 2 # wait for the headset to fully disconnect
sudo -u '#1000' XDG_RUNTIME_DIR=/run/user/1000 \
    pacmd set-default-sink alsa_output.pci-0000_00_03.0.hdmi-stereo-extra2

You can find the solution here:

Now the udev rule is no longer producing exit code 1 messages and the switch is working. The change cost a little time, therefor the sleep time is really nescessary in my case.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.