Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
running hydrogen via jack as normal user [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
spitzwegerich
l33t
l33t


Joined: 04 Mar 2003
Posts: 697
Location: Lower Bavaria, Central Europe

PostPosted: Sun Jan 02, 2005 5:41 pm    Post subject: running hydrogen via jack as normal user [solved] Reply with quote

Hello!

It took me some time to realize, that I have to run jackd and hydrogen as root to make jack output of hydrogen work.

For example
alsaplayer -o jack
runs as a normal user. So I wonder if it is possible to make hydrogen/jack work for normal users, too.
_________________
"Work is the curse of the drinking classes."
-Oskar Wilde


Last edited by spitzwegerich on Sun Jan 02, 2005 11:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
djpenguin
Guru
Guru


Joined: 02 Sep 2004
Posts: 386

PostPosted: Sun Jan 02, 2005 7:21 pm    Post subject: Reply with quote

Yes, it is. You need to add the realtime linux security module to give users realtime access (necessary for JACK to run in low-latency mode.)

First, make sure your user is added to the 'audio' group (and all the other groups you want)

Code:

# usermod -G wheel,audio,portage,users,games *USERNAME*


Set the proper kernel options:

CONFIG_MODULES=y
CONFIG_MODULES_UNLOAD=y
CONFIG_SECURITY=y
CONFIG_SECURITY_CAPABILITIES=m
CONFIG_SECURITY_SELINUX=y


Then unmask and install the realtime module and configure it for use:
Code:

# nano /etc/portage/package.keywords
add:   sys-apps/realtime-lsm ~x86

# emerge realtime-lsm
# modprobe realtime gid=18 allcaps=1


gid sets the group id (18 is the gentoo audio group), and allcaps sets the 'all capabilities' mode, which is like the full capabilities patch for the 2.4 kernel. Since the realtime module IS a security hole, you should load and unload it as you need to use audio programs.

DO NOT use 'jackstart' to run JACK, use the 'jackd -R' command (plus your specifc options)

qjackctl is a nice Qt-based control app to configure and run JACK, as well as making patchbay connections.
Back to top
View user's profile Send private message
spitzwegerich
l33t
l33t


Joined: 04 Mar 2003
Posts: 697
Location: Lower Bavaria, Central Europe

PostPosted: Sun Jan 02, 2005 10:38 pm    Post subject: Reply with quote

Wow, many thanks!

I did not know that for 2.6 kernels there is a new possibility to get this realtime-capability to work. I have been patching my 2.6 kernels in the same way as the 2.4 kernels.

Your tutorial is very good. It is a rare event that you follow some instructions and everything works as expected.

I feel that there should be some mechanisms to handle jack applications in gentoo. Would it make sense to have an init skript for jackd? Or is there some reasonable way to automatically load/unload the realtime module before starting/after terminating a jack application?
_________________
"Work is the curse of the drinking classes."
-Oskar Wilde
Back to top
View user's profile Send private message
djpenguin
Guru
Guru


Joined: 02 Sep 2004
Posts: 386

PostPosted: Mon Jan 03, 2005 12:02 am    Post subject: Reply with quote

All JACK applications require jackd to be running in order to launch, so pairing the module loading/unloading to the start/stop of the jackd service would be the way to go.

jackd is fairly system-intensive, so I wouldn't reccomend adding it as an initscript.

A single GUI to handle all the module and service stuff would be cool...maybe an expansion of qjackctl is in order.
Back to top
View user's profile Send private message
Gentree
Watchman
Watchman


Joined: 01 Jul 2003
Posts: 5350
Location: France, Old Europe

PostPosted: Thu Jan 06, 2005 12:38 am    Post subject: Reply with quote

Quote:
DO NOT use 'jackstart' to run JACK, use the 'jackd -R' command (plus your specifc options)

qjackctl is a nice Qt-based control app to configure and run JACK, as well as making patchbay connections.


I looked at qjackctl but have not yet managed to get it to start jack. In fact it uses startjack that you recommend not using , which way would you suggest I go?

Also I have just gone over to 2.6.10-morph9 which is amazingly fast (responsive) and has realtime-lsm in the kernel. So I unmerged the realtime package to avoid conficts and was still able to do the modprobe you suggest.

qjackctl still fails.

Thanks for any tips you may be able to give.


8)
_________________
Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86
Back to top
View user's profile Send private message
djpenguin
Guru
Guru


Joined: 02 Sep 2004
Posts: 386

PostPosted: Sat Nov 12, 2005 7:21 pm    Post subject: Reply with quote

spitzwegerich wrote:
Wow, many thanks!

I did not know that for 2.6 kernels there is a new possibility to get this realtime-capability to work. I have been patching my 2.6 kernels in the same way as the 2.4 kernels.

Your tutorial is very good. It is a rare event that you follow some instructions and everything works as expected.

I feel that there should be some mechanisms to handle jack applications in gentoo. Would it make sense to have an init skript for jackd? Or is there some reasonable way to automatically load/unload the realtime module before starting/after terminating a jack application?


