1

I am a novice Ubuntu/Linux user and have just installed Ubuntu 16.04 LTS.

I noticed that Pulseaudio will always revert to an unwanted profile <output:analog-stereo> after resuming from suspend (I want the default to be <output:hdmi-stereo>). This seems to be an issue mentioned many times in this forum, but the suggested solutions don't seem to work for me.

I have tried editing the default.pa file in /etc/pulse (and also tried putting a default.pa in ~/.config/pulse/ as described in https://unix.stackexchange.com/questions/293399/how-to-set-hdmi-sound-output-as-default-on-ubuntu-16-04 However, by doing those edits, Pulseaudio will fail to load, leaving me with no sound.

I turned to a different approach. Since, by running the following in the terminal:

/usr/bin/pacmd set-card-profile 0 output:hdmi-stereo

does what I want (switches the profile), I thought I could maybe add a shell script that runs upon resume. This approach was also documented in many places, so I went ahead and tried it.

Under /lib/systemd/system-sleep, which seems to be the appropriate place for 16.04, I put a script with the following code:

#!/bin/sh
case $1 in
post*)
/usr/bin/pacmd set-card-profile 0 output:hdmi-stereo
;;
esac

However, this does not seem to work either. I checked that the script was being run upon resume by replacing the pacmd command with something like echo "hello" > /usr/text.test, and confirmed that it's working.

What I have now is just a launch file on the desktop that runs the script containing the pacmd command, which I double click every time I resume from suspend. It would really be nice if I could get this automated.

  • @WinEunuuchs2Unix I don't think it is a duplicate because your thread doesn't provide a solution to my problem (as far as I understand). i) I am not unplugging my devices ii) your solution doesn't directly relate to the behavior of post suspend scripts – user21044 Dec 29 '16 at 05:07
  • My apologies, I linked to the wrong answer... Much of the code is the same but the trigger is different. I'll dig up the exact answer tomorrow. – WinEunuuchs2Unix Dec 29 '16 at 05:39
  • I solved the problem without really understanding the problem. It seems that this is some unexpected behavior of pulseaudio 8, which was solved in version 9. So I did an update to Ubuntu 16.10 to get the pulseaudio 9, and now I don't have this problem anymore (active profile will persist after suspend/resume). I would still like to learn solutions that would work on 16.04. – user21044 Dec 29 '16 at 09:21
  • Here is the correct link for fixing PulseAudio8 within Ubuntu 16.04: http://askubuntu.com/questions/840473/ubuntu-changing-default-audio-output-after-suspend/840543#840543 – WinEunuuchs2Unix Dec 29 '16 at 11:10

0 Answers0