You are not logged in.

#1 2016-05-18 12:20:09

EdeWolf
Member
Registered: 2016-01-06
Posts: 66

[solved] custom target gets ignored

Hello,

I've written a simle, custom target:

[Unit]
# cat /etc/systemd/system/jack.target
[Unit]
Description=Prepare and Setup Jack
#Requires=basic.target
#After=basic.target
#Before=multi-user.target
#AllowIsolate=no

However,

systemctl list-units --type=target --all

does not list this target, completely independet of wether I put it below /etc/systemd/system or below /usr/lib/systemd/system. Even after reboot and of course daemon-reload.

Also, while a jackd.service does properly create the jack.target.wants directory, and the service itself does get listed as enabled, it does not start up and there is not even any notion in journalctl. No error or success of either the service nor the target. No information at all, it simply gets ignored.

I can however start the service manually and it works. What am I missing? And how do I get systemd to at least recognise my target?

The service, just for the record:

[Unit]
Description=JACK Realtime Audio Server
Requires=jack_config.service
After=jack_config.service

[Service]
Type=simple

Environment="DEVICE=HAMMERFALL"
Environment="NAME=KLANGDIENER"
Environment="CLOCKSOURCE="
Environment="RATE=44100"
Environment="VERBOSE="
Environment="HWMON="
Environment="TIMEOUT=666"
Environment="PRIORITY=80"
Environment="NPERIODS=2"
Environment="PERIOD=1024"
#Environment="PERIOD=128"
#--clocksource
#--verbose

User=me
Group=audio

LimitRTPRIO=96
LimitMEMLOCK=infinity

ExecStart=/usr/bin/taskset -c 7 /usr/bin/jackd ${VERBOSE} ${CLOCKSOURCE} --realtime --realtime-priority ${PRIORITY} --timeout ${TIMEOUT} -d alsa --device hw:${DEVICE} --rate ${RATE} --nperiods ${NPERIODS} --period ${PERIOD} --duplex ${HWMON}

[Install]
WantedBy=jack.target

Last edited by EdeWolf (2016-05-18 18:24:56)

Offline

#2 2016-05-18 14:07:36

Raynman
Member
Registered: 2011-10-22
Posts: 1,313

Re: [solved] custom target gets ignored

$ systemctl list-unit-files --type=target

should show your custom target. The list-units command only shows loaded targets.

You have created a target (and added jackd.service as a dependency), now you need to start it or hook it up to something else that gets started. When you do this, systemd will process it and it should also show up in the list of loaded units.

On startup, systemd starts default.target. Many other units get pulled in by this target (through dependencies like Requires directives and .wants directories), but systemd is not just going to start every single .target that you have installed on your system.

Edit: maybe you should also clarify (for yourself and/or us) why you want a custom target in addition to a service unit.

Last edited by Raynman (2016-05-18 14:12:26)

Online

#3 2016-05-18 17:34:46

EdeWolf
Member
Registered: 2016-01-06
Posts: 66

Re: [solved] custom target gets ignored

Thanks. list-unit-files does indeed display the target.

However, the service still does not get startet

# systemctl is-enabled jackd.service
enabled

# systemctl status -l jackd.service
● jackd.service - JACK Realtime Audio Server
   Loaded: loaded (/etc/systemd/system/jackd.service; enabled; vendor preset: disabled)
   Active: inactive (dead)

# ps aux | grep jack
root       587  0.0  0.0  12312  2204 pts/0    S+   19:19   0:00 grep jack
# journalctl | grep jackd
#

However, I am able to start the service manually, so the unit file is ok.

Edit: maybe you should also clarify (for yourself and/or us) why you want a custom target in addition to a service unit.

It's more than one service unit, all of which depend on each other and I want to make sure those get loaded before multi-user.target fires off. Besides, more important, I want to understand what is going on, as those units loaded fine before I startet messing with an additional target.

Edit: Also I am wondering, why journalctl does not show anything. Also:

# systemctl --failed
0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

So, in short: The service unit is enabled, but ignored during boot, without any hint at all.

Last edited by EdeWolf (2016-05-18 17:40:13)

Offline

#4 2016-05-18 18:29:38

EdeWolf
Member
Registered: 2016-01-06
Posts: 66

Re: [solved] custom target gets ignored

Raynman wrote:

but systemd is not just going to start every single .target that you have installed on your system.

That actually gave a clue. I added my services as a dependency to another service and now they do get loaded again during boot. Not statisfactory, as I did not want this dependency, but it seems, you cannot insert arbitrary services and just enable them.

Final Edit:
Made a Drop In for multi-user.target with a Wants on jack.target. Seems to work now and feels more natural than above solution.

Last edited by EdeWolf (2016-05-18 19:25:41)

Offline

Board footer

Powered by FluxBB