[Jack-Devel] Cannot use real-time scheduling (RR/89)(1: Operation not permitted)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Jack-Devel] Cannot use real-time scheduling (RR/89)(1: Operation not permitted)

james
I'm trying to start jackd with a systemd script on Arch Linux but I'm
having a problem with RT scheduling.

When I start jack from the command line it works fine:

$ /usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -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
^CJack main caught signal 2
Released audio card Audio0
audio_reservation_finish

But if try to start it with a systemd script that contains the same
command it runs, but with the following error (which makes it sound
really bad!):

$ sudo systemctl status jack
jack.service - JACK
Loaded: loaded (/usr/lib/systemd/system/jack.service; disabled)
Active: active (running) since Wed 2013-06-26 14:44:33 BST; 1s ago
Main PID: 4491 (jack)
CGroup: name=systemd:/system/jack.service
├─4491 /bin/sh /usr/lib/systemd/scripts/jack
└─4492 /usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -p128 -n3

Jun 26 14:44:34 instrument jack[4491]: audio_reservation_init
Jun 26 14:44:34 instrument jack[4491]: Acquire audio card Audio0
Jun 26 14:44:34 instrument jack[4491]: creating alsa driver ...
hw:0|hw:0|128|3|44100|0|0|nomon|swmeter|-|32bit
Jun 26 14:44:34 instrument jack[4491]: configuring for 44100Hz, period =
128 frames (2.9 ms), buffer = 3 periods
Jun 26 14:44:34 instrument jack[4491]: ALSA: final selected sample
format for capture: 16bit little-endian
Jun 26 14:44:34 instrument jack[4491]: ALSA: use 3 periods for capture
Jun 26 14:44:34 instrument jack[4491]: ALSA: final selected sample
format for playback: 32bit integer little-endian
Jun 26 14:44:34 instrument jack[4491]: ALSA: use 3 periods for playback
Jun 26 14:44:34 instrument jack[4491]: Cannot use real-time scheduling
(RR/89)(1: Operation not permitted)
Jun 26 14:44:34 instrument jack[4491]: AcquireSelfRealTime error

It is run as a user that is assigned to the audio group, not as root.
Also, the user has the following permissions in
/etc/security/limits.d/99-audio.conf:

@audio - rtprio 99
@audio - memlock unlimited

How can I enable real-time scheduling from a systemd script?

thanks
James
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Cannot use real-time scheduling (RR/89)(1: Operation not permitted)

Thomas Brand

Hi James,

make sure you start jack as regular user (not root), something like su -l
username -c command in /etc/rc.local

uncomment in /etc/pam.d/su:
#session    required   pam_limits.so

