Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes I get choppy sound so I was thinking about running pulseaudio with realtime priority. But when I try to do this, Ubuntu just won't let me.

$ pulseaudio -vvv --start --realtime=1
D: main.c: Started as real root: no, suid root: yes
I: main.c: PolicyKit refuses acquire-high-priority privilege.
I: main.c: PolicyKit refuses acquire-real-time privilege.
I: main.c: Called SUID root and real-time and/or high-priority scheduling
   was requested in the configuration. However, we lack the necessary privileges:
I: main.c: We are not in group 'pulse-rt', PolicyKit refuse to grant us the 
   requested privileges and we have no increase RLIMIT_NICE/RLIMIT_RTPRIO 
   resource limits.
I: main.c: For enabling real-time/high-priority scheduling please acquire 
   the appropriate PolicyKit privileges, or become a member of 'pulse-rt', 
   or increase the RLIMIT_NICE/RLIMIT_RTPRIO resource limits for this user.
I: main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted
I: main.c: setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted
D: main.c: Can realtime: no, can high-priority: no
D: main.c: Can realtime: no, can high-priority: no
I: main.c: Daemon startup successful.

I am a member of pulse-rt group

$ sudo adduser vava 'pulse-rt'
The user `vava' is already a member of `pulse-rt'.

And I'm not sure how to increate RLIMIT_PRPRIO, I've tried to put

vava             soft    rtprio          10

into /etc/security/limits.conf but that didn't help.

So what else should I do to allow myself to run pulseaudio with realtime priority?

share|improve this question
What do the /etc/pulse/daemon.conf entries related to priority and realtime-scheduling contain? Also check this post: – nagul Sep 24 '09 at 23:18
It doesn't really matter what daemon.conf contains when I use command line arguments as they take priority. Also, from the long it is clearly seen that PA wants to use real-time priority but something won't let it. – vava Sep 25 '09 at 5:10
@nagul, but thanks for the link, seems like it getting better – vava Sep 25 '09 at 5:21

Make sure you have a realtime kernel installed:

dpkg -l | grep linux-rt

If that doesn't list anything, you'll need to install one:

sudo apt-get install linux-rt linux-headers-rt

Ubuntu Studio uses the realtime kernel by default; I'm not sure it uses the same apt repositories as standard Ubuntu. If you're running standard, but want some of the features of Ubuntu Studio, read through this page. A section on installing and configuring Real Time Kernel is about halfway down the page. Also check the Real-Time Support section:

After you've got the kernel you still need to set up real-time access for your applications.

All you have to do for this is give your audio group permissions to access the rtprio, nice, and memlock limits. To do this, you just need to run these commands, which will add some lines to the file /etc/security/limits.conf:

sudo su -c 'echo @audio - rtprio 99 >> /etc/security/limits.conf'
sudo su -c 'echo @audio - nice -19 >> /etc/security/limits.conf'
sudo su -c 'echo @audio - memlock unlimited >> /etc/security/limits.conf'
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .