changing ulimit from rc.local in order to start audio scripts from there

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

changing ulimit from rc.local in order to start audio scripts from there

Athanasios Silis
Hi there,
I have setup an audio system around jackd based on ubuntu studio (14.04 LTS). I have written various scripts to setup jackd and clients. It is tested and up running. Now I would like to add a cmd in rc.local in order for the whole system to be brought up at boot.

I tried

#set limits
su - nass -c "ulimit -r 95 -l unlimited" 2>&1 | tee -a  /tmp/audio.log

#verify limits
su - nass -c "ulimit -r -l" 2>&1 | tee -a  /tmp/audio.log

#boot audio stuff
su - nass -c "cd /home/nass/audio_setup/scripts ; bash ./cmdaudio start" 2>&1 | tee -a  /tmp/audio.log

However the ulimit "set" command fails with message
ulimit: real-time priority: cannot modify limit: Operation not permitted

I read that ulimits are not ready yet at this time. Is there a way to forcefully "bring them up" in order to have them set for the user "nass" before starting the audio scripts ??

Thank you

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

Re: changing ulimit from rc.local in order to start audio scripts from there

Bill Purvis
On 09/10/17 19:15, Athanasios Silis wrote:
Hi there,
I have setup an audio system around jackd based on ubuntu studio (14.04 LTS). I have written various scripts to setup jackd and clients. It is tested and up running. Now I would like to add a cmd in rc.local in order for the whole system to be brought up at boot.

I tried

#set limits
su - nass -c "ulimit -r 95 -l unlimited" 2>&1 | tee -a  /tmp/audio.log

#verify limits
su - nass -c "ulimit -r -l" 2>&1 | tee -a  /tmp/audio.log

#boot audio stuff
su - nass -c "cd /home/nass/audio_setup/scripts ; bash ./cmdaudio start" 2>&1 | tee -a  /tmp/audio.log

However the ulimit "set" command fails with message
ulimit: real-time priority: cannot modify limit: Operation not permitted

I read that ulimits are not ready yet at this time. Is there a way to forcefully "bring them up" in order to have them set for the user "nass" before starting the audio scripts ??

Thank you


_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
ulimit is built-in to the command shell program. I'd suggest you encase your commands in a shell script
with the ulimit at the start, and invoke that, via su, from rc.local.

However, I suspect that will still reject the request. I'd suggest you look at starting the programs,
then use the renice command (see man renice) to alter the priority once they are running.
You need to be root to raise the priority of a process above normal.

Bill

-- 
+----------------------------------------+
| Bill Purvis                            |
| email: [hidden email]                  |
+----------------------------------------+

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

Re: changing ulimit from rc.local in order to start audio scripts from there

Paul Davis
renice has nothing to do with realtime scheduling and is of no use or importance in tuning scheduling of realtime applications.

On Mon, Oct 9, 2017 at 4:09 PM, Bill Purvis <[hidden email]> wrote:
On 09/10/17 19:15, Athanasios Silis wrote:
Hi there,
I have setup an audio system around jackd based on ubuntu studio (14.04 LTS). I have written various scripts to setup jackd and clients. It is tested and up running. Now I would like to add a cmd in rc.local in order for the whole system to be brought up at boot.

I tried

#set limits
su - nass -c "ulimit -r 95 -l unlimited" 2>&1 | tee -a  /tmp/audio.log

#verify limits
su - nass -c "ulimit -r -l" 2>&1 | tee -a  /tmp/audio.log

#boot audio stuff
su - nass -c "cd /home/nass/audio_setup/scripts ; bash ./cmdaudio start" 2>&1 | tee -a  /tmp/audio.log

However the ulimit "set" command fails with message
ulimit: real-time priority: cannot modify limit: Operation not permitted

I read that ulimits are not ready yet at this time. Is there a way to forcefully "bring them up" in order to have them set for the user "nass" before starting the audio scripts ??

Thank you


_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
ulimit is built-in to the command shell program. I'd suggest you encase your commands in a shell script
with the ulimit at the start, and invoke that, via su, from rc.local.

