Gateway stopped working, but RPi accessible from SSH

Hi, I have had this issue before, reset my gateway and started from scratch and am getting a similar error. Have gotten a bit further this time though.

I have my gateway on a RPi 4 connected by ethernet and wifi. I primarily access it through my domain name. This evening, I noticed that my automations were not running. I could not access my gateway through the domain or the local IP addresses. I rebooted by Pi and it still would not work.

My Pi is seen on my network though by my router. I was able to SSH into it from my PC. I checked the running processes and only got:

pi@gateway:~ $ ps
PID TTY TIME CMD
1436 pts/0 00:00:00 bash
1635 pts/0 00:00:00 ps

So it looked like Gateway was not running? So i navigated to ~/mozilla-iot/gateway and ran run-app.sh. After a bunch of printout, I got the following error:

Opening database: /home/pi/.mozilla-iot/config/db.sqlite3
2020-01-16 17:09:19.257 INFO : Opening database: /home/pi/.mozilla-iot/log/logs.sqlite3
2020-01-16 17:09:19.942 INFO : DNS config is: gateway
2020-01-16 17:09:19.944 INFO : Service Discovery: changing profile - local domain is now: gateway
2020-01-16 17:09:21.622 INFO : Service Discovery: state changed to: true
2020-01-16 17:09:21.839 ERROR : Error: listen EADDRINUSE :::4443
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at promises.push.Promise (/home/pi/mozilla-iot/gateway/build/webpack:/src/app.js:133:1)
at new Promise ()
at startHttpsGateway (/home/pi/mozilla-iot/gateway/build/webpack:/src/app.js:132:1)
at serverStartup.promise.TunnelService.userSkipped.then (/home/pi/mozilla-iot/gateway/build/webpack:/src/app.js:381:1)
at
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webthings-gateway@0.10.0 run-only: node build/gateway.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webthings-gateway@0.10.0 run-only script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-01-16T22_09_21_875Z-debug.log

No idea if run-app.sh is even how I would try and manually start the gateway. I never have had to before, it has always just worked.

Any help would be greatly appreciated. Really don’t want to start over from scratch again as I have MUUCCCCHHHH more automations and devices now.

Thanks!

So I did a little more digging, found the system process for the gateway and stopped it and then restarted it and then looked at the log. Seemed to be ok, and then I saw these errors:
Jan 16 16:56:28 gateway run-app.sh[625]: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3
Jan 16 16:56:31 gateway run-app.sh[625]: 2020-01-16 16:56:31.154 INFO : Opening database: /home/pi/.mozilla-iot/log/lo
Jan 16 16:56:31 gateway sudo[845]: pi : TTY=unknown ; PWD=/home/pi/mozilla-iot/gateway ; USER=root ; COMMAND=/bin/
Jan 16 16:56:31 gateway sudo[845]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 16 16:56:32 gateway sudo[845]: pam_unix(sudo:session): session closed for user root
Jan 16 16:56:32 gateway run-app.sh[625]: 2020-01-16 16:56:32.070 INFO : DNS config is: gateway
Jan 16 16:56:32 gateway run-app.sh[625]: 2020-01-16 16:56:32.072 INFO : Service Discovery: changing profile - local do
Jan 16 16:56:32 gateway sudo[856]: pi : TTY=unknown ; PWD=/home/pi/mozilla-iot/gateway ; USER=root ; COMMAND=/bin/
Jan 16 16:56:32 gateway sudo[856]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 16 16:56:32 gateway sudo[856]: pam_unix(sudo:session): session closed for user root
Jan 16 16:56:32 gateway sudo[865]: pi : TTY=unknown ; PWD=/home/pi/mozilla-iot/gateway ; USER=root ; COMMAND=/bin/
Jan 16 16:56:32 gateway sudo[865]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 16 16:56:33 gateway sudo[865]: pam_unix(sudo:session): session closed for user root

And everything afterwards is an error saying that it failed to get rules.

]: 2020-01-16 20:11:25.325 WARN : manifest.json did not exist for add-on da]: 2020-01-16 20:11:36.771 WARN : manifest.json did not exist for add-on te]: 2020-01-16 20:11:43.527 INFO : Checking for add-on updates…
]: 2020-01-16 20:11:43.708 INFO : migrateThing wake-on-lan-00:E0:4C:68:00:4]: 2020-01-16 20:11:43.711 INFO : migrateThing DateTimeDevice
]: 2020-01-16 20:11:43.712 INFO : migrateThing 31206e56cf35351ea02eb9eb171f]: 2020-01-16 20:11:43.721 ERROR : Error getting value for thingId: presence]: 2020-01-16 20:11:43.722 ERROR : getProperty: device: presence-f0989d5dc3d]: 2020-01-16 20:11:43.724 WARN : Rule get failed { code: 500,
]: message: ‘getProperty: device: presence-f0989d5dc3d4 not found.’ }
]: 2020-01-16 20:11:43.726 ERROR : Error getting value for thingId: philips-]: 2020-01-16 20:11:43.726 ERROR : getProperty: device: philips-hue-001788ff]: 2020-01-16 20:11:43.727 ERROR : Error getting value for thingId: philips-]: 2020-01-16 20:11:43.728 ERROR : getProperty: device: philips-hue-001788fflines 521-564

Here’s a little more of the error. I found what I thought was a similar thread which mentioned reinstalling python. I tried that but it didn’t work.

Those rule and property errors are expected on startup. I’d suggest connecting your RPi via Wi-Fi OR ethernet, not both. That may be the cause of your connectivity issues.