worik
December 2, 2021, 9:46pm
1
Friends
In my efforts to write a button initiated script that runs mod-host
I am having errors connecting to jack
The button initiated scripts run as root so I am using runuser
to run mod-host
as patch
user.
My script is:
#!/bin/bash
runuser -l patch -c "export LV2_PATH=/usr/modep/lv2 && /home/patch/mod-host/mod-host"
But
$ sudo ./runMod.sh
Forking... child PID: 14465
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Running from the command line as patch
is OK
patch@patchbox:~/ModHostPedal $ export LV2_PATH=/usr/modep/lv2 && /home/patch/mod-host/mod-host
Forking... child PID: 14481
patch@patchbox:~/ModHostPedal $ mod-host ready!
Hi, it’s possibly missing the environment variable from /etc/environment
. Try using this command to preserve the environment:
sudo -E ./runMod.sh
worik
December 3, 2021, 8:20am
3
Sadly that makes no difference.
Then add export JACK_PROMISCUOUS_SERVER=jack
worik
December 3, 2021, 8:24am
5
That is in my environment.
The -E
preserves it
I have changed the script runMod.sh
to use the Modep mod-host
, incase I have corrupted my local copy
No change. When I run mod-host
from a terminal it works as it should.
#!/bin/bash
echo DBUS_SESSION_BUS_ADDRESS $DBUS_SESSION_BUS_ADDRESS
echo JACK_PROMISCUOUS_SERVER: $JACK_PROMISCUOUS_SERVER
runuser -l patch -c "export LV2_PATH=/usr/modep/lv2 && /usr/bin/mod-host -v"
Then runuser
must be resetting the environment. Try adding --preserve-environment
to it.
1 Like
worik
December 3, 2021, 8:52am
7
Almost perfect
--preserve-environment
cashes with -l
and -c
clashes with -u
but the command can be simplified since we are preserving the environment.
Made a change in the script using all the above and the problem is solved
export LV2_PATH=/usr/modep/lv2
runuser --preserve-environment -u patch /usr/bin/mod-host
Complete script (for this example)
#!/bin/bash
echo DBUS_SESSION_BUS_ADDRESS $DBUS_SESSION_BUS_ADDRESS
echo JACK_PROMISCUOUS_SERVER: $JACK_PROMISCUOUS_SERVER
export LV2_PATH=/usr/modep/lv2
runuser --preserve-environment -u patch /usr/bin/mod-host
1 Like
worik
December 3, 2021, 8:58am
8
It is the environment variable JACK_PROMISCUOUS_SERVER
that is important’
The following does not need the -E
for sudo
#!/bin/bash
export JACK_PROMISCUOUS_SERVER=jack
export LV2_PATH=/usr/modep/lv2
runuser --preserve-environment -u patch /usr/bin/mod-host
2 Likes