[systemd-devel] user service not starting on login

Topi Miettinen toiwoton at gmail.com
Sun May 12 15:37:03 UTC 2019


On 12.5.2019 18.08, Matt Zagrabelny wrote:
> Hey Mantas and others,
> 
> On Thu, May 9, 2019 at 11:57 PM Mantas Mikulėnas <grawity at gmail.com 
> <mailto:grawity at gmail.com>> wrote:
> 
>     On Fri, May 10, 2019 at 5:22 AM Matt Zagrabelny <mzagrabe at d.umn.edu
>     <mailto:mzagrabe at d.umn.edu>> wrote:
> 
>         Greetings,
> 
>         I am attempting to get a user service running on my session login.
> 
>         The unit is called jack. I've enabled it via:
> 
>         $ systemctl --user enable jack
> 
>         When I boot up the system and log in I see that it is inactive.
>         I can start it manually without issue:
> 
>         $ systemctl --user status jack
>         ● jack.service - JACK 2
>             Loaded: loaded
>         (/home/theophilus/.config/systemd/user/jack.service; enabled;
>         vendor preset: enabled)
>             Active: inactive (dead)
> 
>         $ journalctl --user -u jack -b
>         -- Logs begin at Thu 2019-05-09 20:54:31 CDT, end at Thu
>         2019-05-09 21:13:53 CDT. --
>         -- No entries --
> 
>         $ systemctl --user cat jack
>         # /home/theophilus/.config/systemd/user/jack.service
>         [Unit]
>         Description=JACK 2
>         Before=sound.target
>         Before=pulseaudio.service
>         Requires=dbus.socket
> 
>         [Service]
>         Type=dbus
>         BusName=org.jackaudio.Controller
> 
> 
>     Among other things, the bus name seems to be incorrect. In
>     jack2-dbus the only claimed name appears to be "org.jackaudio.service".
> 
>         ExecStart=/usr/bin/jack_control start
> 
> 
>     The jack_control program does not spawn nor directly execute the
>     actual jackd daemon. Instead it *remotely*
>     activates org.jackaudio.service through D-Bus (you'll see jackdbus
>     under the dbus.service cgroup), then sends it a single method call
>     and exits.
> 
>     In other words, jack_control is not a Type=dbus service, it's a
>     oneshot script that controls another Type=dbus service. You can
>     imagine that it's just a wrapper around `dbus-send` or `gdbus call`,
>     and is something you'd instead use in JACK's *ExecStartPost=*.
> 
>     A direct conversion of jackdbus to a systemd service would look like
>     this – because of the way jackdbus is written, it always needs that
>     extra command to be sent over D-Bus (either by running `jack_control
>     start` or by using the manual tools):
> 
>     (~/.config/systemd/user/jack.service)
>     [Service]
>     Type=dbus
>     BusName=org.jackaudio.service
>     ExecStart=/usr/bin/jackdbus auto
>     #ExecStartPost=/usr/bin/jack_control start
>     #ExecStartPost=/usr/bin/gdbus call -e -d org.jackaudio.service -o
>     /org/jackaudio/Controller -m org.jackaudio.JackControl.StartServer
>     ExecStartPost=/usr/bin/busctl call --user org.jackaudio.service
>     /org/jackaudio/Controller org.jackaudio.JackControl StartServer
> 
> 
> I used this service file (thank you for providing it!), but it seems 
> jack is still not starting when the user logs in to the session:
> 
> $ systemctl --user status jack
> ● jack.service
>     Loaded: loaded (/home/theophilus/.config/systemd/user/jack.service; 
> enabled; vendor preset: enabled)
>     Active: inactive (dead)
> 
> $ ps -ef | grep jack
> theophi+  1200  1183  0 09:30 pts/3    00:00:00 grep jack
> 
> $ systemctl --user status jack
> ● jack.service
>     Loaded: loaded (/home/theophilus/.config/systemd/user/jack.service; 
> enabled; vendor preset: enabled)
>     Active: inactive (dead)
> 
> $ systemctl --user cat jack
> # /home/theophilus/.config/systemd/user/jack.service
> [Service]
> Type=dbus
> BusName=org.jackaudio.service
> ExecStart=/usr/bin/jackdbus auto
> #ExecStartPost=/usr/bin/jack_control start
> #ExecStartPost=/usr/bin/gdbus call -e -d org.jackaudio.service -o 
> /org/jackaudio/Controller -m org.jackaudio.JackControl.StartServer
> ExecStartPost=/usr/bin/busctl call --user org.jackaudio.service 
> /org/jackaudio/Controller org.jackaudio.JackControl StartServer

You are missing:

[Install]
WantedBy=default.target

Then when you enable it, systemd should create a symbolic link in directory
.config/systemd/user/default.target.wants
to your service.

-Topi

> 
> $ systemctl --user is-enabled jack
> enabled
> 
> $ systemctl --user is-active jack
> inactive
> 
> $ systemctl --user | grep jack
> 
> $ systemctl --user | grep bus
> at-spi-dbus-bus.service                                                  
>                               loaded active running   Accessibility 
> services bus
> dbus.service                                                            
>                                loaded active running   D-Bus User 
> Message Bus
> dbus.socket                                                              
>                               loaded active running   D-Bus User Message 
> Bus Socket
> 
> If I start ardour (which makes use of jack) it (ardour) tells me jack is 
> not running.
> 
> I can start the jack service:
> 
> $ systemctl --user start jack
> 
> So...
> 
> How can I figure out why it is not starting automatically?
> 
> Thanks!
> 
> -m
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 



More information about the systemd-devel mailing list