Quantcast

Trying to run jackd from udev

classic Classic list List threaded Threaded
31 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Trying to run jackd from udev

Jeremy Jongepier
I'm trying to run jackd from a script that is triggered by udev. But
when I try to do so jackd complains:

jackd 0.122.0
...
JACK is running in realtime mode, but you are not allowed to use
realtime scheduling.
...

But the user trying to run jackd (pi) is a member of the audio group.
The udev rule looks like this:

ATTRS{idVendor}=="0218", ATTRS{idProduct}=="0001", ACTION=="change",
RUN+="/usr/bin/sudo -u pi -s /home/pi/bin/drumpad"

Is this maybe related to using sudo? I'd like to get this working, the
idea is that whenever I plug in my drumpad the udev rule and thus the
script gets executed. The script checks if jackd is already started and
then moves on starting up jalv with the drumkv1 plug-in. The script
itself works fine, it's just the udev part that got me puzzled.

Thanks!

Jeremy






_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

David-71
On Fri, 22 Mar 2013 23:51:00 +0100
Jeremy Jongepier <[hidden email]> wrote:

> ATTRS{idVendor}=="0218", ATTRS{idProduct}=="0001", ACTION=="change",
> RUN+="/usr/bin/sudo -u pi -s /home/pi/bin/drumpad"

What if you add '-g audio' ?

-- David
_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Ralf Mardorf
In reply to this post by Jeremy Jongepier
On Fri, 2013-03-22 at 23:51 +0100, Jeremy Jongepier wrote:
> Is this maybe related to using sudo?

I noticed that when checking the user by $USER or $EUID, the result
often is wrong, but the output of $(id -u) until now always was correct,
so directly after the sudo I would add

        echo $? > id.log
        id -u >> id.log

to the script. The $? to check if sudo is working and id -u to check if
it really does switch the user, assumed the output of $? should be 0.

_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Ralf Mardorf
On Sat, 2013-03-23 at 06:49 +0100, Ralf Mardorf wrote:

> On Fri, 2013-03-22 at 23:51 +0100, Jeremy Jongepier wrote:
> > Is this maybe related to using sudo?
>
> I noticed that when checking the user by $USER or $EUID, the result
> often is wrong, but the output of $(id -u) until now always was correct,
> so directly after the sudo I would add
>
>         echo $? > id.log
>         id -u >> id.log
>
> to the script. The $? to check if sudo is working and id -u to check if
> it really does switch the user, assumed the output of $? should be 0.

Hm?

My idea isn't good.

[root@archlinux rocketmouse]# /usr/bin/sudo -u rocketmouse -s echo ":)"
:)
[root@archlinux rocketmouse]# echo $?
0
[root@archlinux rocketmouse]# id -u
0

Perhaps you should test it by adding an additional sudo

[root@archlinux rocketmouse]# /usr/bin/sudo -u rocketmouse -s id -u
1000

just to test if it really does work as expected.


_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Jeremy Jongepier
In reply to this post by David-71
On 03/23/2013 05:47 AM, David wrote:
> What if you add '-g audio' ?

Hello David,

Already tried that, makes no difference.

Jeremy
_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Jeremy Jongepier
In reply to this post by Ralf Mardorf
On 03/23/2013 07:48 AM, Ralf Mardorf wrote:
> Perhaps you should test it by adding an additional sudo

Hello Ralf,

Already tried that, makes no difference.

Regards,

Jeremy
_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Ralf Mardorf
ASAP (maybe this weekend) I'll try to do something similar for Arch and
Ubuntu, but I've got completely no knowledge about udev.

_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Ralf Mardorf
In reply to this post by Jeremy Jongepier
Perhaps this can do the job. I've got no time to try it now, since it
seems to be too complicated for me to do it on the quick.

"udevil - udevil "mounts and unmounts removable devices [snip] It can
also selectively automatically start applications or execute commands
after mounting [snip]" -
https://wiki.archlinux.org/index.php/Udev#Automounting_udisks_wrappers

_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Ralf Mardorf
On Sat, 2013-03-23 at 11:29 +0100, Ralf Mardorf wrote:
> Perhaps this can do the job. I've got no time to try it now, since it
> seems to be too complicated for me to do it on the quick.
>
> "udevil - udevil "mounts and unmounts removable devices [snip] It can
> also selectively automatically start applications or execute commands
> after mounting [snip]" -
> https://wiki.archlinux.org/index.php/Udev#Automounting_udisks_wrappers

Perhaps it doesn't auto-mount, sorry.


