[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:
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:
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:
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"
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:
- HDMI
- SPDIF
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"
Problem is, it does not work when running it using systemd service unit. In the logs it says:
Then I have tried to put the command into "Startup Applications Preferences" via GUI. But it also does not work.No PulseAudio daemon running, or not running as session daemon
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"