Ubuntu – No sound on wake, Dumthe Output always takes over. ‘pulseaudio -k’ the fix

pulseaudiosoundsuspendwakeup

When it goes to sleep, sound working, when it wakes from sleep the sound doesn't work. So I go into gnome settings > sound and the output device has been reset to 'dummy output'. Instead of HDMI output [nvidia card driver 430.50].

Simply changing the output device in settings, back to HDMI, does not fix things.

Issuing the command pulseaudio -k does fix things. The dummy output option disappears and the HDMI option is restored. This is played out, entirely reproducible, every time the machine wakes.

Perhaps related… For a week, I had to use some external speakers via the line-out, immediately before this all started. Although all I did was plug them in, and everything worked automagically. They've since been returned.

Alternatively, one is tempted to blame it on something in the ubuntu 19.10 update? Although that might be unfair, the timing does fit.

Anyways, the question is, what is the permanent fix so that I do not have to issue a kill order on pulseaudio on every wake?

Best Answer

It be caused by a new kernel introduced in 19.10 like this case:

If not then you can use this script /etc/systemd/system-sleep/reloadpulse:

#!/bin/sh

# NAME: reloadpulse
# PATH: /lib/systemd/system-sleep
# CALL: Called from SystemD automatically

# DESC: PulseAudo 8 sets sound to dummy ouput when going to sleep.
#       This script kills and reloads pulse audio.

# DATE: November 25, 2019.

# NOTE: Written for ask ubuntu question:
#       https://askubuntu.com/questions/1191649/why-no-sound-on-wake-dummy-output-takes-over-pulseaudio-k-the-fix

case $1/$2 in
  pre/*)
    echo "$0: Going to $2..."
    ;;
  post/*)
    echo "$0: Waking up from $2..."
    pulseaudio -k
    ;;
esac

Mark the script executable with chmod a+x /etc/systemd/system-sleep/reloadpulse

After updates deactivate it with chmod a-x /etc/systemd/system-sleep/reloadpulse

Then if the update didn't fix the problem make it executable again.

You need to reboot for changes to take effect.

Related Question