However, I suspect that will still reject the request. I'd suggest you look at starting the programs,
then use the renice command (see man renice) to alter the priority once they are running.
You need to be root to raise the priority of a process above normal.

Bill

-- 
+----------------------------------------+
| Bill Purvis                            |
| email: [hidden email]                  |
+----------------------------------------+

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



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

Re: changing ulimit from rc.local in order to start audio scripts from there

Len Ovens
In reply to this post by Athanasios Silis
On Mon, 9 Oct 2017, Athanasios Silis wrote:

> Hi there,
> I have setup an audio system around jackd based on ubuntu studio (14.04 LTS). I
> have written various scripts to setup jackd and clients. It is tested and up
> running. Now I would like to add a cmd in rc.local in order for the whole system
> to be brought up at boot.

Be aware that some startup stuff has a timer in it. The setting of
ondemand happens 60 seconds after it's startup is run as an example... at
least in debian derived stuff.

Installing jackd properly (rt permissions answer yes) should set this
stuff up for you anyway.


> However the ulimit "set" command fails with message
> ulimit: real-time priority: cannot modify limit: Operation not permitted
>
> I read that ulimits are not ready yet at this time. Is there a way to forcefully
> "bring them up" in order to have them set for the user "nass" before starting the
> audio scripts ??

Use sleep 70 at the start of your script? Make sure you are giving nass a
login shell may also help. You may have to set environmet variables first
as well. Make sure nass is in the audio group or whatever your distro uses
to give rt permissions.

I do not know if these things will help, I have run a headless session
complete with dbus, pulseaudio, jackdbus and various other audio
applications... I really didn't need PA and therefore could have run
without the dbus stuff. It was more of an experiment to see what I could
do and the headless box had less than 1/4Gb of ram anyway, so it was not
practical for real use. I should try setting up a headless jackd box on
something newer though where I can make real use of it.

--
Len Ovens
www.ovenwerks.net

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

Re: changing ulimit from rc.local in order to start audio scripts from there

Brent Busby
Len Ovens <[hidden email]> writes:

[...]
> I do not know if these things will help, I have run a headless session
> complete with dbus, pulseaudio, jackdbus and various other audio
> applications... I really didn't need PA and therefore could have run
> without the dbus stuff. It was more of an experiment to see what I
> could do and the headless box had less than 1/4Gb of ram anyway, so it
> was not practical for real use. I should try setting up a headless
> jackd box on something newer though where I can make real use of it.

