After an upgrade to debian wheezy (I did not upgrade the kernel - it is still 3.8.2) I can no longer start jackd in the way I used to do it. I get you are not allowed to use realtime scheduling.

My investigation show, that this is related to a sudo command in my script, where I sudo from root to martin. The sudo is required, because I start jackd when my firewire mixing console gets switched on, using an udev rule. I can reproduce the problem by typing sudo from the commandline.

In short, this is what I observe

  • start jackd as martin -> works
  • start jackd as root -> works
  • login as root and su - martin, then start jackd -> works
  • as root sudo -u martin /usr/bin/jackd ... -> does not work
  • as above but sudo -E -u martin ... -> does not work

My /etc/security/limits.conf contains these lines

@audio - rtprio 40
@audio - nice -20
@audio - memlock 1554963

sudo -u martin id shows that I am in the audio group, however root is not. After sudoing from root to martin, martin has no realtime permissions

sudo -u martin sh -c "ulimit -e -r"
scheduling priority             (-e) 0
real-time priority              (-r) 0

Adding root to the audo group made no difference. Root still has no realtime permissions and after sudo -u martin martin still looks as above

  • Do you normally run the command as martin (using to sudo to get to root permissions) or do you run it as root and use -u martin to run jack as martin? As martin does sudo ls (my logic here is that your sudoers file may have been changed on upgrade and does not have an entry to allow martin to use sudo? – Drav Sloan Aug 9 '13 at 17:42
  • The usual way to run it as root and use -u martin, as the script is invoked by udev. Other than that martin can run sudo commands just fine because he is in the sudoers file as martin ALL=(ALL) NOPASSWD: ALL – Martin Drautzburg Aug 9 '13 at 18:01
  • sudo is usually used for non-root users to get to root privileges. Have you tried su - martin -c /usr/bin/jackd ... instead? – Drav Sloan Aug 9 '13 at 18:04
  • That did the trick. Apparently the behavior of sudo has changed. Feel like writing an answer? – Martin Drautzburg Aug 9 '13 at 19:46

I would imagine that sudo is preserving your environment of the root user, and therefore may not have paths or other environment variables that the martin user has set. It may be also that you need to run jack via sudo from a shell with the -s /path/to/shell option.

However as root, you have the rights to su (substitute user) without being prompted for a password (and not require configuration of sudo to achieve this, sudo is specifically aimed at non-root users).

 su - martin -c /usr/bin/jackd ...

-c tells su what command to run, and the - option (which can also be done via -l) will attempt to set up the environment similar to that of the user it is being ran as (in this case martin).

  • I didn't verify your explanation, but su - sure did the trick. – Martin Drautzburg Aug 9 '13 at 20:39
  • I'm glad it sorted your issue though! :) – Drav Sloan Aug 9 '13 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.