User service takes 270 ms to start
On a four thread Intel Broadwell system with an SATA SSD with Debian Sid/unstable and PulseAudio 13.0-5, analyzing the log-in time (systemd user session) shows that
$ systemd-analyze --user critical-chain
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.
default.target @343ms
└─pulseaudio.service @67ms +275ms
└─basic.target @67ms
└─sockets.target @67ms
└─dbus.socket @63ms +4ms
└─-.mount @58ms
└─-.slice @58ms
$ systemctl -o short-precise --user cat pulseaudio
# /usr/lib/systemd/user/pulseaudio.service
[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
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
$ systemctl -o short-precise --user status pulseaudio
● pulseaudio.service - Sound Service
Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-03-25 07:28:11 CET; 7min ago
TriggeredBy: ● pulseaudio.socket
Main PID: 1109 (pulseaudio)
CGroup: /user.slice/user-5272.slice/user@5272.service/pulseaudio.service
└─1109 /usr/bin/pulseaudio --daemonize=no
Mär 25 07:28:10.764566 ersatz systemd[1089]: Starting Sound Service...
Mär 25 07:28:11.040054 ersatz systemd[1089]: Started Sound Service.
pulseaudio.socket
is only started later.
Please find the output of the user journal attached (journalctl -o short-precise --user -b
). Please note, that for whatever reason the user session is started twice.