_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Jeremy Jongepier
In reply to this post by Ralf Mardorf
On 03/23/2013 11:29 AM, Ralf Mardorf wrote:
> Perhaps this can do the job. I've got no time to try it now, since it
> seems to be too complicated for me to do it on the quick.
>
> "udevil - udevil "mounts and unmounts removable devices [snip] It can
> also selectively automatically start applications or execute commands
> after mounting [snip]" -
> https://wiki.archlinux.org/index.php/Udev#Automounting_udisks_wrappers

An USB MIDI drumpad is not a removable device that can be mounted.

Jeremy
_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Jeremy Jongepier
In reply to this post by Jeremy Jongepier
On 03/23/2013 12:38 PM, Fryderyk Dziarmagowski wrote:
> Jeremy,
>
> sound like sudo is not a perfect tool for you, try
> su -l pi -c/home/pi/bin/drumpad
> instead of it.
>
> Freddy

Hello Freddy,

Thanks but unfortunately this yields the same results. Jack doesn't
start and complains that it can't run in realtime mode.
I could of course disable realtime mode but I don't want that, I need
the strict scheduling otherwise I quickly get xruns on the Raspberry Pi.

Jeremy
_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Ralf Mardorf
In reply to this post by Jeremy Jongepier
On Sat, 2013-03-23 at 13:39 +0100, Jeremy Jongepier wrote:
> On 03/23/2013 11:29 AM, Ralf Mardorf wrote:
> > https://wiki.archlinux.org/index.php/Udev#Automounting_udisks_wrappers
>
> An USB MIDI drumpad is not a removable device that can be mounted.

Yes, I'm still confused since "device" vs "block device", so I sent a
request to Arch general.

To: General Discussion about Arch Linux
Subject: udev
Date: Sat, 23 Mar 2013 12:00:45 +0100

Hi,

before I start learning how to use udev, I've got some questions to
understand what program can do or not do what I want. I don't want to
know how to do it, if something is able to do what I want, I'll do
research and read myself, I just want to know if it's possible and by
what program it is possible, assumed it can be done.

"udevil - udevil "mounts and unmounts removable devices [snip] It can
also selectively automatically start applications or execute commands
after mounting [snip]" -
https://wiki.archlinux.org/index.php/Udev#Automounting_udisks_wrappers

IIUC it doesn't auto-mount? Not that important for me.

Since I needed to remove gvfs, because it wakes up sleeping external USB
drives, I want to have something else to mount block devices as easy as
possible.

Does this or something else also enable to execute a command, after an
USB MIDI device is connected? IOW can I use it to launch jackd after an
USB MIDI device is connected or is there another way to do this?

Somebody on LAU tries to do something similar, until now without
success,
http://lists.linuxaudio.org/pipermail/linux-audio-user/2013-March/091699.html .

Any hints are welcome.

Regards,
Ralf

_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Jeremy Jongepier
On 03/23/2013 02:02 PM, Ralf Mardorf wrote:
> Yes, I'm still confused since "device" vs "block device", so I sent a
> request to Arch general.
>
> To: General Discussion about Arch Linux
> Subject: udev
> Date: Sat, 23 Mar 2013 12:00:45 +0100

Ralf,

I'd appreciate it if you do not send me off-list mails.

Thanks,

Jeremy
_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Raphaël Bollen
In reply to this post by Jeremy Jongepier
On 03/22/2013 11:51 PM, Jeremy Jongepier wrote:
> I'm trying to run jackd from a script that is triggered by udev. But when I try to do so jackd
> complains:
>
> jackd 0.122.0
> ...
> JACK is running in realtime mode, but you are not allowed to use realtime scheduling.
> ...
>


Hi Jeremy,