(from
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=38&t=33462&p=357866&hilit=rc.local+jack+rc.local#p357866)

hope that helps,
Thomas

> I'm trying to start jackd with a systemd script on Arch Linux but I'm
> having a problem with RT scheduling.
>
> When I start jack from the command line it works fine:
>
> $ /usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -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
> ^CJack main caught signal 2
> Released audio card Audio0
> audio_reservation_finish
>
> But if try to start it with a systemd script that contains the same
> command it runs, but with the following error (which makes it sound
> really bad!):
>
> $ sudo systemctl status jack
> jack.service - JACK
> Loaded: loaded (/usr/lib/systemd/system/jack.service; disabled)
> Active: active (running) since Wed 2013-06-26 14:44:33 BST; 1s ago
> Main PID: 4491 (jack)
> CGroup: name=systemd:/system/jack.service
> ├─4491 /bin/sh /usr/lib/systemd/scripts/jack
> └─4492 /usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -p128 -n3
>
> Jun 26 14:44:34 instrument jack[4491]: audio_reservation_init
> Jun 26 14:44:34 instrument jack[4491]: Acquire audio card Audio0
> Jun 26 14:44:34 instrument jack[4491]: creating alsa driver ...
> hw:0|hw:0|128|3|44100|0|0|nomon|swmeter|-|32bit
> Jun 26 14:44:34 instrument jack[4491]: configuring for 44100Hz, period =
> 128 frames (2.9 ms), buffer = 3 periods
> Jun 26 14:44:34 instrument jack[4491]: ALSA: final selected sample
> format for capture: 16bit little-endian
> Jun 26 14:44:34 instrument jack[4491]: ALSA: use 3 periods for capture
> Jun 26 14:44:34 instrument jack[4491]: ALSA: final selected sample
> format for playback: 32bit integer little-endian
> Jun 26 14:44:34 instrument jack[4491]: ALSA: use 3 periods for playback
> Jun 26 14:44:34 instrument jack[4491]: Cannot use real-time scheduling
> (RR/89)(1: Operation not permitted)
> Jun 26 14:44:34 instrument jack[4491]: AcquireSelfRealTime error
>
> It is run as a user that is assigned to the audio group, not as root.
> Also, the user has the following permissions in
> /etc/security/limits.d/99-audio.conf:
>
> @audio - rtprio 99
> @audio - memlock unlimited
>
> How can I enable real-time scheduling from a systemd script?
>
> thanks
> James
> _______________________________________________
> Jack-Devel mailing list
> [hidden email]
> http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
>


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Cannot use real-time scheduling (RR/89)(1: Operation not permitted)

Bob van Loosen-2
In reply to this post by james
I'm not sure how systemd works, but for starting at boot you can use
ulimit as root to set the realtime priority permissions, then start
jackd as a user using su or sudo from the same bash instance.

For example:

#!/bin/bash
ulimit -r 99
su myuser /usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -p128 -n3

Regards,

Bob.

On 26-06-13 16:51, James Dunn wrote:

> I'm trying to start jackd with a systemd script on Arch Linux but I'm
> having a problem with RT scheduling.
>
> When I start jack from the command line it works fine:
>
> $ /usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -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
> ^CJack main caught signal 2
> Released audio card Audio0
> audio_reservation_finish
>
> But if try to start it with a systemd script that contains the same
> command it runs, but with the following error (which makes it sound
> really bad!):
>
> $ sudo systemctl status jack
> jack.service - JACK
> Loaded: loaded (/usr/lib/systemd/system/jack.service; disabled)
> Active: active (running) since Wed 2013-06-26 14:44:33 BST; 1s ago
> Main PID: 4491 (jack)
> CGroup: name=systemd:/system/jack.service
> ├─4491 /bin/sh /usr/lib/systemd/scripts/jack
> └─4492 /usr/bin/jackd -R -P89 -dalsa -dhw:0 -r44100 -p128 -n3
>
> Jun 26 14:44:34 instrument jack[4491]: audio_reservation_init
> Jun 26 14:44:34 instrument jack[4491]: Acquire audio card Audio0
> Jun 26 14:44:34 instrument jack[4491]: creating alsa driver ...
> hw:0|hw:0|128|3|44100|0|0|nomon|swmeter|-|32bit
> Jun 26 14:44:34 instrument jack[4491]: configuring for 44100Hz, period
> = 128 frames (2.9 ms), buffer = 3 periods
> Jun 26 14:44:34 instrument jack[4491]: ALSA: final selected sample
> format for capture: 16bit little-endian
> Jun 26 14:44:34 instrument jack[4491]: ALSA: use 3 periods for capture
> Jun 26 14:44:34 instrument jack[4491]: ALSA: final selected sample
> format for playback: 32bit integer little-endian
> Jun 26 14:44:34 instrument jack[4491]: ALSA: use 3 periods for playback
> Jun 26 14:44:34 instrument jack[4491]: Cannot use real-time scheduling
> (RR/89)(1: Operation not permitted)
> Jun 26 14:44:34 instrument jack[4491]: AcquireSelfRealTime error
>
> It is run as a user that is assigned to the audio group, not as root.
> Also, the user has the following permissions in
> /etc/security/limits.d/99-audio.conf:
>
> @audio - rtprio 99
> @audio - memlock unlimited
>
> How can I enable real-time scheduling from a systemd script?
>
> thanks
> James
> _______________________________________________
> Jack-Devel mailing list
> [hidden email]
> http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org