[systemd-devel] require a system service unit to start a user service as a dependency

John graysky at archlinux.us
Thu Dec 24 10:38:59 UTC 2020


On Thu, Dec 24, 2020 at 3:29 AM Andrei Borzenkov <arvidjaar at gmail.com> wrote:
>
> On Thu, Dec 24, 2020 at 5:48 AM John <graysky at archlinux.us> wrote:
> >
> > I need to have the following start
> > /usr/lib/systemd/user/pulseaudio.service so it can make use of
> > pulseaudio.  Using a After= or Wants= does not work.  What is the
> > correct way to have a system service like this run a user service
> > unit?
> >
>
> No, that's not possible. PA also supports system service, if this is a
> kiosk system, maybe you can use it instead.

Thank you for the reply.  There are security risks running pulseaudio
in system mode[1].  I can append use PAMName=login and
After=systemd-user-sessions.service, but doing so moves the service
out of the system slice into the user slice.  Once in the user slice,
when called to reboot or shutdown, systemd brutally kills it before it
can gracefully stop which causes data loss as documented in my
previous thread[2].

Is there solution that keeps the service under the user slice and
allows systemd to wait for it to shutdown before killing on on a
system reboot/shutdown?

1. https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/
2. https://lists.freedesktop.org/archives/systemd-devel/2020-December/045713.html


More information about the systemd-devel mailing list