When using a Linux kernel built by the Armbian team, the Klipper host mcu will refuse to start in realtime mode (
-r flag) with the error:
Got error -1 in sched_setscheduler: (1)Operation not permitted
This is because the kernel is compiled with
CONFIG_RT_GROUP_SCHED=y. Systemd’s devs flat out refused to implement the cgroup management for this, so it’s not possible to allocate the
rt_runtime_us from the unit file.
The solution is to disable the limit with
sudo sysctl -w kernel.sched_rt_runtime_us=-1
echo "kernel.sched_rt_runtime_us = -1" | sudo tee /etc/sysctl.d/10-disable-rt-group-limit.conf to make it permanent.
Most kernels out there have it disabled (
CONFIG_RT_GROUP_SCHED=n). Notably, Raspberry Pi OS and Ubuntu don’t need this fix.
It bothered me for quite some time until an Armbian forum user gave me the solution. I put this here to help future users who know how to use the search function.