[Jack-Devel] su, limits, PAM and JACK

PrevNext  Index
DateTue, 22 May 2012 18:52:38 +0200
From Robin Gareus <[hidden] at gareus dot org>
ToJACK Mailing List <[hidden] at lists dot jackaudio dot org>
Follow-UpFons Adriaensen Re: [Jack-Devel] su, limits, PAM and JACK
Follow-UpFons Adriaensen Re: [Jack-Devel] su, limits, PAM and JACK
Follow-UpAdrian Knoth Re: [Jack-Devel] su, limits, PAM and JACK
Follow-UpJamie Heilman Re: [Jack-Devel] su, limits, PAM and JACK
Follow-UpSean Bolton Re: [Jack-Devel] su, limits, PAM and JACK
Hya,

This is somewhat off-topic, but I think someone here may know the answer.

For an installation, I'm trying to start jackd during boot on a headless
box, but it fails to acquire real-time privileges.

'user' is in the audio group, and limits.conf is set up. All works fine
if I log-in as 'user' and launch `jackd -d alsa ..` manually.

If I log in as root (or call it from init):

  su user -c 'jackd ..'     # fails -> no rt priv
  su user -l -c 'jackd ..'  # fails -> no rt priv

the actual error message from jack is
  Cannot use real-time scheduling (RR/10)(1: Operation not permitted)

If I change /etc/pam.d/su and add (or un-comment)
"session    required   pam_limits.so"

  su user -l -c 'jackd ..'  # works now (also from init on boot.)

Well. Next step is to not use 'su' but proper POSIX setgid(), setuid().
Alas, I seem to miss some crucial step that sets up the proper limits
after calling setuid().

Any idea what that may be?

Run the following as root from a console (don't use sudo or su to
acquire root priv) to reproduce the problem:

#!/usr/bin/perl
use POSIX qw(setuid setgid);
my ($login,$pass,$uid,$gid) = getpwnam('user');
my $audiog  = getgrnam('audio');
setgid($audiog);
setuid($uid);
print `id`; # shows the UID and GID just fine
system('jackd -d alsa -d hw:1');
# Cannot use real-time scheduling (RR/10)(1: Operation not permitted)
# Aarrrrg!
# help please

any ideas?
robin

PS. of course just running as root works fine, but it does not feel right.
PrevNext  Index

1337705611.24758_0.ltw:2, <4FBBC456.60309 at gareus dot org>