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)?
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.
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.
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.