I know this is an old thread, but if you are still interested in automatically loading/unloading the realtime module when you start/stop the JACK server using qjackctl, I have written a couple of small scripts that work nicely. First you need to make sure you have sudo installed on your system and add these lines to the bottom of your /etc/sudoers file:
Code:
# permission for audio users to start JACK realtime
%audio          ALL=(root)      NOPASSWD: /sbin/modprobe



Then you create the empty files where the scripts will reside:
Code:
# touch /usr/bin/rtaudio
# touch /usr/bin/rtaudio_off



Fire up your favorite editor and drop this text into /usr/bin/rtaudio
Code:
#!/bin/bash

# rtaudio script version 1
# a script to load the linux realtime-lsm kernel module for audio (JACK/qjackctl) use

# define variables
GID=18                  # group identifier for the audio group
LOG=rtaud_log.txt       # name of the log file
MOD=realtime            # module name

# detect the presence of the logfile and create it if it does not exist
if [ -f $HOME/$LOG  ]   # if the log exists
then
        cat /dev/null   # do nothing <--ugly hack...find a way to make this prettier
else
        touch $HOME/$LOG; echo "Created `date`" >> $HOME/$LOG; echo ---------- >> $HOME/$LOG; \
        echo "LOG BEGINS" >> $HOME/$LOG; echo ---------- >> $HOME/$LOG

fi

# load realtime module, restricted to audio group
sudo modprobe $MOD gid=$GID

# capture output status in a variable
RES=$?

# check and log modprobe result...yes/no for now, possibly add more in the future
if [ $RES == 0 ]
then
        echo "Realtime-lsm succesfully loaded `date`" >> $HOME/$LOG
else
        echo "Realtime-lsm failed to load `date` - check your /etc/sudoers file" >> $HOME/$LOG

fi



And the following should go into /usr/bin/rtaudio_off:
Code:
#!/bin/bash

# rtaudio_off script version 1
# a script to remove the realtime-lsm module after audio (JACK) use

# define variables
LOG=rtaud_log.txt       # log file
MOD=realtime            # module name

# unload realtime module
sudo modprobe -r $MOD

# capture output status in a variable
RES=$?

# check and log modprobe result...yes/no for now, possibly add more in the future
if [ $RES == 0 ]
then
        echo "Realtime-lsm succesfully unloaded `date`" >> $HOME/$LOG
else
        echo "Realtime-lsm failed to unload `date` - check your sudoers file" >> $HOME/$LOG

fi


Make both the scripts executable:
Code:
# chmod 755 /usr/bin/rtaud*


Then go to the configuration page for qjackctl, and select the Options tab. Set up the scripts so that rtaudio runs before startup and rtaudio_off runs after shutdown. After that, running JACK is just as simple as opening up qjackctl and clicking the 'Start' button.


Last edited by djpenguin on Tue Nov 15, 2005 5:55 pm; edited 2 times in total
Back to top
View user's profile Send private message
gour
Apprentice
Apprentice


Joined: 16 Apr 2003
Posts: 231
Location: Zagreb, Croatia

PostPosted: Tue Nov 15, 2005 3:59 pm    Post subject: Reply with quote

djpenguin wrote:

Then go to the configuration page for qjackctl, and select the Options tab. Set up the scripts so that rtaudio runs before startup and rtaudio_off runs after shutdown. After that, running JACK is just as simple as opening up qjackctl and clicking the 'Start' button.


Thanks dude, works like a charm 8)

The only thing which I had to change is to write
Code:
/sbin/modprobe/
:wink:

What application can you recommend as an audacity replacement on gnome (I just migrated from kde) desktop :?:

(I need simple stuff, like amplifying badly recorded lectures on usb-stick in .wav and exporting them to ogg, mp3...)

Sincerely,
Gour
Back to top
View user's profile Send private message
djpenguin
Guru
Guru


Joined: 02 Sep 2004
Posts: 386

PostPosted: Tue Nov 15, 2005 5:53 pm    Post subject: Reply with quote

Audacity should work fine under gnome. If you want a two-track editor that's JACK-enabled, check out ReZound. It's in portage.
Back to top
View user's profile Send private message
gour
Apprentice
Apprentice


Joined: 16 Apr 2003
Posts: 231
Location: Zagreb, Croatia

PostPosted: Tue Nov 15, 2005 6:19 pm    Post subject: Reply with quote

djpenguin wrote:
Audacity should work fine under gnome.


Audacity (1.2.3) does not support JACK and whenever I try File --> Preferences it crashes (on MD64) :cry:

Quote:
If you want a two-track editor that's JACK-enabled, check out ReZound. It's in portage.


No more luck with rezound too :cry:

I emerged mhwaveedit & glame. Let's see :roll:

Sincerely,
Gour
Back to top
View user's profile Send private message
lpgasparotto
n00b
n00b


Joined: 29 Jan 2009
Posts: 12
Location: Buenos Aires, Argentina

PostPosted: Thu Jan 29, 2009 1:32 am    Post subject: Re: running hydrogen via jack as normal user [solved] Reply with quote

spitzwegerich wrote:
It took me some time to realize, that I have to run jackd and hydrogen as root to make jack output of hydrogen work.


You're lucky, I can't find the way to make emerge to compile with jack support. How did you get it? The same happens with ReZound

Thank you very much in advance.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum