• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

Unable to set permanent audio output (solved)

hal_sk

New Member
Joined
May 25, 2020
Messages
28
Reaction score
5
Credits
288
[SOLVED, see the end]
Hello,
I use my Ubuntu PC with my TV using HDMI cable for video and audio.
In Ubuntu I have 2 possible audio outputs to choose from:
  1. HDMI
  2. SPDIF
After I select desired HDMI option it works fine until I reboot the PC. After that, output reverts to SPDIF. Ubuntu is not saving the setting. Is it a bug? If yes, where can I publish it?
Then I tried to work around it by creating systemd service that will run command to change audio output to HDMI after each reboot.
In my case the command is:
Code:
pacmd set-default-sink "alsa_output.pci-0000_01_00.1.hdmi-stereo"
It works when running the command as user via terminal window.
Problem is, it does not work when running it using systemd service unit. In the logs it says:
No PulseAudio daemon running, or not running as session daemon
Then I have tried to put the command into "Startup Applications Preferences" via GUI. But it also does not work.

EDIT (solution):
During writing this post, I have used user-wide systemd service unit to run my script with "pacmd" command instead of system-wide systemd. And it finally works.
System wide systemd is located at: "/etc/systemd/system"
User wide systemd is located at: "~/.config/systemd/user"
 

Members online


Latest posts

Top