502 Bad Gateway

General support for the Pi-Star System
W3AAD
Posts: 6
Joined: Thu Jun 03, 2021 10:45 pm

502 Bad Gateway

Post by W3AAD »

My system has been working fine for years but yesterday trying to "login" I get 502 Bad Gateway with nguni in small print below that. The hotspot is still working and I can ssh in as well. I was running Pi-Star V4.1.1 and upgraded to 4.1.2 but that did not seem to help.

I normally login with pi-star.local but also tried the ip address but still NG. I can ping it and see that Port 80 is open.

Any help appreciated.

Steve
User avatar
G8SEZ
Posts: 553
Joined: Fri Apr 13, 2018 8:26 pm

Re: 502 Bad Gateway

Post by G8SEZ »

Latest is Pi-Star 4.1.4 so probably another cycle or two of sudo pistar-upgrade should get you to the latest versions and see if the same error occurs then.

Suggest you go to Configuration and then Apply Changes before rebooting.
--

Brian G8SEZ
User avatar
MW0MWZ
Site Admin
Posts: 1505
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: 502 Bad Gateway

Post by MW0MWZ »

G8SEZ wrote: Fri Jun 04, 2021 6:45 pm Suggest you go to Configuration and then Apply Changes before rebooting.
Seeing "502 Bad Gateway" would suggest he cant use any of the dashboard.
Nginx is working (the webserver) or you would never see the 502 message, so its most likely the PHP engine that is broken - the most usual way for that to happen, is that the version changed.

Check what version of PHP you have installed:

Code: Select all

apt list --installed | grep -i php
You should have 7.0 installed:

Code: Select all

pi-star@pi-star(ro):~$ sudo apt list --installed | grep -i php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

php-common/stable,now 2:69 all [installed,automatic]
php7.0-cli/now 7.0.33-0+deb9u3 armhf [installed,local]
php7.0-common/now 7.0.33-0+deb9u3 armhf [installed,local]
php7.0-fpm/now 7.0.33-0+deb9u3 armhf [installed,local]
php7.0-json/now 7.0.33-0+deb9u3 armhf [installed,local]
php7.0-mbstring/now 7.0.33-0+deb9u3 armhf [installed,local]
php7.0-opcache/now 7.0.33-0+deb9u3 armhf [installed,local]
php7.0-readline/now 7.0.33-0+deb9u3 armhf [installed,local]
php7.0-zip/now 7.0.33-0+deb9u3 armhf [installed,local]
Assuming you do indeed have 7.0 installed, check the service is running:

Code: Select all

pi-star@pi-star(rw):~$ sudo systemctl status php7.0-fpm
● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-06-04 19:35:47 BST; 16min ago
     Docs: man:php-fpm7.0(8)
 Main PID: 807 (php-fpm7.0)
   Status: "Processes active: 0, idle: 2, Requests: 134, slow: 0, Traffic: 0req/sec"
    Tasks: 3 (limit: 2181)
   CGroup: /system.slice/php7.0-fpm.service
           ├─ 807 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
           ├─1145 php-fpm: pool www
           └─1146 php-fpm: pool www

Jun 04 19:35:45 pi-star systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
Jun 04 19:35:47 pi-star systemd[1]: Started The PHP 7.0 FastCGI Process Manager.
let us know what you find...
Andy

73 de MW0MWZ
http://pistar.uk
W3AAD
Posts: 6
Joined: Thu Jun 03, 2021 10:45 pm

Re: 502 Bad Gateway

Post by W3AAD »

This is what I get running the apt list:



pi-star@pi-star(ro):~$ apt list --installed | grep -i php
mount: only root can use "--options" option
mount: only root can use "--options" option

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

E: Problem parsing dependency 52
E: Error occurred while processing jhbuild (NewVersion2)
E: Problem with MergeList /var/lib/apt/lists/raspbian.raspberrypi.org_raspbian_dists_buster_main_binary-armhf_Packages
E: The package lists or status file could not be parsed or opened.
pi-star@pi-star(ro):~$
User avatar
MW0MWZ
Site Admin
Posts: 1505
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: 502 Bad Gateway

Post by MW0MWZ »

What that is... is broken...

Now you could attempt to fix it, and you might, but re-imaging the card is probably quicker....
Andy

73 de MW0MWZ
http://pistar.uk
W3AAD
Posts: 6
Joined: Thu Jun 03, 2021 10:45 pm

Re: 502 Bad Gateway

Post by W3AAD »

Reimaging is no problem but setting the config again is a pain !
User avatar
MW0MWZ
Site Admin
Posts: 1505
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: 502 Bad Gateway

Post by MW0MWZ »

you can try things like:

Code: Select all

sudo rm -rf /var/lib/apt/lists/*
and then

Code: Select all

sudo apt update
sudo apt upgrade --fix-missing --fix-broken
See if that sorts it out..
Andy

73 de MW0MWZ
http://pistar.uk
W3AAD
Posts: 6
Joined: Thu Jun 03, 2021 10:45 pm

Re: 502 Bad Gateway

Post by W3AAD »

Unfortunately that must have trashed the OS as it no longer boots. Guess I'm making a new SD card !

Thanks for trying

Steve
User avatar
MW0MWZ
Site Admin
Posts: 1505
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: 502 Bad Gateway

Post by MW0MWZ »

W3AAD wrote: Fri Jun 04, 2021 8:50 pm Unfortunately that must have trashed the OS as it no longer boots. Guess I'm making a new SD card !

Thanks for trying

Steve
I shouldn't kill the OS (assuming that the card hasn't died etc) - what that does is dump the caches that apt uses, and that is often enough to let it recover... anyway that asside, it was worth a punt to see if you could get it back.
Andy

73 de MW0MWZ
http://pistar.uk
W3AAD
Posts: 6
Joined: Thu Jun 03, 2021 10:45 pm

Re: 502 Bad Gateway

Post by W3AAD »

I should have backed it up but it was ages ago.

Nothing like closing the barn door after the cow got out!

Thanks again

Steve
Post Reply