Bug 14426

Summary: jackit does not configure realtime scheduling which breaks ardour3
Product: Mageia Reporter: Barry Jackson <zen25000>
Component: RPM PackagesAssignee: Nicolas Lécureuil <mageia>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: High CC: cjw, dmorganec, lists.jjorge, luigiwalser, mageia, marja11, mitya, neoclust, olav, thierry.vignaud
Version: CauldronKeywords: PATCH
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard: MGA5TOO
Source RPM: jackit-1.9.10-4.mga5.src.rpm CVE:
Status comment:

Description Barry Jackson 2014-11-01 13:28:46 CET
jackit package does not configure real time scheduling, without which ardour3 will not run.

http://jackaudio.org/faq/linux_rt_config.html

Following the section headed "Systems using PAM" in the above link works fine, but this should be handled in the jackit package.

Looking at Fedora's jack-audio-connection-kit-1.9.9.5-8.fc22.src.rpm there is a patch (jack-realtime-compat.patch) which affects several source files, and a jack-audio-connection-kit-limits.conf.

Part of the patch is conditional and beyond my understanding, so I have held back on attempting to use it.
Manuel Hiebel 2014-11-01 18:57:17 CET

Keywords: (none) => PATCH
CC: (none) => dmorganec, lists.jjorge, luigiwalser, mitya, olav, thierry.vignaud
Assignee: bugsquad => dmorganec

Comment 1 José Jorge 2014-11-01 19:30:40 CET
The real problem is that professional audio needs realtime, while Mageia does not give realtime perms to normal users.

How to handle this well? Maybe an option when creating user account?

Fedora patches create a group with RT, and the README says that jackit users should be members of that group. This is not so simple, AVLinux distro directly gives RT to any user.

