[mythtv-users] Upgrade from 18.04 to 20.04 - pulseaudio

Stephen Worthington stephen_agent at jsw.gen.nz
Sun Oct 18 12:53:26 UTC 2020

I have now upgraded two of my four MythTV PCs from Xubuntu 18.04 to
20.04.  I have not had any major problems so far, but on my main
MythTV system an old annoying minor problem came back again.  This is
where at random times during the day my Alsa S/PDIF output on the
motherboard sound card gets muted.  I first had this with 18.04 and
eventually tracked it down to be a problem with pulseaudio, which I
solved by disabling pulseaudio by following some instructions about
how to modify its config files.  With the upgrade to 20.04, those
modified files must have been overwritten and pulseaudio was running
again, and exhibiting the same bug.  So this time I thought I would
track down where pulseaudio was being run from and disable it that

It turns out that since 18.04 or maybe a little before that,
pulseaudio has been being run as a systemd user job, so that it gets
run once per user (not per session) under the userid of the user
running the desktop.  You can see its status and journal with these
commands, run from the desktop user without sudo:

systemctl --user status pulseaudio.service
systemctl --user status pulseaudio.socket
journalctl --user-unit pulseaudio.service
journalctl --user-unit pulseaudio.socket

I then shut down pulseaudio using:

systemctl --user stop pulseaudio.service
systemctl --user stop pulseaudio.socket

and verified that the pulseaudio process was gone with:

ps -e | grep pulse

So then I tried to disable the pulseaudio units with:

systemctl --user disable pulseaudio.service
systemctl --user disable pulseaudio.socket

Those commands ran without any messages, but the command:

systemctl --user is-enabled pulseaudio.service

still reported that pulseaudio.service was enabled.  Fortunately, I
was able to use:

locate pulseaudio.service

to find that /etc/systemd/user/ had links to the pulseaudio units:

root at mypvr:/etc/systemd/user/default.target.wants# ll
total 8
drwxr-xr-x 2 root root 4096 Oct 17 03:34 ./
drwxr-xr-x 4 root root 4096 Oct 17 03:34 ../
lrwxrwxrwx 1 root root   40 Oct 17 03:34 pulseaudio.service ->

root at mypvr:/etc/systemd/user/sockets.target.wants# ll
total 8
drwxr-xr-x 2 root root 4096 Oct 17 03:35 ./
drwxr-xr-x 4 root root 4096 Oct 17 03:34 ../
lrwxrwxrwx 1 root root   36 Oct 17 03:31 dirmngr.socket ->
lrwxrwxrwx 1 root root   46 Oct 17 03:35 gpg-agent-browser.socket ->
lrwxrwxrwx 1 root root   44 Oct 17 03:35 gpg-agent-extra.socket ->
lrwxrwxrwx 1 root root   38 Oct 17 03:35 gpg-agent.socket ->
lrwxrwxrwx 1 root root   42 Oct 17 03:35 gpg-agent-ssh.socket ->
lrwxrwxrwx 1 root root   46 Oct 17 03:32 pk-debconf-helper.socket ->
lrwxrwxrwx 1 root root   39 Oct 17 03:34 pulseaudio.socket ->

The /etc/systemd/user directory is where packages install links to
make user systemd units run from each user, rather than just for one
user.  But there does not seem to be any systemd command that will
install or remove those links, so I had to do it manually using a root
prompt rm command to delete both the pulseaudio.service and
pulseaudio.socket links.  After that

systemctl --user is-enabled pulseaudio.service

from the desktop user reported that it was disabled.

I also found an entry in XFCE4's Settings > Session and Startup >
Application Autostart that would run pulseaudio, so I unticked that.
It is possible that was there because this system has been upgraded
from somewhere before Mythbuntu 14.04, and that is how pulseaudio used
to be run.  It may not be there in new 20.04 installs.  Gnome desktops
probably have an equivalent setting somewhere.

I then used alsamixer to unmute the S/PDIF output, and tried to play a
recording in mythfrontend.  But mythfrontend complained that it could
not play the audio - the audio device was not working.  And when I
tried to reconfigure the audio settings, selecting Alsa: Default again
as the output gave an error that the device did not exist.
Fortunately, shutting down mythfrontend and starting it again made
this problem go away, so mythfrontend must not have been seeing the
audio device changes that happened when pulseaudio was shut down.

So now pulseaudio dose not start up after I boot the PC, and I hope
that this problem is solved and will stay solved on future upgrades.

So, if you want to disable pulseaudio because it is causing problems,
do the above GUI setting change and then do this from a desktop user

systemctl --user stop pulseaudio.service
systemctl --user stop pulseaudio.socket
sudo rm /etc/systemd/user/default.target.wants/pulseaudio.service
sudo rm /etc/systemd/user/sockets.target.wants/pulseaudio.socket

and then restart mythfrontend.

More information about the mythtv-users mailing list