I didn't know that PulseAudio was the only thing that wanted Jack to be
controlled by DBus.  (Somehow, that's not surprising though.)  I'm not
using PulseAudio either, so would it be recommended to build jack2 (SMP
flavor) with no DBus support and just run it as a regular daemon in that
case?

--
- Brent Busby + ===============================================
                + With the rise of social networking
--  Studio   -- + sites, computers are making people
--  Amadeus  -- + easier to use every day.
----------------+ ===============================================
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: changing ulimit from rc.local in order to start audio scripts from there

Athanasios Silis
Hi all, 
I have indeed built a jackd2 without dbus support and this is the one I am using. 

And 70secs didn't help either. I could auto login to my account and start the audio scripts from xfce startup, but i would like to avoid login if I can. 

I wonder how would they do it in other not so automated distros like Linux from scratch or Slackware. Would in such distros ulimit be setable from within rc.local and if so what is stopping it from being setable in Ubuntu studio as well? 

Please also note that I have another audio PC setup in much the same way already - only diff is that that PC is a jack audio master server - and it works with audio scripts starting with realtime priority from rc.local! 



On 10 Oct 2017 03:02, "Brent Busby" <[hidden email]> wrote:
Len Ovens <[hidden email]> writes:

[...]
> I do not know if these things will help, I have run a headless session
> complete with dbus, pulseaudio, jackdbus and various other audio
> applications... I really didn't need PA and therefore could have run
> without the dbus stuff. It was more of an experiment to see what I
> could do and the headless box had less than 1/4Gb of ram anyway, so it
> was not practical for real use. I should try setting up a headless
> jackd box on something newer though where I can make real use of it.

I didn't know that PulseAudio was the only thing that wanted Jack to be
controlled by DBus.  (Somehow, that's not surprising though.)  I'm not
using PulseAudio either, so would it be recommended to build jack2 (SMP
flavor) with no DBus support and just run it as a regular daemon in that
case?

--
- Brent Busby   + ===============================================
                +       With the rise of social networking
--  Studio   -- +       sites, computers are making people
--  Amadeus  -- +       easier to use every day.
----------------+ ===============================================
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user

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

Re: changing ulimit from rc.local in order to start audio scripts from there

Jeremy Jongepier
In reply to this post by Athanasios Silis
Hello Athanasios,

On 10/09/2017 08:15 PM, Athanasios Silis wrote:

> Hi there,
> I have setup an audio system around jackd based on ubuntu studio (14.04
> LTS). I have written various scripts to setup jackd and clients. It is
> tested and up running. Now I would like to add a cmd in rc.local in order
> for the whole system to be brought up at boot.
>
> I tried
>
> #set limits
> su - nass -c "ulimit -r 95 -l unlimited" 2>&1 | tee -a  /tmp/audio.log
>
> #verify limits
> su - nass -c "ulimit -r -l" 2>&1 | tee -a  /tmp/audio.log
>
> #boot audio stuff
> su - nass -c "cd /home/nass/audio_setup/scripts ; bash ./cmdaudio start"
> 2>&1 | tee -a  /tmp/audio.log
>
> However the ulimit "set" command fails with message
> ulimit: real-time priority: cannot modify limit: Operation not permitted
>
> I read that ulimits are not ready yet at this time. Is there a way to
> forcefully "bring them up" in order to have them set for the user "nass"
> before starting the audio scripts ??
>
Try uncommenting the following line in /etc/pam.d/su:
# session    required   pam_limits.so

Reboot and your script should work. I would advise you though to not set
limits this way but to add the nass user to the audio group and check if
/etc/security/limits.d/audio.conf exists. If it doesn't then run sudo
dpkg-reconfigure jackd2 and answer yes to the question if you want to
use JACK with realtime settings.

Best,

Jeremy


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

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: changing ulimit from rc.local in order to start audio scripts from there

Athanasios Silis
Hi Jeremy,
the file you refer to already exists and "nass" user is already part of the @audio group.
Are you implying that limits could be raised even without uncommenting the line in /etc/pam.d/su:
# session    required   pam_limits.so

??

BTW this is indeed what make it all work. Thank you :)

On Tue, Oct 10, 2017 at 10:16 AM, Jeremy Jongepier <[hidden email]> wrote:
Hello Athanasios,

On 10/09/2017 08:15 PM, Athanasios Silis wrote:
> Hi there,
> I have setup an audio system around jackd based on ubuntu studio (14.04
> LTS). I have written various scripts to setup jackd and clients. It is
> tested and up running. Now I would like to add a cmd in rc.local in order
> for the whole system to be brought up at boot.
>
> I tried
>
> #set limits
> su - nass -c "ulimit -r 95 -l unlimited" 2>&1 | tee -a  /tmp/audio.log
>
> #verify limits
> su - nass -c "ulimit -r -l" 2>&1 | tee -a  /tmp/audio.log
>
> #boot audio stuff
> su - nass -c "cd /home/nass/audio_setup/scripts ; bash ./cmdaudio start"
> 2>&1 | tee -a  /tmp/audio.log
>
> However the ulimit "set" command fails with message
> ulimit: real-time priority: cannot modify limit: Operation not permitted
>
> I read that ulimits are not ready yet at this time. Is there a way to
> forcefully "bring them up" in order to have them set for the user "nass"
> before starting the audio scripts ??
>

Try uncommenting the following line in /etc/pam.d/su:
# session    required   pam_limits.so

Reboot and your script should work. I would advise you though to not set
limits this way but to add the nass user to the audio group and check if
/etc/security/limits.d/audio.conf exists. If it doesn't then run sudo
dpkg-reconfigure jackd2 and answer yes to the question if you want to
use JACK with realtime settings.

Best,

Jeremy


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



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