9

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?

John Mee
  • 953
  • 1
  • 8
  • 18
  • It's not unfair to blame the 19.10 update. Errors are expected and many have already been reported. – WinEunuuchs2Unix Nov 25 '19 at 22:47
  • I've been experiencing the same issue and made a post a few weeks ago: https://askubuntu.com/questions/1187835/only-getting-dummy-output-audio-after-resuming-kubuntu/ – Dzinic Nov 26 '19 at 17:01
  • @Dzinic Did you implement the solution offered there? I'm confident the one @WinEunuuchs2Unix has offered below will do the trick, but I'm just tinkering with features in /etc/pulse/default.pa before resorting to that-prevention before cure. Turning off module-rescue-streams is my current best hope. Will post what works, or tick that, when I've confirmed my fix. – John Mee Nov 26 '19 at 21:57
  • @JohnMee I haven't tried that yet because it doesn't seem to make much of a difference from what I currently do by simply running pulseaudio -k if I notice the Dummy Output. Problem with both of these solutions is I then have to restart several programs that break once you run the pulseaudio restart. – Dzinic Nov 26 '19 at 23:18
  • @JohnMee I was recommended to remove the proprietary nvidia driver by a developer from pulseaudio (https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/766#note_323691) and after doing so the issue went away. It seems like it's an issue between the driver and the kernel. – Dzinic Nov 26 '19 at 23:54
  • @Dzinic Thanks, Nouveau isn't the answer for me since I want to keep using optimus/prime, but skipping that pulseaudio module does work for me. ymmv. – John Mee Nov 27 '19 at 04:24
  • Is there a bug report for this? – Flimm Jul 03 '20 at 11:37
  • As of February 2021 the sound over DP after wake up is still broken in Ubuntu 20.04 LTS (either Dummy or just poor sound with scratchy tones). The cause is not proprietary nvidia drivers and not the display manufacturer, not the cable and not DP 1.1 vs. DP 1.2 setting. It seems to be the Linux kernel (v5.4.0) used in Ubuntu 20.04 has poor support for the HDMI/DP sound. – geekQ Feb 22 '21 at 20:07
  • 1
    @geekQ Sorry to hear that. I moved to 20.10 and this issue has now gone. Although first I had to undo the fix I posted below. Perhaps it needs backporting; or was too painful for anyone to invest the time to do that. – John Mee Feb 23 '21 at 00:52

6 Answers6

4

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.

4

I have a similar problem with Ubuntu 20.04.

This command solved the problem: pulseaudio --start

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
bhu
  • 41
  • 1
  • Does the command solve the problem temporarily or permanently? – Flimm Jul 03 '20 at 11:36
  • 1
    It was a temporary fix, meaning the problem will appear again later and you have to run the command again. What solved the problem permanently for me was a manual kernel upgrade. You can take a look here for the steps: http://c2bio.com/2020/06/05/update-kernel-in-ubuntu/ – bhu Jul 04 '20 at 17:51
  • This bug report suggests that -kill (which presumably every has already tried) might be needed before --start: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1963767 – Ciro Santilli OurBigBook.com Nov 05 '22 at 06:19
1

I tried the solution by @WinEunuuchs2Unix but it didn't work with my Ubuntu 20.04.2 on a Lenovo Ideapad Y910. This is what I had to do to make it work with my setup:

Add a file (let's call it "pulseaudio-fix") to the directory /usr/lib/systemd/system-sleep and give it execution permission:

chmod a+x pulseaudio-fix

Include the following content in the file:

#!/bin/sh

case $1 in post) su user-name -c " killall pulseeffects; killall pulseaudio; sleep 1; DISPLAY=:0 /usr/bin/pulseeffects --gapplication-service &" ;; esac

Where "user-name" is the name of your user account. In my case commands wouldn't run under the system account. Additionally, killing pulseaudio would mess with pulseeffects, so it needed to be killed before pulseaudio and restarted after it autostarts. If you don't need pulseeffects, just delete the two lines from the code above.

This made the random "dummy output" after sleep problem go away for good in my case.

0

Disable the pulseaudio module module-rescue-streams by sudo editing the file /etc/pulse/default.pa and commenting it out.

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
# I commented this out to stop it defaulting to a 'dummy output' after sleep/suspend [JM:november 2019]
# load-module module-rescue-streams

I'm guessing that there has been a change in the wake sequence such that, now, this runs before all the sound sinks are restored. Consequently, it decides all the 'dead' sinks need to be "rescued" to a new default/dummy sink. They all subsequently wake up, but they've already been rerouted to the dummy.

I'm also guessing that this could break some ability to unplug and replug speakers/headphones as and whenever you like, but I haven't discovered that for myself yet.

John Mee
  • 953
  • 1
  • 8
  • 18
0

This method works for me. You can try:

pulseaudio -k && sudo alsa force-reload

I adapted this answer from this youtube video.

Nmath
  • 12,333
0

Do both pulseaudio --kill then pulseaudio --start

https://askubuntu.com/a/1242527/52975 put me on the right track. But for me I need to run pulseaudio --kill first before --start:

pulseaudio --kill
pulseaudio --start

Also you may need to restart some applications that were previously running, e.g. VLC won't pick up the new pulseadio automatically otherwise and remains silent.

The kill + start is also mentioned at this bug report: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1963767 which you must now go and upvote.

Tested on Ubuntu 22.04.1, Lenovo ThinkPad P51.