I think we should give RT to every users as soon as jackit is installed, maybe with an urpmi README alerting on that.
Comment 2 Barry Jackson 2014-11-02 12:09:33 CET
(In reply to José Jorge from comment #1)
> The real problem is that professional audio needs realtime, while Mageia
> does not give realtime perms to normal users.

Exactly
> 
> How to handle this well? Maybe an option when creating user account?

That would involve the installer :\

> 
> Fedora patches create a group with RT, and the README says that jackit users
> should be members of that group. This is not so simple, AVLinux distro
> directly gives RT to any user.
>

AVLinux is dedicated to audio so that's understandable, but not sure the security implications are so desirable in Mageia

> I think we should give RT to every users as soon as jackit is installed,
> maybe with an urpmi README alerting on that.

Users of jackit may not exist when jackit is installed.

I was thinking about creating a 'realtime' group on jackit install and a script wrapper for the jackit binary that uses an ACL to add the user running jackit to the 'realtime' group if not already a member.
Any user would then be added to the 'realtime' group on running jackit, but not otherwise.
The script would pass jackit parameters straight through to the the real jackit binary located outside $PATH.

Any thoughts?
Comment 3 José Jorge 2014-11-02 20:56:13 CET
> I was thinking about creating a 'realtime' group on jackit install and a script wrapper for the jackit binary that uses an ACL to add the user running jackit to the 'realtime' group if not already a member.

That sounds crazy to me : will you remove the user from that group when stopping jackit?

Anyway, we need a solution as for now ardour is almost as hard to use as if it was not packaged, so let's test your idea...
Comment 4 Barry Jackson 2014-11-02 23:23:54 CET
(In reply to José Jorge from comment #3)
> 
> That sounds crazy to me 

Yes it probably is ;)
 
> Anyway, we need a solution as for now ardour is almost as hard to use as if
> it was not packaged, so let's test your idea...

For now I have added the realtime group creation to a test build of jackit and it now installs /etc/security/limits.d/95-jack.conf

http://mtf.no-ip.co.uk/pub/linux/barjac/distrib/cauldron/SRPMS/jackit-1.9.10-5.mga5.src.rpm

With this version all that is required from the user is to do the following which can be added in a README.urpmi in ardour3

su
usermod -a -G realtime YourUserName
log out
log in

I have tested this in a VM and it seems OK.

An alternative would be a small setup script that would do the same as the above.

WDYT?

@dmorgan any thoughts on this? (I know it's your package - I'm just trying to help)
Comment 5 Christiaan Welvaart 2014-11-03 00:08:44 CET
Adding a user to a group can also be done in userdrake, the only issue I can see there is that the list of groups is rather long.

To make it anywhere user friendly this way the warning/error message from jackit or ardour would need to tell the user exactly what to do (usermod and/or userdrake).

CC: (none) => cjw

Comment 6 José Jorge 2014-11-03 11:47:40 CET
(In reply to Christiaan Welvaart from comment #5)
> Adding a user to a group can also be done in userdrake, the only issue I can
> see there is that the list of groups is rather long.

That's why I prefered a default group for all simple users, which gets RT capablities when jackit is installed.

But this means that any user is created with a secondary group 'default'...
Comment 7 David Walser 2014-11-03 12:33:30 CET
Is there a way we could give the "console" user (one logged into the machine physically) RT access like we give them access to certain devices already?
Comment 8 Barry Jackson 2014-11-03 13:52:47 CET
(In reply to David Walser from comment #7)
> Is there a way we could give the "console" user (one logged into the machine
> physically) RT access like we give them access to certain devices already?

Probably but I don't know where this would be done, and I understand this introduces some security concerns.

Maybe adding something like this to ardour3 (along with the realtime group creation in jackit as above) would solve this immediate issue:

%install
cat > README.urpmi <<EOF
You will need to log out and log in before using Ardour3
...and maybe add a security warning here...
EOF

%pre
gpasswd -a $(users|cut -d' ' -f1) realtime

%postun
gpasswd -d $(users|cut -d' ' -f1) realtime

This should work for a single user, but it would be much better if the logged in user was added to the group automatically.

However, would he then have to log out/in again to activate it? - endless loop :\
Comment 9 David Walser 2014-11-03 14:03:52 CET
If someone has physical access to the machine, it's kind of hard to introduce additional security concerns.

I don't know the current mechanism for doing this, it used to be pam_console, but I think it has changed a couple of times since then.  It's hard to keep up with.
Comment 10 Barry Jackson 2014-11-03 14:06:45 CET
Seems to work. Ardour3 runs OK starting directly or after using qjackctl to start jack:

[baz@jackodesktop x86_64]$ sudo urpmi ardour3-3.5.403-2.mga5.x86_64.rpm

installing ardour3-3.5.403-2.mga5.x86_64.rpm
Preparing...                     #######################################################################################################
Adding user baz to group realtime
      1/1: ardour3               #######################################################################################################
      1/1: removing ardour3-3.5.403-1.mga5.x86_64
                                 #######################################################################################################
----------------------------------------------------------------------
More information on package ardour3-3.5.403-2.mga5.x86_64
You will need to log out and log in before using Ardour3
...and maybe add a security warning here...

----------------------------------------------------------------------


[baz@jackodesktop ~]$ sudo urpme ardour3

removing ardour3-3.5.403-2.mga5.x86_64
removing package ardour3-3.5.403-2.mga5.x86_64
      1/1: removing ardour3-3.5.403-2.mga5.x86_64
                                 ########################################################################################################
Removing user baz from group realtime
Comment 11 Colin Guthrie 2014-11-03 14:38:08 CET
FWIW, the "recommended" way to request realtime for specific threads these days is via rtkit. This is what PulseAudio uses too and it's simple and effective.... except that it doesn't quite work these days due to the "not quite ready yet" nature of the kernel side of the big cgroup rewrite that's still in progress.

There are probably some really nasty hacks that I can cobble together to make rtkit work again in the short term until the rest of that stuff is ready. I'll add it to my list to look into that.

In the meantime, can you confirm that jack is actually using rtkit to request realtime privs?

CC: (none) => mageia

Comment 12 Barry Jackson 2014-11-03 15:01:35 CET
(In reply to Colin Guthrie from comment #11)

> In the meantime, can you confirm that jack is actually using rtkit to
> request realtime privs?

It seems not, so maybe it should.
Comment 13 Samuel Verschelde 2015-05-20 00:08:14 CEST
Any progress status for this issue?

Whiteboard: (none) => MGA5TOO

Marja Van Waes 2015-10-12 11:35:52 CEST

CC: (none) => marja11
Assignee: dmorganec => mageia

Comment 14 Barry Jackson 2015-10-26 11:25:45 CET
Hi Colin, did you get anywhere with this?
I'm just looking at updating ardour and realized when testing that this is still an issue.
Comment 15 Barry Jackson 2015-10-26 13:50:20 CET
Adding neoclust to cc as he is now jackit maintainer.

CC: (none) => neoclust

Comment 16 Barry Jackson 2015-11-29 00:12:08 CET
@Colin
ping ;)

This is still going nowhere as I don't want to break jackit by maybe making it do something undesirable.

Any chance you could take another look?
Comment 17 Barry Jackson 2015-12-17 23:48:51 CET
Fixed in Cauldron

Status: NEW => RESOLVED
Resolution: (none) => FIXED