Re: user service not starting on login

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 10, 2019 at 5:22 AM Matt Zagrabelny <mzagrabe@xxxxxxxxx> 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 think you can even make manual jack_control invocations start your systemd service using this:

(~/.local/share/dbus-1/services/org.jackaudio.service)
[D-BUS Service]
Name=org.jackaudio.service
Exec=/bin/false
SystemdService=jackservice

(Side note: The filename of the latter file should actually be dbus-1/services/org.jackaudio.service.service [sic], but because JACK already used the incorrect one in /usr/share, let's stick to it.)

--
Mantas Mikulėnas
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux