After Buster April update Bash Sound scripts stops working Topic is solved

All kinds of 'OS' scripts

Moderator: leecollings

McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

After Buster April update Bash Sound scripts stops working

Post by McJohn »

An Action with a Bash script worked perfect with:
Raspbian Buster 10 Linux raspberrypi 4.19.97-v7+ #1294 (January version)
and
Domoticz 2020.2 (build 12067)

But then we did an upgrade to;
Raspbian Buster 10 Linux raspberrypi 4.19.118-v7+ #1311 (April version)

And every Action with a Bash script from of Domoticz won’t work anymore
No errors message:

Code: Select all

Status: Executing script: /home/pi/volumeup.sh
[/color]
But nothing happens.

So, we did an update to the latest beta version of Domoticz:
Domoticz 2020.2 (build 12154)

Same problem occurs; Bash script does nothing.

The strange thing is: All the Bash scripts are working perfect from the GUI and Terminal sessions of the Raspberry.

Does anyone have an idea how to solve this?
Last edited by McJohn on Friday 12 June 2020 14:40, edited 2 times in total.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by waaren »

McJohn wrote: Thursday 11 June 2020 8:48 Bash script does nothing.
To check if it is a generic issue on your system or specific to your script could you try to execute below test-script from domoticz ?

Code: Select all

#!/bin/bash

echo $(date) test > ~/canBeRemoved_$$
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by McJohn »

Thanks for your support.

The script you send gives this result in the Domoticz log:

Code: Select all

2020-06-11 13:40:30.595 Status: Executing script: /home/pi/domoticz/scripts/test.sh
[/color]

But that log result gave also my other scripts, but nothing happened, the only change is the April version of Buster.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by waaren »

McJohn wrote: Thursday 11 June 2020 13:44 The script you send gives this result in the Domoticz log:
code]2020-06-11 13:40:30.595 Status: Executing script: /home/pi/domoticz/scripts/test.sh[/code]
But that log result gave also my other scripts, but nothing happened, the only change is the April version of Buster.
So you don't see any new file in the home directory of the user that execute domoticz ?

Check which user is executing domoticz with the command

Code: Select all

ps -ef | grep domo
btw. I am on Debian 4.19.118-2
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by McJohn »

waaren wrote: Thursday 11 June 2020 13:58 So you don't see any new file in the home directory of the user that execute domoticz ?
Sorry to say; unfortunately no. (Only when I execute this test script with the Rpi GUI or command line.)
waaren wrote: Thursday 11 June 2020 13:58 Check which user is executing domoticz with the command

Code: Select all

ps -ef | grep domo

Code: Select all

ps -ef | grep domo
root       640     1  1 12:03 ?        00:01:33 /home/pi/domoticz/domoticz -daemon -www 8080 -sslwww 443
pi        9623  9609  0 14:32 pts/1    00:00:00 grep --color=auto domo
OK, the difference is you have Debian 4.19.118-2 and I 4.19.118-v7 ? This is maybe the problem?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by waaren »

McJohn wrote: Thursday 11 June 2020 14:39 OK, the difference is you have Debian 4.19.118-2 and I 4.19.118-v7 ? This is maybe the problem?
I don't expect that to be the root cause. But having said that, I don't understand why user root from domoticz cannot write a file in it's home directory (/root/ )
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by McJohn »

Maybe you could try also the update to 4.19.118-v7?

It could be a security issue in this version?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by waaren »

McJohn wrote: Thursday 11 June 2020 14:55 Maybe you could try also the update to 4.19.118-v7? It could be a security issue in this version?
That will not be possible as I am on different platforms.
I run domoticz production on intel NUC with latest Debian Buster and test / development also on a Synology NAS and 64-bit Raspberry.
The majority of the other forum members are on 32 bit raspbian so we will hear from them soon if /when they hit the same issue.
It could be a security issue in this version?
Never say never but such a problem would be reported very quickly after the release of this version to the dedicated Raspbian forums and I don't see it being reported yet.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by McJohn »

OK, I'll wait and see.
That is the result and fate of being a first time user...

Thanks for your patient and support.

Back to the SD card with the working January version :) .
User avatar
FireWizard
Posts: 1895
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash scripts stops working