I've had the same error message and issue trying to start an application using jack form an init.d
script at boot time. It seems that start-stop-daemon does not impose PAM ("Pluggable Authentication
Module") limits to the process it starts. Maybe you are facing a similar issue with udev. My
solution was to autologin the user and then start the application.

Cheers

--
Raphaël.

> But the user trying to run jackd (pi) is a member of the audio group. The udev rule looks like this:
>
> ATTRS{idVendor}=="0218", ATTRS{idProduct}=="0001", ACTION=="change", RUN+="/usr/bin/sudo -u pi -s
> /home/pi/bin/drumpad"
>
> Is this maybe related to using sudo? I'd like to get this working, the idea is that whenever I plug
> in my drumpad the udev rule and thus the script gets executed. The script checks if jackd is already
> started and then moves on starting up jalv with the drumkv1 plug-in. The script itself works fine,
> it's just the udev part that got me puzzled.
>
> Thanks!
>
> Jeremy
>
>
>
>
>
>
> _______________________________________________
> Linux-audio-user mailing list
> [hidden email]
> http://lists.linuxaudio.org/listinfo/linux-audio-user
>


--
Raphaël
_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

drew Roberts-2
In reply to this post by Jeremy Jongepier
On Saturday 23 March 2013 08:49:57 Jeremy Jongepier wrote:

> On 03/23/2013 12:38 PM, Fryderyk Dziarmagowski wrote:
> > Jeremy,
> >
> > sound like sudo is not a perfect tool for you, try
> > su -l pi -c/home/pi/bin/drumpad
> > instead of it.
> >
> > Freddy
>
> Hello Freddy,
>
> Thanks but unfortunately this yields the same results. Jack doesn't
> start and complains that it can't run in realtime mode.
> I could of course disable realtime mode but I don't want that, I need
> the strict scheduling otherwise I quickly get xruns on the Raspberry Pi.

Just as a test, can you simply sudo to bash and then do things by hand to see
if anything there fails? Or did I miss you already trying that?
>
> Jeremy

all the best,

drew
_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Jeremy Jongepier
On 03/23/2013 02:52 PM, drew Roberts wrote:
> Just as a test, can you simply sudo to bash and then do things by hand to see
> if anything there fails? Or did I miss you already trying that?

This works.
I think it's PAM related. I'll muck around the PAM config files.

Jeremy
_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

drew Roberts-2
On Saturday 23 March 2013 10:03:22 Jeremy Jongepier wrote:
> On 03/23/2013 02:52 PM, drew Roberts wrote:
> > Just as a test, can you simply sudo to bash and then do things by hand to
> > see if anything there fails? Or did I miss you already trying that?
>
> This works.
> I think it's PAM related. I'll muck around the PAM config files.

There might be some help in the Rivendell community, on the mailing lists or
the irc channel on freenode.

I seem to recall info on starting jack as a user from init scripts in the
past.
>
> Jeremy

all the best,

drew

_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Len Ovens
In reply to this post by Jeremy Jongepier

On Sat, March 23, 2013 5:39 am, Jeremy Jongepier wrote:

> On 03/23/2013 11:29 AM, Ralf Mardorf wrote:
>> Perhaps this can do the job. I've got no time to try it now, since it
>> seems to be too complicated for me to do it on the quick.
>>
>> "udevil - udevil "mounts and unmounts removable devices [snip] It can
>> also selectively automatically start applications or execute commands
>> after mounting [snip]" -
>> https://wiki.archlinux.org/index.php/Udev#Automounting_udisks_wrappers
>
> An USB MIDI drumpad is not a removable device that can be mounted.

Whats the difference?

Auto mount -> device gets plugged in -> mount gets run as user
drumpad -> device gets plugged in -> script gets run as user

In both cases some binary gets run to deal with the USB device that was
plugged in.

--
Len Ovens
www.OvenWerks.net

_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Len Ovens
In reply to this post by Jeremy Jongepier

On Sat, March 23, 2013 5:49 am, Jeremy Jongepier wrote:

> On 03/23/2013 12:38 PM, Fryderyk Dziarmagowski wrote:
>> Jeremy,
>>
>> sound like sudo is not a perfect tool for you, try
>> su -l pi -c/home/pi/bin/drumpad
>> instead of it.
>>
>> Freddy
>
> Hello Freddy,
>
> Thanks but unfortunately this yields the same results. Jack doesn't
> start and complains that it can't run in realtime mode.
> I could of course disable realtime mode but I don't want that, I need
> the strict scheduling otherwise I quickly get xruns on the Raspberry Pi.

Just checking the obvious, jackd does run in real time when started from a
login shell?



--
Len Ovens
www.OvenWerks.net

_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to run jackd from udev

Len Ovens
In reply to this post by Raphaël Bollen

On Sat, March 23, 2013 6:42 am, Raphaël BOLLEN wrote:

> On 03/22/2013 11:51 PM, Jeremy Jongepier wrote:
>> I'm trying to run jackd from a script that is triggered by udev. But
>> when I try to do so jackd
>> complains:
>>
>> jackd 0.122.0
>> ...
>> JACK is running in realtime mode, but you are not allowed to use
>> realtime scheduling.
>> ...
>>
>
>
> Hi Jeremy,
>
> I've had the same error message and issue trying to start an application
> using jack form an init.d
> script at boot time. It seems that start-stop-daemon does not impose PAM
> ("Pluggable Authentication
> Module") limits to the process it starts. Maybe you are facing a similar
> issue with udev. My
> solution was to autologin the user and then start the application.

Which would not work here... but, maybe try changing
/etc/security/limits.d/audio.conf (or it's equiv) to be user specific
instead of group. Nope that whole file relies on PAM.

There is always the ugly way:

Have your udev module touch a file on plug in and rm it on unplug. Run a
user space loop that looks for that file and runs jack (if needed) and
connects whatever. File gone resets to look for file coming back.

--
Len Ovens
www.OvenWerks.net

_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
12
Loading...