<div dir="ltr"><div><div>With systemd 218 and 219, I have a strange issue that processes
running as root cannot acquire realtime priority (SCHED_RR, priority
22). Further, if (and only if) root is logged in (via tty or ssh), users
processes can also not acquire realtime priority. If root is NOT logged
in, user processes CAN acquire real time priority(!).<br><br>With systemd 216 there is no issue. I'm on Arch Linux.<br><br>To reproduce:<br><br>Method 1:<br><br>1. Login on tty1 as as root<br>2. Execute program that attempts to acquire realtime priority.<br><br>Method 2:<br><br>1. Login on tty1 as root<br>2. Log in on tty2 as other user<br>3. Execute program that attempts to acquire realtime priority on tty2<br><br>If
step 1 is skipped in method 2, or logged in before root, the program
runs normally (as non-root user) (assuming appropriate rlimit via
/etc/security/limits.conf).<br><br>strace output:<br><br>sched_setscheduler(183, SCHED_RR, { 22 }) = -1 EPERM (Operation not permitted)<br><br>ulimit -r (as root): 0 (but should be able to do realtime as root anyway)<br>ulimit -r (as user): 65 (via /etc/security/limits.conf, audio group)<br><br>Downgrading only systemd, systemd-sysvcompat, libsystemd to 216 fixes the issue. With 218 and 219 I get the EPERM above.<br><br>Source code for test program:<br><br><a href="https://gist.github.com/larsch/58d1be84b24c98a4493f" target="_blank">https://gist.github.com/larsch/58d1be84b24c98a4493f</a><br><br></div>Bug or PEBKAC?<br>-- <br></div>Lars<br></div>