diff --git a/rpm/pulseaudio-system.service b/rpm/pulseaudio-system.service index ded324dd1..b86c1824f 100644 --- a/rpm/pulseaudio-system.service +++ b/rpm/pulseaudio-system.service @@ -9,9 +9,12 @@ Before=multi-user.target systemd-user-sessions.service PartOf=emergency-call.target [Service] -Type=forking -PIDFile=%t/pulse/pid EnvironmentFile=-/etc/sysconfig/pulseaudio -ExecStart=/usr/bin/pulseaudio --daemonize --system --disallow-module-loading $CONFIG +ExecStart=/usr/bin/pulseaudio --daemonize=no --system --disallow-module-loading $CONFIG +# Make sure pid file is cleaned when stopping system PulseAudio, +# as user session service will defer startup until the pid file +# doesn't exist anymore. +ExecStopPost=/bin/sh -c "rm -f /run/pulse/pid" Restart=always RestartSec=1 +Type=notify diff --git a/rpm/pulseaudio.service b/rpm/pulseaudio.service index a99e27e0d..dbd5bf9d3 100644 --- a/rpm/pulseaudio.service +++ b/rpm/pulseaudio.service @@ -4,12 +4,14 @@ After=pre-user-session.target Requires=dbus.socket [Service] -Type=forking -PIDFile=%t/pulse/pid EnvironmentFile=-/etc/sysconfig/pulseaudio -ExecStart=/usr/bin/pulseaudio --start $CONFIG +# Wait until system PulseAudio daemon has completely shut down before +# starting user session daemon. +ExecStartPre=/bin/sh -c "while [ -f /run/pulse/pid ]; do sleep 1; done" +ExecStart=/usr/bin/pulseaudio --daemonize=no $CONFIG Restart=always RestartSec=1 +Type=notify [Install] WantedBy=user-session.target