LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Current and jack real-time scheduling (https://www.linuxquestions.org/questions/slackware-14/current-and-jack-real-time-scheduling-4175672262/)

flyingv2 03-31-2020 03:39 AM

Current and jack real-time scheduling
 
Hi,

I'm using up to date slackware current (stock kernel 5.4.28) and when I started jackd via qjackctl I see in the messages window the following text:

Cannot use real-time scheduling (RR/10) (1: Operation not permitted)
AcquireSelfRealTime error


After some googling I put "threadirqs" kernel flag in lilo.conf and I created /etc/initscript with

Code:

ulimit -l unlimited
ulimit -r 65
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

# Execute the program.
eval exec "$4"

after reboot i get:

Code:

bash-5.0$ ulimit -l
unlimited
bash-5.0$ ulimit -r
65
bash-5.0$

but when I stert jack the error "Cannot use real-time scheduling" persist... How can I fix this? I want to setup things most optimal with stock kernel.

All text in qjackctl messages window:

Code:

10:30:44.683 Statistics reset.
10:30:44.685 ALSA connection change.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
10:30:44.724 ALSA connection graph change.
10:30:58.485 JACK is starting...
10:30:58.485 /usr/bin/jackd -dalsa -r44100 -p256 -n2 -D -Chw:CODEC -Phw:CODEC
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
10:30:58.491 JACK was started with PID=2384.
jackdmp 1.9.14
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2019 Filipe Coelho.
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
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio2
creating alsa driver ... hw:CODEC|hw:CODEC|256|2|44100|0|0|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 256 frames (5.8 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 16bit little-endian
ALSA: use 2 periods for playback
Cannot use real-time scheduling (RR/10) (1: Operation not permitted)
AcquireSelfRealTime error
10:31:00.568 JACK connection change.
10:31:00.568 Server configuration saved to "/home/anze/.jackdrc".
10:31:00.569 Statistics reset.
10:31:00.572 Client activated.
10:31:00.572 Patchbay deactivated.
10:31:00.582 JACK connection graph change.

Some additional info: when i run guitarix this error occurs:

Code:

Pitch Tracker *** Error creating realtime thread - tuner not started
I'm using uphoria audio interface.

Thanks...

Alien Bob 03-31-2020 04:48 AM

Did you compile jack, qjackctl and guitarix yourself? If so, where did you get the SlackBuild scripts? Works for me, using my own packages on Slackware64-current.
Code:

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
11:37:24.308 ALSA verbindingen aangepast.
Tue Mar 31 11:37:24 2020: Starting jack server...
Tue Mar 31 11:37:24 2020: JACK server starting in realtime mode with priority 10
Tue Mar 31 11:37:24 2020: self-connect-mode is "Don't restrict self connect requests"
Tue Mar 31 11:37:24 2020: Acquired audio card Audio0
Tue Mar 31 11:37:24 2020: creating alsa driver ... hw:0|hw:0|256|2|44100|0|0|nomon|swmeter|soft-mode|32bit
Tue Mar 31 11:37:24 2020: configuring for 44100Hz, period = 256 frames (5.8 ms), buffer = 2 periods
Tue Mar 31 11:37:24 2020: ALSA: final selected sample format for capture: 32bit integer little-endian
Tue Mar 31 11:37:24 2020: ALSA: use 2 periods for capture
Tue Mar 31 11:37:24 2020: ALSA: final selected sample format for playback: 32bit integer little-endian
Tue Mar 31 11:37:24 2020: ALSA: use 2 periods for playback
Tue Mar 31 11:37:24 2020: graph reorder: new port 'system:capture_1'
Tue Mar 31 11:37:24 2020: New client 'system' with PID 0
Tue Mar 31 11:37:24 2020: graph reorder: new port 'system:capture_2'
Tue Mar 31 11:37:24 2020: graph reorder: new port 'system:playback_1'
Tue Mar 31 11:37:24 2020: graph reorder: new port 'system:playback_2'
Tue Mar 31 11:37:24 2020: New client 'PulseAudio JACK Sink' with PID 1725
Tue Mar 31 11:37:24 2020: Connecting 'PulseAudio JACK Sink:front-left' to 'system:playback_1'
Tue Mar 31 11:37:24 2020: Connecting 'PulseAudio JACK Sink:front-right' to 'system:playback_2'
Tue Mar 31 11:37:24 2020: New client 'PulseAudio JACK Source' with PID 1725
Tue Mar 31 11:37:24 2020: Connecting 'system:capture_1' to 'PulseAudio JACK Source:front-left'
Tue Mar 31 11:37:24 2020: Connecting 'system:capture_2' to 'PulseAudio JACK Source:front-right'
Tue Mar 31 11:37:25 2020: Saving settings to "/home/eha/.config/jack/conf.xml" ...
11:37:26.530 JACK verbindingen aangepast.


gattocarlo 03-31-2020 05:40 AM

Quote:

Originally Posted by flyingv2 (Post 6106145)
Hi,

I'm using up to date slackware current (stock kernel 5.4.28) and when I started jackd via qjackctl I see in the messages window the following text:

Cannot use real-time scheduling (RR/10) (1: Operation not permitted)
AcquireSelfRealTime error


After some googling I put "threadirqs" kernel flag in lilo.conf and I created /etc/initscript with

Code:

ulimit -l unlimited
ulimit -r 65
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

# Execute the program.
eval exec "$4"

after reboot i get:

Code:

bash-5.0$ ulimit -l
unlimited
bash-5.0$ ulimit -r
65
bash-5.0$


I would suggest not to use /etc/initscript since this is going to give unlimited resources to every user.

Since you are using current I'd suggest to try PAM (available in testing) and add this file:

Code:

/etc/security/limits.d/audio.conf:

@audio  -  rtprio    95
@audio  -  memlock    unlimited

Then logoff and login back. Now jackd should be starting with real-time priority. This is the way I'm using it (and jackdbus is my default server, with pulseaudio running as a jack client).

As far as I remember (but I could be wrong) I used to use "ulimit -Hl" and "ulimit -Hr" to set the hardware limits. But I then switched to PAM so I'm not sure if this is going to fix you problem.

Hope this helps,
andrea

EDIT: for the solution I'm suggesting the user must belong to the audio group.

EDIT II: did you set the capabilities of /usr/bin/jackd? (that was implicit in AlienBOB's question):

Code:

/sbin/setcap cap_ipc_lock,cap_sys_nice=ep /usr/bin/jackd
Using "ulimit" is not going to be enough. This is not needed if you use PAM.

flyingv2 03-31-2020 05:44 AM

Quote:

Did you compile jack, qjackctl and guitarix yourself? If so, where did you get the SlackBuild scripts? Works for me, using my own packages on Slackware64-current.
Yes, slackbuilds from SlackBuilds.org but even when I installed your packages the result is the same...

gattocarlo 03-31-2020 05:51 AM

Quote:

Originally Posted by flyingv2 (Post 6106192)
Yes, slackbuilds from SlackBuilds.org but even when I installed your packages the result is the same...

Are you using a PAM enabled slackware installation? If so you need to use the "/etc/security/limit.d/audio.conf" solution. setcap doesn't work with PAM.

flyingv2 03-31-2020 06:08 AM

Quote:

EDIT II: did you set the capabilities of /usr/bin/jackd? (that was implicit in AlienBOB's question):
Yes -> slackbuild takes care of that

Code:

if [ -x /sbin/setcap ]; then
    # Give all binaries in the package realtime capabilities:
    JACKBINS=( $(cd $PKG/usr/bin ; find . -type f -printf '%P\n') )
    for EXE in \${JACKBINS[@]}; do
      /sbin/setcap cap_ipc_lock,cap_sys_nice=ep usr/bin/\$EXE
    done
fi

Quote:

Are you using a PAM enabled slackware installation?
No, if it is not necessary I don't want install additional software...

gattocarlo 03-31-2020 07:54 AM

Quote:

Originally Posted by flyingv2 (Post 6106204)

No, if it is not necessary I don't want install additional software...

It is not necessary but handy, otherwise you'll have to use setcap for every jack client (and some, like pulseaudio, ardour or carla, are tricky).

Anyway the last thing I can think about is that maybe you are using a file system which does not support capabilities, but ext4, the slackware default, should.

Try with:

Code:


/sbin/getcap /usr/bin/jackd

you should get something like:

Code:

/usr/bin/jackd = cap_ipc_lock,cap_sys_nice+ep

flyingv2 03-31-2020 01:40 PM

Code:

bash-5.0# getcap /usr/bin/jackd
/usr/bin/jackd = cap_ipc_lock,cap_sys_nice+ep
bash-5.0# getcap /usr/bin/qjackctl
/usr/bin/qjackctl = cap_ipc_lock,cap_sys_nice+ep

Now i really dont know what to look at next...

0XBF 03-31-2020 05:00 PM

Try one of the solutions provided here:

https://github.com/jackaudio/jackaud...m/wiki/Cgroups

I had a real-time kernel on my machine for audio work but I was curious so I played around with getting the generic kernel to work in a non-PAM system. With 'threadirqs' and an initscript setting 'ulimit -l unlimited' and 'ulimit -r 90' I was getting the same error as you.

I found that webpage after some digging. Slackware's kernel does have the config option CONFIG_RT_GROUP_SCHED=y so I tried solution 1, editing /etc/cgconfig.conf and running '/etc/rc.d/rc.cgconfig start'. This seems to have gotten rid of that error and realtime starts normally now.

Hope this helps, good luck!

gattocarlo 04-01-2020 02:51 AM

cgroups are an unneeded complication I think, but I tried this solution and I found it was working nicely... I'm not sure it is working any longer since ConsoleKit2 is no longer linked to cgmanager (I'm sure about the PAM enabled version, but not about the version included in current), but I could be wrong. See my post here:

https://www.linuxquestions.org/quest...0/#post6089880

After thinking a bit about it I recalled that I didn't use "ulimit -r" in my /etc/initscript, because setcap does the job. I only used "ulimit -Hl unlimited" for memory locking. Try removing "ulimit -r".

I really suggest you to go the PAM way if you are using your system for music production. Everything is in "testing" and you need just to change a line in /etc/slackpkg/slackpkg.con:

Code:

PRIORITY=( patches %PKGMAIN extra pasture testing )

to

PRIORITY=( testing patches %PKGMAIN extra pasture )

You need to manually install cracklib libpwquality pam,then slackpkg upgrade-all and you are done. No need to mess with setcap, and everything works really smootly.

flyingv2 04-01-2020 02:43 PM

Ok, no more jack errors with pam... Can I expect now any pam related problems?

Thanks

gattocarlo 04-02-2020 08:54 AM

Quote:

Originally Posted by flyingv2 (Post 6106737)
Ok, no more jack errors with pam... Can I expect now any pam related problems?

Thanks

After some initial problems, easily debugged, no issues with PAM here. Glad you solved your problem with jack.


All times are GMT -5. The time now is 09:24 PM.