Armbian kernel & Klipper host mcu: "Got error -1 in sched_setschedule"

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.

4 Likes

Good to know, I’m always using no stock hardware, armbian has these little quirks.

What build of Armbian are you using?

Bullseye, Buster, Focal, etc?

I’m curious if it makes a difference if you use the Debian or Ubuntu release or if this is across the board for Armbian?

Currently on buster, but have used focal & bullseye all seem to have quirks, buster has been stable for 3-4months even with on going updates in klipper / kiauh.

I just fixed my pi with the command. I have spent a lot of time searching the whole internet to figure out what happened and what to do. And it turned out the solution had been posted in the klipper forum…
Anyways, thanks a lot!!

(BTW, I am using the orange pi zero3 with the stock image bullseye debian)

1 Like