Post by FireWizard »

Hi,
@McJohn
@waaren

I followed your post here and I was hoping that somebody would discover a magic solution.

In my opinion scripting in Domoticz is a pain in the A$$, to keep it polite.
See also my post at: https://www.domoticz.com/forum/viewtopi ... pt#p249275
I tried to avoid it. See also: https://www.domoticz.com/forum/viewtopi ... 07#p231907

1. I do not believe that the platform or the Linux (Debian or Raspbian) is the root cause.
Currently I run on
pi@RPi1:~ $ uname -a
Linux RPi1.jonasnet.nl 4.19.97+ #1294 Thu Jan 30 13:10:54 GMT 2020 armv6l GNU/Linux
I created a virtual switch, which triggers a script.

The script is in ~/domoticz/scripts directory.
pi@RPi1:~ $ ls -l domoticz/scripts/test.sh
-rwxr-xr-x 1 pi pi 161 Jun 11 14:42 domoticz/scripts/test.sh
The contents of the script is as follows:

Code: Select all

#!/bin/sh
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/test.$NOW.log
echo  $(date +"%Y-%m-%d %H:%M:%S") test | tee -a $LOGFILE
echo $(date) test > ~/canBeRemoved_$$
The last line is the code is what @waaren suggested.

If the script is activated a log file is created in the /home/pi directory and owned by root:root
The contents is as follows:
2020-06-11 15:18:29 test
You would expect that @waarens last line is executed and that you will find that file in the /root directory.
No it is not created, however if you run the same script from the command line, it is created in the /home/pi directory and owned by pi.
That makes sense.

I still try to find the root cause of this behavior,

Regards
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by McJohn »

Hi "FireWizard",

I really appreciate your contribution and support.
With the 4.xx version of Domoticz until Domoticz 2020.2 all the Bash scripts were working well.
But with the update to
Raspbian Buster 10 Linux raspberrypi 4.19.118-v7+ #1311 (April version)
all the problems occurs.
I really think this is a security issue and I hope someone could solve this.
I see you are also working with an Rpi.
Maybe you could do an update to 4.19.118-v7+ #1311 and see what happens?

Kind regards.
User avatar
FireWizard
Posts: 1895
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash scripts stops working

Post by FireWizard »

@ McJohn

I did some further testing and saw my test script, if activated by the Domoticz switch, caused an error 512.
This was caused by the last line (@waarens echo $(date) test > ~/canBeRemoved_$$)
This had to be solved first. It will not function with "relative paths". So you have to change that to an "absolute path".

So change the test script to:

Code: Select all

#!/bin/sh
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/test.$NOW.log
echo  $(date +"%Y-%m-%d %H:%M:%S") test | tee -a $LOGFILE
echo $(date) test > /root/canBeRemoved_$$
You will find that file in the /root directory.
You can change that, if you want.

Can you test again what @waaren suggested, but the with "absolute path"?

I see also in your first post, that you want to run a script called volumeup in /home/pi/
Do you use the full path in your script configuration?

I will try to do a kernel update.

Regards
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by waaren »

FireWizard wrote: Thursday 11 June 2020 16:48 I did some further testing and saw my test script, if activated by the Domoticz switch, caused an error 512.
This was caused by the last line (@waarens echo $(date) test > ~/canBeRemoved_$$)
Please see my original test script.

Code: Select all

#!/bin/bash

echo $(date) test > ~/canBeRemoved_$$
If you use that you will not get the 512 error and relative path is working.
You used the same echo command in a script executed in /bin/sh and that will not work.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by McJohn »

Thank for both answers but I'm a little confused what to do now.
What kind of test should I take?
FireWizard wrote: Thursday 11 June 2020 16:48 I see also in your first post, that you want to run a script called volumeup in /home/pi/
Do you use the full path in your script configuration?
Yep, and as said; it worked for almost 2 years flawless!

BTW: this is the script (to switch sound on and off of at the Rpi with a Domoticz Switch):
#!/bin/bash

amixer cset numid=1 -- 100
espeak -v nl+f4 -s 180 "Sound. On" --stdout | aplay
And this is the path from the Domoticz switch:
script:///home/pi/volumeup.sh

