Bad gateway and no browser stream incoming after upgrading
Bad gateway and no browser stream incoming after upgrading
Dear all
I upgraded via sudo apt-get update && sudo apt-get upgrade the stereopi (v0.23) img but I have some issues. Probably I shouldn't have done this...
After the upgrading process I had some issues with the package php7.0-fpm: via browser stereopi.local aswered Bad gateway. So I solved with sudo apt-get purge php7.0-fpm && sudo apt-get install php7.0-fpm.
Now stereopi.local page work fine again: I can see the StereoPi logo and click the different bottons but no stream video incoming as if browser stream option had disabled (instead it is enable); connectng the StereoPi via HDMI both camera images are freezed to the first image arrived to the system.
I post below some Debug test made I don't know if there are correlation between the php7.0-fpm issue and this:
via browse (web developer console F12)
WebSocket connection to 'ws://stereopi.local:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
via console
/usr/bin/nodejs ./wsstream/index.js 1280 720 30
module.js:549
throw err;
^
Error: Cannot find module '/wsstream/index.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
So does anyone have any idea or suggestions about it?
Thanks in advance
I upgraded via sudo apt-get update && sudo apt-get upgrade the stereopi (v0.23) img but I have some issues. Probably I shouldn't have done this...
After the upgrading process I had some issues with the package php7.0-fpm: via browser stereopi.local aswered Bad gateway. So I solved with sudo apt-get purge php7.0-fpm && sudo apt-get install php7.0-fpm.
Now stereopi.local page work fine again: I can see the StereoPi logo and click the different bottons but no stream video incoming as if browser stream option had disabled (instead it is enable); connectng the StereoPi via HDMI both camera images are freezed to the first image arrived to the system.
I post below some Debug test made I don't know if there are correlation between the php7.0-fpm issue and this:
via browse (web developer console F12)
WebSocket connection to 'ws://stereopi.local:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
via console
/usr/bin/nodejs ./wsstream/index.js 1280 720 30
module.js:549
throw err;
^
Error: Cannot find module '/wsstream/index.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
So does anyone have any idea or suggestions about it?
Thanks in advance
Re: Bad gateway and no browser stream incoming after upgrading
hi!
i`d the same problem after update to php 7.3.
I coudn`t start up cameras, but i started up the server. I work on Raspbian Stretch.
Here are my steps:
1.
2.Then i followed the tutorial- https://onedev.net/post/942
3.Then we need to set up server configs. I followed this way with some changes - https://sprut.ai/client/article/1064
Dont change
Save changes.
4.Restart ngnix:
and check it working:
5.Give rights to www-data:
After steps completed error "Bad gateway" will pass, but still no video from cameras and hold on with photo making.
Perhaps, .php scripts should be corrected or something else should be done cause of
doesnt work either.
i`d the same problem after update to php 7.3.
I coudn`t start up cameras, but i started up the server. I work on Raspbian Stretch.
Here are my steps:
1.
Code: Select all
sudo mount -o remount,rw /
Code: Select all
sudo nano /etc/apt/sources.list.d/10-buster.list
deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi
sudo apt update
sudo apt install -y -t buster php7.3 php-apcu php7.3-curl php7.3-gd php7.3-fpm php7.3-cli php7.3-opcache php7.3-mbstring php7.3-xml php7.3-zip php7.3-intl php7.3-mysql php7.3-sqlite3 php7.3-xmlrpc
sudo systemctl stop apache2
sudo apt-get remove -y apache2
sudo apt install -t buster nginx-full
sudo systemctl start nginx.service
Code: Select all
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 777 /var/www/html
Code: Select all
sudo nano /etc/nginx/sites-available/default
Only need to change to:root /var/www/html;
Code: Select all
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}
4.Restart ngnix:
Code: Select all
sudo systemctl reload nginx
Code: Select all
sudo systemctl check nginx
Code: Select all
sudo chown -R www-data:www-data /var/www/html
sudo chown -R www-data:www-data /media/DCIM
sudo chown -R www-data:www-data /opt/StereoPi
sudo chmod 777 /dev/vchiq
sudo chmod 777 /media/DCIM
usermod -a -G video www-data
Perhaps, .php scripts should be corrected or something else should be done cause of
Code: Select all
raspistill -v -o test.jpg
- Realizator
- Site Admin
- Posts: 900
- Joined: Tue Apr 16, 2019 9:23 am
- Contact:
Re: Bad gateway and no browser stream incoming after upgrading
Hi guys,
As I mentioned a few times, SLP update is not a good idea. We are having a lot of stuff onboard, and did a lot of configuration to fit each part with the other. The update usually breaks all dependencies (and overwrite settings).
But I see you are well ahead, so let me try to help you with other setting.
Zoldaten, could you please test, if your system sees any cameras?
1. What is the output of this command:
2. I see you're not set the camera to use in your raspistill command. Please add -cs 0 or cs-1, like this:
raspistill -cs 0 -o test.jpg
3. Are you sure your fs is not read-only? The mentioned command try to record a file 'test.jpg'. to the Linux partition
Let's figure out this part first, and then go to PHP and the admin panel.
As I mentioned a few times, SLP update is not a good idea. We are having a lot of stuff onboard, and did a lot of configuration to fit each part with the other. The update usually breaks all dependencies (and overwrite settings).
But I see you are well ahead, so let me try to help you with other setting.
Zoldaten, could you please test, if your system sees any cameras?
1. What is the output of this command:
Code: Select all
vcgencmd get_camera
raspistill -cs 0 -o test.jpg
3. Are you sure your fs is not read-only? The mentioned command try to record a file 'test.jpg'. to the Linux partition
Let's figure out this part first, and then go to PHP and the admin panel.
Eugene a.k.a. Realizator
Re: Bad gateway and no browser stream incoming after upgrading
1.
gives nothing with two cameras connected:
And freezes SSH-session.
2. gives the same result.
*Ofcause, i remember of rw protection on partition.
But!
If i disconnect one of cameras and reboot. Everything works - i mean commands above gives something like supported=2 detected=1 and raspistill
makes photo when call it.
So. I suppose the problem is in the scripts started on boot that linked somehow with cameras.
I tried also with no result:
1.
- put more GPU memory on boot - sudo nano boot/config.txt:
GPU_MEM_512=448
- put less GPU memory on boot - sudo nano boot/config.txt:
GPU_MEM=128
2.
manually stop scripts in /opt/Stereopi:
./stop.sh
But camera led was still light.
3.
change camera(cameras) and cable(cables).
Code: Select all
vcgencmd get_camera
2.
Code: Select all
raspistill -cs 0 -o test.jpg
*Ofcause, i remember of rw protection on partition.
But!
If i disconnect one of cameras and reboot. Everything works - i mean commands above gives something like supported=2 detected=1 and raspistill
makes photo when call it.
So. I suppose the problem is in the scripts started on boot that linked somehow with cameras.
I tried also with no result:
1.
- put more GPU memory on boot - sudo nano boot/config.txt:
GPU_MEM_512=448
- put less GPU memory on boot - sudo nano boot/config.txt:
GPU_MEM=128
2.
manually stop scripts in /opt/Stereopi:
./stop.sh
But camera led was still light.
3.
change camera(cameras) and cable(cables).
- Realizator
- Site Admin
- Posts: 900
- Joined: Tue Apr 16, 2019 9:23 am
- Contact:
Re: Bad gateway and no browser stream incoming after upgrading
Wow. I never faced the stuck of 'vcgencmd get_camera'.
More than a year ago, there was a bug in Raspbian. They updated AWB algo, and this broken stereoscopic support (our post about this, and the GitHub discussion with the Raspberry engineer). Right now, this bug is fixed in the latest kernels, but on your screenshot, I see 4.19.66 - it is the affected version.
Please try to run "sudo vcdbg set awb_mode 0" BEFORE accessing the camera. For SLP, it is better to add this row to autostart (or to our run.sh).
More than a year ago, there was a bug in Raspbian. They updated AWB algo, and this broken stereoscopic support (our post about this, and the GitHub discussion with the Raspberry engineer). Right now, this bug is fixed in the latest kernels, but on your screenshot, I see 4.19.66 - it is the affected version.
Please try to run "sudo vcdbg set awb_mode 0" BEFORE accessing the camera. For SLP, it is better to add this row to autostart (or to our run.sh).
Eugene a.k.a. Realizator
Re: Bad gateway and no browser stream incoming after upgrading
Ok. Got it worked! (but web-interface buttons still dont(( )
Firstly, i think just to, but remembered my wi-fi dongle was build in current configuration.
So. I put to /opt/Stereopi/run.sh as 2d string.
After that become possible.
But still werent no video streams.
So i found out if use /opt/Stereopi/stop.sh - makung photo on browser is possible also u can move on directory to see them. But it comes
imposible again if manually start again run.sh.
Secondly, searching around i learned that if just correct manually /boot/sterepi.conf (not /opt/Stereopi/config.conf) everything works like
a charm! (exept making photo on page).
At last i just correct /boot/sterepi.conf (previosly remounted boot -):
So. The last steps are - find out how to start working buttons of photo and change options as that still not working. I think the reason of rights.
Could you share what rights dirs have, mine:
Firstly, i think just to
Code: Select all
rpi-update
So. I put
Code: Select all
sudo vcdbg set awb_mode 0
After that
Code: Select all
raspistill -3d sbs -o 1.jpg
But still werent no video streams.
So i found out if use /opt/Stereopi/stop.sh - makung photo on browser is possible also u can move on directory to see them. But it comes
imposible again if manually start again run.sh.
Secondly, searching around i learned that if just correct manually /boot/sterepi.conf (not /opt/Stereopi/config.conf) everything works like
a charm! (exept making photo on page).
At last i just correct /boot/sterepi.conf (previosly remounted boot -
Code: Select all
sudo mount -o remount,rw /boot
Code: Select all
udp_clients=192.168.1.108:3000 #my pc address i stream udp to
udp_enabled=1
ws_enabled=1 #to start up browser video
Could you share what rights dirs have, mine:
- Realizator
- Site Admin
- Posts: 900
- Joined: Tue Apr 16, 2019 9:23 am
- Contact:
Re: Bad gateway and no browser stream incoming after upgrading
Hey Zoldaten,
A few comments on your investigations:
1. When our scripts are running (run.sh), they are using raspivid. So when you try to run "raspistill", it shows you an error. For the manual console run of "raspistill" or "raspivid" please stop our scripts first by stop.sh. Note: if you try to kill the raspivid process, but not run "stop.sh", our scripts will run it again. We have a self-check logic to run this again if something goes wrong.
2. /opt/Stereopi/config.conf is a local, system-used configuration. While booting, our system copies /boot/sterepi.conf to /opt/Stereopi/config.conf and work with it. So if you change anything in /opt/Stereopi/config.conf, your changes will be overwritten by the next boot. So please use /boot/sterepi.conf to change settings
3. As for the shot and record buttons in the admin panel after the update - could you please try to catch JS errors in your browser console after clicking those buttons? This will help a lot.
A few comments on your investigations:
1. When our scripts are running (run.sh), they are using raspivid. So when you try to run "raspistill", it shows you an error. For the manual console run of "raspistill" or "raspivid" please stop our scripts first by stop.sh. Note: if you try to kill the raspivid process, but not run "stop.sh", our scripts will run it again. We have a self-check logic to run this again if something goes wrong.
2. /opt/Stereopi/config.conf is a local, system-used configuration. While booting, our system copies /boot/sterepi.conf to /opt/Stereopi/config.conf and work with it. So if you change anything in /opt/Stereopi/config.conf, your changes will be overwritten by the next boot. So please use /boot/sterepi.conf to change settings
3. As for the shot and record buttons in the admin panel after the update - could you please try to catch JS errors in your browser console after clicking those buttons? This will help a lot.
Eugene a.k.a. Realizator
Re: Bad gateway and no browser stream incoming after upgrading
So, as i understand, it`s impossible to make a photo (from the web page) while scripts are running? So each time to make a photo i should go SSH to stop them.Realizator wrote: ↑Mon Mar 15, 2021 9:40 amHey Zoldaten,
A few comments on your investigations:
1. When our scripts are running (run.sh), they are using raspivid. So when you try to run "raspistill", it shows you an error. For the manual console run of "raspistill" or "raspivid" please stop our scripts first by stop.sh. Note: if you try to kill the raspivid process, but not run "stop.sh", our scripts will run it again. We have a self-check logic to run this again if something goes wrong.
Nothing special there.Realizator wrote: ↑Mon Mar 15, 2021 9:40 am3. As for the shot and record buttons in the admin panel after the update - could you please try to catch JS errors in your browser console after clicking those buttons? This will help a lot.
Admin panel looks well, i see cameras restart after push button "save", but it doesnt change options: Cant catch why client try to get 8080 port after saveconfig.php...
Re: Bad gateway and no browser stream incoming after upgrading
EUREKA!!!
Now all things seem to work fine again... I try to summarize a solution (it's work for me and it's my best work but surely I accept other tips to improve it!)
The last issue is that the initial start logo didn't start... I donn't know why...
This is my rc.local file: I added four rows to restart the php7.0-fpm service to prevent Bad Gateway issue. Maybe could I add them otherwhere to make this solution a bit more elegant?
----- rc.local -----
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
##### FM ADDED #####
sudo mount -o rw,remount /
sudo mount -o rw,remount /boot
#Bad Gateway PREVENTING
systemctl daemon-reload
systemctl restart php7.0-fpm
##### ######## ######
# clear HDMI console
setterm -clear all -foreground black -background black > /dev/tty0
setterm -clear all -foreground black -background black > /dev/tty3
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
echo "\n\n"
printf "\033[1;34mRaspberry Pi serial number\n"
printf "\033[1;37m"
cat /proc/cpuinfo | tail -n 1
printf "\033[0m\n"
echo "\n\n"
cd /opt/StereoPi
./run.sh > /dev/null 2>&1 &
exit 0
---------------
I added in run.sh the row below at the top of the script (as it suggested by you)
----- run.sh -----
sudo vcdbg set awb_mode 0 # added by FM
My2Cents
Francesco
Now all things seem to work fine again... I try to summarize a solution (it's work for me and it's my best work but surely I accept other tips to improve it!)
The last issue is that the initial start logo didn't start... I donn't know why...
This is my rc.local file: I added four rows to restart the php7.0-fpm service to prevent Bad Gateway issue. Maybe could I add them otherwhere to make this solution a bit more elegant?
----- rc.local -----
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
##### FM ADDED #####
sudo mount -o rw,remount /
sudo mount -o rw,remount /boot
#Bad Gateway PREVENTING
systemctl daemon-reload
systemctl restart php7.0-fpm
##### ######## ######
# clear HDMI console
setterm -clear all -foreground black -background black > /dev/tty0
setterm -clear all -foreground black -background black > /dev/tty3
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
echo "\n\n"
printf "\033[1;34mRaspberry Pi serial number\n"
printf "\033[1;37m"
cat /proc/cpuinfo | tail -n 1
printf "\033[0m\n"
echo "\n\n"
cd /opt/StereoPi
./run.sh > /dev/null 2>&1 &
exit 0
---------------
I added in run.sh the row below at the top of the script (as it suggested by you)
----- run.sh -----
sudo vcdbg set awb_mode 0 # added by FM
My2Cents
Francesco
- Realizator
- Site Admin
- Posts: 900
- Joined: Tue Apr 16, 2019 9:23 am
- Contact:
Re: Bad gateway and no browser stream incoming after upgrading
Francesco, thank you for sharing your solution!
Zoldaten, our "shot" button has a special logic controlled by our scripts. No need to manually stop/start them. When you take a photo, scripts automatically stops raspivid, takes a photo, and run all live streams again.
Here is the way we are taking the photo:
/var/www/html/make_photo.php
Zoldaten, our "shot" button has a special logic controlled by our scripts. No need to manually stop/start them. When you take a photo, scripts automatically stops raspivid, takes a photo, and run all live streams again.
Here is the way we are taking the photo:
/var/www/html/make_photo.php
Eugene a.k.a. Realizator
Re: Bad gateway and no browser stream incoming after upgrading
do not know how those could fix everything as it just restart php7.0-fpm...nevermind.##### FM ADDED #####
sudo mount -o rw,remount /
sudo mount -o rw,remount /boot
#Bad Gateway PREVENTING
systemctl daemon-reload
systemctl restart php7.0-fpm
Not for me as i updated to php7.3-fm and adding that do not help me.
Ok. After all i found the last solution which doesnt let to take photo and change settings in web-admin panel.
1. For making photo as was mentioned above responsible make_photo.php. So to start it working again i`ve change 1 string in it adding sudo:
Code: Select all
sudo killall -q raspivid
2.The second thing that didnt work - i cannot make changes from web-page as all settings keep the same.
A start, i thought js is responsible for crash but later land to php.
To sum up 2 scripts should be changed:
in getconfig.php:
from
Code: Select all
$content = file('/boot/stereopi.conf');
Code: Select all
$content = file('/opt/StereoPi/config.conf');
from
Code: Select all
$CONFIG_FILE = '/boot/stereopi.conf';
Code: Select all
$CONFIG_FILE = '/opt/StereoPi/config.conf';
Code: Select all
system("sudo mount -o rw,remount /boot");
Code: Select all
system("sudo mount -o rw,remount /");
Code: Select all
sudo chmod 777 config.conf
That`s it.
Re: Bad gateway and no browser stream incoming after upgrading
But after reboot /opt/Stereopi/config.conf again with 644 rights (
How to fix that to 777 to make it automatic ?
How to fix that to 777 to make it automatic ?
-
- Posts: 215
- Joined: Tue May 21, 2019 12:33 pm
- Location: France
Re: Bad gateway and no browser stream incoming after upgrading
You are working against the way SLP works (which is not a reproach, you do what you want with your board) so you have to find which mechanism you did not brake that is doing that. The mode is classically changed by a chmod or a copy, or sometimes if a file is removed and rewritten. I let you investigate.
By the way, using 777 mode is usually a good alert signal that something is done wrong.
For example here, one could wonder why you need execution rights on a configuration file.
By the way, using 777 mode is usually a good alert signal that something is done wrong.
For example here, one could wonder why you need execution rights on a configuration file.
Stereophotographer and hacker
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi (v1) Standard Edition + CM3Lite module + a few cameras
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi (v1) Standard Edition + CM3Lite module + a few cameras
Re: Bad gateway and no browser stream incoming after upgrading
My SLP updated image works well exept config.conf which needs 755 or 777 rights.
I`m trying to find how to change rights on boot or what change it back to 644. All other files in the same dir have 755.
I`m trying to find how to change rights on boot or what change it back to 644. All other files in the same dir have 755.
-
- Posts: 215
- Joined: Tue May 21, 2019 12:33 pm
- Location: France
Re: Bad gateway and no browser stream incoming after upgrading
You can probably use the command chmod to override the rights, but it is probably better to understand how the rights are set in the first place.
But again, the difference between 755 and 644 are execution rights, and then it is strange that you need them on a configuration (thus not executable) file.
But again, the difference between 755 and 644 are execution rights, and then it is strange that you need them on a configuration (thus not executable) file.
Stereophotographer and hacker
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi (v1) Standard Edition + CM3Lite module + a few cameras
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi (v1) Standard Edition + CM3Lite module + a few cameras