You are not logged in.

#1 2013-06-21 13:53:26

Jamess
Member
Registered: 2010-07-09
Posts: 17

SOLVED: how to get jackd to start with systemd

I am trying to get jack2 to start with systemd but I get the error:

$ sudo systemctl status jack
jack.service - JACK
   Loaded: loaded (/usr/lib/systemd/system/jack.service; disabled)
   Active: failed (Result: core-dump) since Fri 2013-06-21 14:43:12 BST; 10s ago
  Process: 409 ExecStart=/usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -p128 -n3 (code=dumped, signal=ABRT)

Jun 21 14:43:12 instrument jackd[409]: jackdmp comes with ABSOLUTELY NO WARRANTY
Jun 21 14:43:12 instrument jackd[409]: This is free software, and you are welcome to redistribute it
Jun 21 14:43:12 instrument jackd[409]: under certain conditions; see the file COPYING for details
Jun 21 14:43:12 instrument jackd[409]: JACK server starting in realtime mode with priority 89
Jun 21 14:43:12 instrument jackd[409]: Cannot lock down 82274202 byte memory area (Cannot allocate memory)
Jun 21 14:43:12 instrument jackd[409]: Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon... for X11
Jun 21 14:43:12 instrument jackd[409]: jackd: ../dbus/reserve.c:391: rd_acquire: Assertion `0' failed.
Jun 21 14:43:12 instrument systemd[1]: jack.service: main process exited, code=dumped, status=6/ABRT
Jun 21 14:43:12 instrument systemd[1]: Unit jack.service entered failed state.
Jun 21 14:43:12 instrument systemd-coredump[414]: Process 409 (jackd) dumped core.

This is my service unit file:

$ cat /usr/lib/systemd/system/jack.service 
[Unit]
Description=JACK
After=sound.target

[Service]
User=james
ExecStart=/usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -p128 -n3

[Install]
WantedBy=multi-user.target

I can start jackd fine from the command line:

$ /usr/bin/jackd -R -P89 -dalsa -dhw:0 -r 44100 -p128 -n3
jackdmp 1.9.9.5
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2012 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 89
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|128|3|44100|0|0|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 128 frames (2.9 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: use 3 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 3 periods for playback

The memory error seems strange as I have the following in /etc/security/limits.d/99-audio.conf:

$ cat /etc/security/limits.d/99-audio.conf
@audio 	- rtprio 	99
@audio 	- memlock 	unlimited

and in /etc/security/limit.conf:

$ tail /etc/security/limits.conf           
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4


*               -       rtprio          0
*               -       nice            0
@audio          -       rtprio          89
@audio          -       nice           -10
@audio		-	memlock		82274202

The unit service file should be running jack as my user, not root, and I am a member of the audio group:

$ groups james
audio input users

There is a dbus error and I came across this thread:

https://bbs.archlinux.org/viewtopic.php?id=153527

which suggests compiling jack from git. So I tried this and after installing jack2-git I get a slightly different error:

$ sudo systemctl status jack
jack.service - JACK
   Loaded: loaded (/usr/lib/systemd/system/jack.service; disabled)
   Active: failed (Result: exit-code) since Fri 2013-06-21 14:50:37 BST; 8s ago
  Process: 453 ExecStart=/usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -p128 -n3 (code=exited, status=255)

Jun 21 14:50:37 instrument jackd[453]: under certain conditions; see the file COPYING for details
Jun 21 14:50:37 instrument jackd[453]: JACK server starting in realtime mode with priority 89
Jun 21 14:50:37 instrument jackd[453]: Cannot lock down 96108314 byte memory area (Cannot allocate memory)
Jun 21 14:50:37 instrument jackd[453]: Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon... for X11
Jun 21 14:50:37 instrument jackd[453]: Audio device hw:0 cannot be acquired...
Jun 21 14:50:37 instrument jackd[453]: Cannot initialize driver
Jun 21 14:50:37 instrument jackd[453]: JackServer::Open failed with -1
Jun 21 14:50:37 instrument jackd[453]: Failed to open server
Jun 21 14:50:37 instrument systemd[1]: jack.service: main process exited, code=exited, status=255/n/a
Jun 21 14:50:37 instrument systemd[1]: Unit jack.service entered failed state.

Now I'm out of ideas. Can anyone help?

Last edited by Jamess (2013-08-01 07:44:28)

Offline

#2 2013-06-21 14:35:49

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: SOLVED: how to get jackd to start with systemd

Looks like the same error... you're trying to start jack before there's a dbus session bus available for your user.

You need to start jack with X, not as part of a system-wide service hacked up to run as your user.

Offline

#3 2013-06-21 14:48:43

Jamess
Member
Registered: 2010-07-09
Posts: 17

Re: SOLVED: how to get jackd to start with systemd

Ok, but the thing is I am not running an X server. Is it not possible to automate jack to start up without an X server?

Offline

#4 2013-06-22 10:40:41

Jamess
Member
Registered: 2010-07-09
Posts: 17

Re: SOLVED: how to get jackd to start with systemd

Ok so now I have compiled jack from the git source, without dbus and this gets rid of the dbus error. I still have the errors with allocating memory and realtime though:

$ sudo systemctl status jack
jack.service - JACK
   Loaded: loaded (/usr/lib/systemd/system/jack.service; enabled)
   Active: active (running) since Sat 2013-06-22 01:53:07 BST; 2s ago
 Main PID: 254 (jackd)
   CGroup: name=systemd:/system/jack.service
           └─254 /usr/local/bin/jackd -R -P 89 -d alsa -P hw:0 -r 44100 -p 128 -n 2

Jun 22 01:53:08 instrument jackd[254]: This is free software, and you are welcome to redistribute it
Jun 22 01:53:08 instrument jackd[254]: under certain conditions; see the file COPYING for details
Jun 22 01:53:08 instrument jackd[254]: JACK server starting in realtime mode with priority 89
Jun 22 01:53:08 instrument jackd[254]: Cannot lock down 82274202 byte memory area (Cannot allocate memory)
Jun 22 01:53:08 instrument jackd[254]: creating alsa driver ... hw:0|-|128|2|44100|0|0|nomon|swmeter|-|32bit
Jun 22 01:53:08 instrument jackd[254]: configuring for 44100Hz, period = 128 frames (2.9 ms), buffer = 2 periods
Jun 22 01:53:08 instrument jackd[254]: ALSA: final selected sample format for playback: 32bit integer little-endian
Jun 22 01:53:08 instrument jackd[254]: ALSA: use 2 periods for playback
Jun 22 01:53:08 instrument jackd[254]: Cannot use real-time scheduling (RR/89)(1: Operation not permitted)
Jun 22 01:53:08 instrument jackd[254]: AcquireSelfRealTime error

As mentioned above my user is a member of the audio group and the limits are set in /etc/security/limits.d.conf/99-audio.conf so why can't jack use these settings when run as a systemd service?

Offline

#5 2013-08-01 07:43:14

Jamess
Member
Registered: 2010-07-09
Posts: 17

Re: SOLVED: how to get jackd to start with systemd

I'll post my solution here just in case anyone else is looking for the same. Compiling jack from git source without dbus solved the dbus error [1]. The problem with RT priority and memory unlocking is that systemd does not inherit the settings from pam so these need to be specified in the service file. These settings are listed in the systemd manual [2] and there's a thread on the jack-devel list that details the same problem [3], however I also needed to add the RTPRIO line so my final jack.service file looks like this:

[Unit]
Description=JACK
After=sound.target

[Service]
LimitRTPRIO=infinity
LimitMEMLOCK=infinity
User=james
ExecStart=/usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -p128 -n3

[Install]
WantedBy=multi-user.target

[1] - http://jack-audio.10948.n7.nabble.com/H … d7853.html
[2] - http://www.freedesktop.org/software/sys … #LimitCPU=
[3] - http://jack-audio.10948.n7.nabble.com/E … d8747.html

Offline

#6 2016-01-19 09:29:47

AlexTalker
Member
Registered: 2016-01-19
Posts: 1

Re: SOLVED: how to get jackd to start with systemd

Jamess wrote:

I'll post my solution here just in case anyone else is looking for the same. Compiling jack from git source without dbus solved the dbus error [1]. The problem with RT priority and memory unlocking is that systemd does not inherit the settings from pam so these need to be specified in the service file. These settings are listed in the systemd manual [2] and there's a thread on the jack-devel list that details the same problem [3], however I also needed to add the RTPRIO line so my final jack.service file looks like this:

[Unit]
Description=JACK
After=sound.target

[Service]
LimitRTPRIO=infinity
LimitMEMLOCK=infinity
User=james
ExecStart=/usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -p128 -n3

[Install]
WantedBy=multi-user.target

[1] - http://jack-audio.10948.n7.nabble.com/H … d7853.html
[2] - http://www.freedesktop.org/software/sys … #LimitCPU=
[3] - http://jack-audio.10948.n7.nabble.com/E … d8747.html

Hi! Thank you so much!
IDK what have changed in jack since 2013 but by now with the Limit* params I have successful run jackd as user service.
Glad that you published it!

Offline

#7 2016-01-19 10:59:38

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 5,146

Re: SOLVED: how to get jackd to start with systemd

Please don't necrobump, AlexTalker.

https://wiki.archlinux.org/index.php/Fo … bumping.22

Closing.


Sakura:-
Mobo: ASUS P8Z77-V PRO // Processor: Intel Core i7-3770K 3.4GHz // GFX: nVidia GeForce GTX 970 Ti // RAM: 32GB (4x 8GB) Corsair DDR3 (@ 2133MHz) // Storage: 1x 3TB Seagate SATAII 5x 1TB Samsung SATAII, 2x 120GB Corsair SSD

Online

Board footer

Powered by FluxBB