With a neat notification into the log of Domoticz:

Code: Select all

[color=#00BF00]2020-06-11 17:19:46.462 Status: Executing script: /home/pi/volumeup.sh[/color]
But nothing happens..
User avatar
FireWizard
Posts: 1895
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash scripts stops working

Post by FireWizard »

Hi,

@waaren
You used the same echo command in a script executed in /bin/sh and that will not work.
Agree, you are right.
I tested it first as a single command, it worked, and later on I inserted it in the script. And it did not work.
I have been thinking in "bash" and overlooked the shebang #!/bin/sh. Quite stupid. Sorry for the confusion.

@McJohn

Forget what I wrote for that test. Both should work

But having said this. We didn't make any progress.

First looking for an kernel upgrade.

Regards
User avatar
FireWizard
Posts: 1895
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash scripts stops working

Post by FireWizard »

HI,
Linux RPi1.jonasnet.nl 4.19.118+ #1311 Mon Apr 27 14:16:15 BST 2020 armv6l GNU/Linux
I have the kernels on 3 RPi's updated to the April version.
All three Pi's are running without issues.

I tested the test script and they do, what they did with the previous version, and what they supposed to do.
So, I would not recommend to downgrade to the January kernel.

Is there anything else that could be corrupted. Remember the problem with the custom icons.

Regards
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by McJohn »

Thank you so much for your effort.
(your advantage is that you are completely up to date now) :)

Did again the kernel update (from the January version).

Beside this it’s also strange that after this update my default analog output jumps to HDMI.

Tested another bash script from Domoticz and that was working well!

I think it has something todo with my “sound” script. That won't work from Domoticz with the April Buster version.
Could you please test that script at your Rpi?
See above code.



Further on I did again the update of Domoticz to the latest beta version.
(First took a look into the switch_icons.txt file and saw the name of my beacons logo).
And after the update, I saw immediately the beacon icons at the Domoticz switches changing to lamps.. and the name of the beacon logo was removed from the switch_icons.txt file….

Luckily it's a hobby..

Kind regards.
User avatar
FireWizard
Posts: 1895
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash scripts stops working

Post by FireWizard »

Hello,

@McJohn
(your advantage is that you are completely up to date now) :)
Indeed, I'm up to date now, with all my Pi's. Thank you for posting your problem. :D
I think it has something to do with my “sound” script. That won't work from Domoticz with the April Buster version.
Could you please test that script at your Rpi?
See above code.
I had not installed espeak on my Raspberry, but after installation I tested your script as follows:

Code: Select all

#!/bin/bash
amixer cset numid=1 -- 100
espeak -v nl+f4 -s 180 "Sound. On" --stdout | aplay
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/test.$NOW.log
echo  $(date +"%Y-%m-%d %H:%M:%S") test | tee -a $LOGFILE
And I can confirm that it works. With my headphone, I hear the sound output (not tested HDMI).
I changed the name to volumeup.sh, moved the script to /home/pi and modified the script_on of the switch.

It still works.

Did you check, that the script file is executable? Stupid question, but simple to overlook

So it works for me and that means that your sound script is Okay.

Regards
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by McJohn »

Thanks again for all your effort, I really appreciate your feedback.
Now you have also a talking Rpi :)

Did again (for the 5th time) a kernel update of the January version of Buster.
Now I used the command:

Code: Select all

sudo apt upgrade

instead of

Code: Select all

sudo apt full-upgrade
And, yes! the VolumeUp Bash script is working now from Domoticz! :D
(I changed nothing at the script)

The question is, what command did you use for the upgrade and I'm for sure that the full-upgrade broke something between Domoticz and this Bash script.

Kind regards.
User avatar
FireWizard
Posts: 1895
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash scripts stops working

Post by FireWizard »

Hi,

@McJohn,
Now you have also a talking Rpi :)
Thats right, but I don't listen to it :D

Before I upgraded the kernel, I had upgraded the Pi with

sudo apt-get update and sudo apt-get upgrade.
Yes, I know, an old habbit.

The kernel was upgraded with sudo apt full-upgrade.

So, I m still not sure what the cause of the problem was, but it is nice, that everything is working.
But I understand, that it doesn't give a good feeling.

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest