I am trying to write a button script that kicks off some software I wrote as a wrapper for mod-host to set up my LV2 simulators the way I want them.
I can run the script (as root) from the command line, but when I use the button they do not work
My script sets up a set of LV2 simulators by sending messages to mod-host on its control port.
When the script is started from the command line all the simulators are set up perfectly. When run from the button when teh add command executed by mod-host I get an error on stderr:
Cannot lock down 82287136 byte memory area (Cannot allocate memory) when my script runs jack_lsp
I do not see that error at all when running from the command line.
I get over 20,000 error reports like (when using the button):
jackdrc[4328]: JackAudioDriver::ProcessGraphAsyncMaster: Process error
in daemon.log.
There are a lot of other jack errors.
I am stumped. I developed this script running it from the command line. I did not expect any difference running it from the button.
It may be an environment issue, please verify that you have EnvironmentFile=/etc/environment in /usr/lib/systemd/system/pisound-btn.service and that /etc/environment/ contains a line like:
JACK_PROMISCUOUS_SERVER=jack
All the processes involved with Jack backend should have this environment variable set, so they all work with the shared server instance.
Being vague, but my first attempt at doing this was using systemd to boot my softare before any user logs in (with no user logged in). But jack, as installed, will not run like that. Something todo with dbus. I do not understand.
Ok, so you’re starting Jack server yourself. Please reference our jack.service - JACK_NO_AUDIO_RESERVATION=1 disables the dbus thing. And make sure the same JACK_PROMISCUOUS_SERVER=jack is set for Jack server itself.
I just tried running jack_lsp from a script triggered by the button, it went fine.
I still suspect it might have something to do with incorrect environment variables somewhere. This is the usual culprit when transferring from running scripts / programs as regular user via terminal to running them from systemd context.
I expect you are correct. I suspect Jack is the culprit. I am a bit frustrated with it, to tell the truth.
But I have solved the problem, in another way:
I made a little perl programme that checks a file once a second. If it finds the contents of the file are: “MODEP” it ensures modep-mod-ui is running. If it is “120Proof” it shuts modep-mod-ui and runs my software.
The button scripts now just write to that file.
I start my little daemon wit a “@reboot” cron job