Hi,
I am trying to launch a custom script with “the button” feature, but I am having some problems. I think that there are related to the user or the shell options…
This is the situation:
I have a custom script, like this:
#!/bin/sh
su patch
whoami > /tmp/log
sooperlooper >> /tmp/log 2>&1
I have configure /etc/pisound.conf in order to launch my script when I CLICK_1
Then, I launch tail -f /tmp/log and read the logs. This is the log:
–
root
SooperLooper 1.7.3
exec of JACK server (command = “#!/bin/sh”) failed: no such file or directory
cannot connect to jack
cannot initialize sooperlooper.
I am not sure what is the problem, but su patch && whoami == root it is strange for me.
I supose that root is not be able to launch sooperlooper or root has not launched a shell and then can exec /bin/sh…
Any idea about how to launch a custom button script as a normal user?
(When I launch my custom script from my patch user shell it works correctly).
Best regards.
Hey, could you paste the contents of these files:
/usr/lib/systemd/system/pisound-btn.service
/etc/environment
/etc/jackdrc
It looks like it’s an environment variable issue - the jack service should already be running, so executing another jack client should not attempt to start a new server, and jack clients know not to do that by seeing the JACK_PROMISCUOUS_SERVER=jack
environment variable.
Thanks Gredius.
Yes, the Jack server is running.
If I launch the script from shell, sooperlooper works.
if then, I launch it from button sooperlooper does not work.
If i launch it from console again, sooperlooper works.
cat /usr/lib/systemd/system/pisound-btn.service
[Unit]
Description=Pisound button daemon autostart
After=sound.target
[Service]
ExecStart=/usr/bin/pisound-btn
[Install]
WantedBy=multi-user.target
cat /etc/environment
JACK_PROMISCUOUS_SERVER=jack
cat /etc/jackdrc
#!/bin/sh
exec is used to ‘morph’ the shell interpreter process into jackd process, saving some system resources.
exec /usr/bin/jackd -t 2000 -R -P 75 -d alsa -d hw:pisound -r 48000 -p 128 -n 2 -X seq -s -S
I think that, probably, you are in right. There are some problems with my env vars. So, in order to test it I have add this code line to the BUTTON_1 custom script:
printenv >> /tmp/log
When I press the pisound button I see this information in my /tmp/log file:
JOURNAL_STREAM=8:9147
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
INVOCATION_ID=0ff12103ffea4a2eb96a2834e8a58668
LANG=es_ES.UTF-8
PWD=/
the JACK_PROMISCUOUS_SERVER var is not present.
What is the output of:
apt show pisound-btn
pisound-btn --version
Try editing the pisound-btn.service to match the contents here: https://github.com/BlokasLabs/pisound/blob/master/pisound-btn/debian/usr/lib/systemd/system/pisound-btn.service and run:
sudo systemctl daemon-reload
sudo systemctl restart pisound-btn
apt show pisound-btn
Package: pisound-btn
Version: 1.09-2
Priority: optional
Section: sound
Maintainer: Blokas Labs hello@blokas.io
Installed-Size: desconocido
Pre-Depends: hostapd (>= 1:2.3), dnsmasq (>= 2.72)
Depends: libc6 (>= 2.19), libgcc1 (>= 1:4.9.2-10), python (>= 2.7), python-urwid (>= 1.1), git (>= 1:2.1.4), libglib2.0-bin (>= 2.33.12)
Download-Size: 17,0 kB
APT-Sources: http://blokas.io/apt rpi/main armhf Packages
Description: Pisound Button daemon.
See Pisound – Raspberry Pi Sound Card & MIDI Interface for more information.
patch@patchbox:~ $ pisound-btn --version
Version 1.07, Blokas Labs Pisound – Raspberry Pi Sound Card & MIDI Interface
Changing the pisound-btn.service file has works!
Thanks!!!
1 Like