Anyone encountering RT Jack issues after upgrading to Ubuntu 20.04 LTS?

Note that changing values in the /boot/config file doesn’t make any difference unless you re-compile the kernel from source, using that file.

It’s just info on how the current distro kernel was compiled and it’s not referenced during boot or when the system is running.

It’s possible that the realTimeConfig scan gets some values from that file but if you’ve modified it the scan will actually lie to you.

Hi.

Hope this helps other people with the same problem.

I also had an error «Cannot create RT messagebuffer thread: Operation not permitted (1)» on jack startup. I use AltLinux, so «uninstall snap and disable apparmor» wasn’t an option for me because I haven’t snap and apparmor. Thanks to Peder Hedlund for the MWE (I slightly modified it):
chrt -f 80 echo "I'm chrt'ed!"
It helped me to localize the problem.

The solution was found at https://unix.stackexchange.com/a/284318/192507: you can just say
sudo sysctl -w kernel.sched_rt_runtime_us=-1
After this command jackd starts without errors and Ardour can open session with JACK as an audio backend.

Now can someone explain me what is happening? I just copy/pasted this command without an understanding what it does…

Linux has a property called control groups (cgrops) where you can bundle up processes and give them certain limitations.
You can take the system processes and put them in a cgroup with unlimited access to the CPU and take your user processes and put them in a cgroup with a very limited access to the CPU.
For instance.

Apparently the runtime_us knob is related to the cgroup limitations somehow and by entering -1 into it you switched it off.
That sysctl command is equivalent to sudo echo -1 > /proc/sys/kernel/sched_rt_runtime_us

Note that the sysctl command only affects the current session. As soon as you reboot you’ll get the original value.
It would, by the way, be interesting seeing what that value is.
Please run cat /proc/sys/kernel/sched_rt_runtime_us after your next reboot and post the result.
The default value in a live Xubuntu 20.04 session is 950000.

To make your setting permanent you have to edit /etc/sysctl.conf or add a file in /etc/sysctl.d and add the line kernel.sched_rt_runtime_us = -1

You can take the system processes and put them in a cgroup with unlimited access to the CPU and take your user processes and put them in a cgroup with a very limited access to the CPU.
For instance.

Thank you!

So, if I understand you correctly, less dumb solution is probably to create a cgroup for jackd with a needed amount of CPU resources (BTW, what value is needed)?

I’ve already read https://github.com/jackaudio/jackaudio.github.com/wiki/Cgroups, but there are no /etc/cgconfig.conf or /etc/cgrules.conf neither cgconfig service in my distribution.

Note that the sysctl command only affects the current session. As soon as you reboot you’ll get the original value.
It would, by the way, be interesting seeing what that value is.
Please run cat /proc/sys/kernel/sched_rt_runtime_us after your next reboot and post the result.
The default value in a live Xubuntu 20.04 session is 950000.

$ cat /proc/sys/kernel/sched_rt_runtime_us
950000

In AltLinux it has the same value.

I don’t have any experience with using cgroups so I really can’t say how it should be configured.
Ubuntu 20.04, and likely earlier versions too, has a cgroup-tools package which also contains example .conf files
AltLinux should have something similar.

If disabling runtime_us works it’s probably by far the easiest solution to the problem, even if it isn’t the most elegant one.

1 Like

I’ve upgraded and don’t have the issues.

I cannot use the LL-Kernel anymore after upgrading to 20.04. Display solution stucks at 640x480 and RT just gives me randomly XRUNS. For mixing its ok with the generic kernel, but it’s hard for recording and jamming.

TWIMC: I found the package with cgconfig service in my Linux distribution and the second solution from https://github.com/jackaudio/jackaudio.github.com/wiki/Cgroups (with group rtaudio) solved the problem after

sudo systemctl enable cgred
sudo systemctl enable cgconfig
systemctl reboot

I enabled RT features of the scheduler for all processes launched by user from group audio:

$ cat /etc/cgrules.conf
@audio   cpu    rtaudio/

Now JACK works even without -1 in /proc/sys/kernel/sched_rt_runtime_us.

The cause of problem was a kernel option CONFIG_RT_GROUP_SCHED. It disables RT-features without access configured through cgroups:
https://www.kernel.org/doc/Documentation/scheduler/sched-rt-group.txt
(this is explained in JACK wiki on the page linked above).

You can check this option in your kernel with the following command:

sudo cat /boot/config-`uname -r` | grep CONFIG_RT_GROUP_SCHED

On problematic kernels you’ll get

CONFIG_RT_GROUP_SCHED=y

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.