-3

I just realized there is a /usr/lib/systemd/user/pulseaudio.service provided by the pulseaudio package.

It is disabled but pulseaudio works completely fine without. Have been using it for a year. Don't need to do anything after boot to start the actual executable. It's an Ubuntu shipped-in package after all.

Why is it so ? Should I enable the service ? If so, why doesn't Ubuntu do this by default ? Also, what will change from current operation ?

Thanks in advance

PS: The ubuntu wiki page doesn't give any information.

1
  • 1
    I have merged your two questions together. Please do not ask the same question multiple times.
    – fossfreedom
    Commented Dec 22, 2020 at 0:15

2 Answers 2

1

There is an extensive discussion of the purpose of running pulseaudio in system mode and why it is not the default in the PulseAudio documentation: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/

and the downside is discussed here: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/

You should read the full page in the documentation, the main point is

Running PulseAudio in system-wide mode has some limitations:

  • All users with access to the sound server cann kill/modify all sinks/sources and streams of all other connected clients
  • There is only a single namespace for cached sound samples, i.e. there can be only a single Gnome event sound profile active at the same time

It has some disadvantages:

  • Worse security, because the user can now command a server app running under another user name. He could even load/unload modules from that sound server
  • Settings like the stored volume levels managed by module-stream-restore are no longer per-user but system-wide

This is why it is not enabled per default. It doesn't hurt to use it if you are aware of the potential implications.

If you enable it, you gain sound (for example over the network) on a machine without logged-in users.

1
  • 1
    @Atralb - add any extra clarifications via an edit to your answer. Clarifications and responses to answers given should be via your question. I've removed all of these comments to tidy up the thread.
    – fossfreedom
    Commented Dec 22, 2020 at 0:08
0

Contents of the file read:

[Unit]
Description=Sound Service

# We require pulseaudio.socket to be active before starting the daemon, because
# while it is possible to use the service without the socket, it is not clear
# why it would be desirable.
#
# A user installing pulseaudio and doing `systemctl --user start pulseaudio`
# will not get the socket started, which might be confusing and problematic if
# the server is to be restarted later on, as the client autospawn feature
# might kick in. Also, a start of the socket unit will fail, adding to the
# confusion.
#
# After=pulseaudio.socket is not needed, as it is already implicit in the
# socket-service relationship, see systemd.socket(5).
Requires=pulseaudio.socket
ConditionUser=!root

[Service]
ExecStart=/usr/bin/pulseaudio --daemonize=no --log-target=journal
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
Restart=on-failure
RestrictNamespaces=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
# Note that notify will only work if --daemonize=no
Type=notify
UMask=0077

[Install]
Also=pulseaudio.socket
WantedBy=default.target

Seems to be an automatic startup service to get PulseAudio running, instead of, like it says, running systemctl --user start pulseaudio.

please do correct me if I am wrong!

1
  • 3
    @Atralb - please be courteous in all responses - all clarifications should be via an edit to your question. I have removed all of the comments here.
    – fossfreedom
    Commented Dec 22, 2020 at 0:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .