hassio-addons / addon-motioneye

motionEye - Home Assistant Community Add-ons
https://addons.community
MIT License
277 stars 44 forks source link

502 Bad Gateway #168

Closed Rihan9 closed 3 years ago

Rihan9 commented 3 years ago

Problem/Motivation

Hi, i can't open this addon, it always returns 502 bad gateway.

I am using a reverse proxy to connect to the home assistant and the following configuration for the addon:

motion_webcontrol: true ssl: false certfile: fullchain.pem keyfile: privkey.pem action_buttons: []

I have tried to disable motion_webcontrol with no success.

What am I doing wrong?

frenck commented 3 years ago

Anything in the logs?

Rihan9 commented 3 years ago

Hi, I copy the last part of the log below. I removed my instance domain name for security reason and replace it with "\<REMOVED>"

[services.d] starting services [services.d] done. [09:13:23] INFO: Starting motionEye... INFO: hello! this is motionEye server 0.42.1 INFO: cleanup started INFO: wsswitch started INFO: tasks started INFO: mjpg client garbage collector started INFO: server started Terminated [09:14:23] INFO: Starting NGinx... 2021/02/08 09:14:49 [error] 607#607: *1 connect() failed (111: Connection refused) while connecting to upstream, client: > 172.30.32.2, server: a0d7b954-motioneye, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:28765/", host: "\<REMOVED>", referrer: "https://\<REMOVED>/hassio/ingress/a0d7b954_motioneye" [08/Feb/2021:09:14:49 +0100] 502 192.168.178.36, 172.30.33.3, 172.30.32.1(172.30.32.2) GET / HTTP/1.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36 Edg/88.0.705.56)

rcxrbt commented 3 years ago

same, issue, solved reinstalling... :(

Valdun commented 3 years ago

Same for me, install uninstall etc doesn't make any changes. Tried without my reverse proxy, on http on the port 8123, still bad gateway issue.

Is someone successed with ?

Gordan74 commented 3 years ago

Is anyone able to resolve this?

Here is my log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 00-banner.sh: executing...

Add-on: motionEye Simple, elegant and feature-rich CCTV/NVR for your cameras

Add-on version: 0.11.0 You are running the latest version of this add-on. System: Ubuntu 20.04.2 LTS (amd64 / qemux86-64) Home Assistant Core: 2021.2.3 Home Assistant Supervisor: 2021.02.11

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] motioneye.sh: executing... backing up /data/motioneye/motioneye.conf [cont-init.d] motioneye.sh: exited 0. [cont-init.d] nginx.sh: executing... [cont-init.d] nginx.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [22:18:06] INFO: Starting motionEye... INFO: hello! this is motionEye server 0.42.1 INFO: cleanup started INFO: wsswitch started INFO: tasks started INFO: mjpg client garbage collector started INFO: smb mounts started INFO: server started [22:18:07] INFO: Starting NGinx...

SdeGeata commented 3 years ago

Same issue here, 502 Bad Gateway.

My config is as follows:

motion_webcontrol: false ssl: false certfile: fullchain.pem keyfile: privkey.pem action_buttons: []

and the only thing in the log is this, repeated endlessly:

INFO: hello! this is motionEye server 0.42.1 CRITICAL: media directory "/var/lib/motioneye" does not exist or is not writable [21:56:29] INFO: Starting motionEye...

The only way that I can seem to find to remedy this is to uninstall the addon, then reinstall and restore from my back-up. This ends up being a huge waste of time as the problem returns pretty quick.

aweb-01 commented 3 years ago

I've had a "502 Bad Gateway" every time I've updated my home assistant version, and every time I need to reinstall motioneye to get it to work. Any ideas?

Running home assistant on a RPi4.

Here's my log...

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: motionEye
 Simple, elegant and feature-rich CCTV/NVR for your cameras
-----------------------------------------------------------
 Add-on version: 0.11.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.13  (armv7 / raspberrypi4)
 Home Assistant Core: 2021.4.3
 Home Assistant Supervisor: 2021.03.9
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] motioneye.sh: executing... 
backing up /data/motioneye/motioneye.conf
[cont-init.d] motioneye.sh: exited 0.
[cont-init.d] nginx.sh: executing... 
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[15:31:25] INFO: Starting motionEye...
    INFO: hello! this is motionEye server 0.42.1
CRITICAL: media directory "/var/lib/motioneye" does not exist or is not writable
[15:31:26] INFO: Starting motionEye...
    INFO: hello! this is motionEye server 0.42.1
CRITICAL: media directory "/var/lib/motioneye" does not exist or is not writable
github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment đź‘Ť This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

aweb-01 commented 3 years ago

This is still an issue on the latest version, if anyone has been able to stamp it out somehow I’d be interested in hearing how.

SdeGeata commented 3 years ago

Same here. Updated to the latest version yesterday, still no go.

grayac2 commented 3 years ago

I can confirm this behavior as well. The add-on was working fine. I updated my instance of Home Assistant, then I was met with the 502 Bad Gateway message no matter what I tried. My logs looked just like the ones provided by @aweb-01 . Completely reinstalling the add-on solved the problem.

Xitee1 commented 3 years ago

I also have that problem. As soon as it restarts motionEye i get this error. If i try to access motionEye i get a 502: Bad Gateway error. And in the logs it says CRITICAL: media directory "/var/lib/motioneye" does not exist or is not writable.

It also has a really high CPU usage (around 50%), even if i only have one cam without motion detection.

Valdun commented 3 years ago

Hey,

Is ssl active ?

Le sam. 12 juin 2021 Ă  22:57, Xitee @.***> a Ă©crit :

I also have that problem. As soon as it restarts motionEye i get this error. If i try to access motionEye i get a 502: Bad Gateway error. And in the logs it says CRITICAL: media directory "/var/lib/motioneye" does not exist or is not writable.

It also has a really high CPU usage (around 50%), even if i only have one cam without motion detection.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-860107661, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E656F6Y7BZXFZ23VN3TSPC4BANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

Yes it is. I also tried it without but it makes no difference.

Valdun commented 3 years ago

Without, and did you restarted the full host after disabling it ?

Any reverse proxy ? Default port 8123 ?

What kind of installation you have ? Os ? Docker ?

Le sam. 12 juin 2021 Ă  23:35, Xitee @.***> a Ă©crit :

Yes it is. I also tried it without but it makes no difference.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-860113567, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3EZSIXMQ72Y5JYPFN4DTSPHLLANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

No i didn't restarted the host, just the addon. I use a reverse proxy but it also doesn't work if i access home assistant directly with the local ip and default port. I have the Raspberry Pi 4 64bit installation.

Edit: I now also tried it with a host restart. But it neither worked. I also think it has more to do with the files because of the error message. It is in a boot loop because the directory somehow doesn't exists.

Valdun commented 3 years ago

You should also try the full restart.

What's your proxy configuration ?

So the default sd image right ?

Le sam. 12 juin 2021 Ă  23:45, Xitee @.***> a Ă©crit :

No i didn't restarted the host, just the addon. I use a reverse proxy but it also doesn't work if i access home assistant directly with the local ip and default port. I have the Raspberry Pi 4 64bit installation.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-860115895, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E54LXKO2HKWN3IBLADTSPIPRANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

I've now already made a full restart (you probably didn't see the comment edit).

I have a apache reverse proxy server on a seperate Raspberry Pi.

It is the default sd image from the Home Assistant web page.

I also think it has more to do with the files and not with the network because of the error message. It is in a boot loop because it can't write to the directory.

Valdun commented 3 years ago

Do you use https ? For you home assistant ?

Le dim. 13 juin 2021 Ă  00:01, Xitee @.***> a Ă©crit :

I've now already made a full restart (you probably didn't see the comment edit).

I have a apache reverse proxy server on a seperate Raspberry Pi.

It is the default sd image from the Home Assistant web page.

I also think it has more to do with the files and not with the network because of the error message. It is in a boot loop because i can't write to the directory.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-860118808, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E3I5Z4Q3LHCJSWB2DDTSPKLZANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

For local access i don't. But with the reverse proxy i use https. But as i said, I'm pretty sure it hasn't to do with the network. It is caused because motionEye is in a boot-loop. And i found out it is normal to get the "502: Bad Gateway" error while motionEye is starting. And because it never boots completely, i always get the 502 error. I just don't know why it can't boot after a restart and i have to reinstall it.

Valdun commented 3 years ago

Do you have some logs ?

Le mar. 15 juin 2021 Ă  19:43, Xitee @.***> a Ă©crit :

For local access i don't. But with the reverse proxy i use https. But as i said, I'm pretty sure it hasn't to do with the network. It is caused because motionEye is in a boot-loop. And i found out it is normal to get the "502: Bad Gateway" error while motionEye is starting. And because it never boots completely, i always get the 502 error. I just don't know why it can't boot after a restart and i have to reinstall it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861704511, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E57BOKPKXLQ2UQU56DTS6GKPANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

Here: https://pastebin.com/uiDwDW7U

Valdun commented 3 years ago

Hey dude,

Seems Ă  directory is missing Try Mkdir /var/lib/motioneye And Chmod 777 /var/lib/motioneye

Le mar. 15 juin 2021 Ă  20:04, Xitee @.***> a Ă©crit :

Here: https://pastebin.com/uiDwDW7U

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861719402, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E6B5HKFJ3HPNGMHOBDTS6IZFANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

I already tried that on the host but because it runs on docker it of course doesn't work. I can't go into the container and execute these commands because the command "docker" does not exists.

Valdun commented 3 years ago

Ahhh So go on docker, connect to your motion eye instance and create it

Le mar. 15 juin 2021 Ă  20:10, Xitee @.***> a Ă©crit :

I already tried that on the host but because it runs on docker it of course doesn't work. I can't go into the container and execute these commands because the command "docker" does not exists.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861723455, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E4EKOGSXHM4FPWNTFDTS6JQPANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

Did you even read my comment? I said that i can't do this because the docker command doesn't exists, so i can't create the folder.

Valdun commented 3 years ago

Sorry miss read.

So try to check in /usr/bin/local/docker

If the binary exist

Le mar. 15 juin 2021 Ă  20:16, Xitee @.***> a Ă©crit :

Did you even read my comment? I said that i can't do this because the docker command doesn't exists, so i can't create the folder.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861728097, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E5TQ677PVMKFCHN7IDTS6KGTANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

That folder doesn't exists

Valdun commented 3 years ago

In fact it was the full binairy path

Also you can try

sudo apt-get install --reinstall docker

Le mar. 15 juin 2021 Ă  20:22, Xitee @.***> a Ă©crit :

That folder doesn't exists

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861731945, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3EZLN2JTO2DCTGV6XCLTS6K6NANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

The commands apt / apt-get also doesn't exists

Valdun commented 3 years ago

What's your host system ?

Linux ? Debian ? Ubuntu ?

Le mar. 15 juin 2021 Ă  20:26, Xitee @.***> a Ă©crit :

The commands apt / apt-get also doesn't exists

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861734574, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E6Q2UYUBTPRBOJSOJDTS6LO5ANCNFSM4XCNR3BQ .

Valdun commented 3 years ago

Is it the dzfault home assistant image ?

Le mar. 15 juin 2021 Ă  20:27, Come HENRY @.***> a Ă©crit :

What's your host system ?

Linux ? Debian ? Ubuntu ?

Le mar. 15 juin 2021 Ă  20:26, Xitee @.***> a Ă©crit :

The commands apt / apt-get also doesn't exists

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861734574, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E6Q2UYUBTPRBOJSOJDTS6LO5ANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

As i said, I use the default Home Assistant image.

Valdun commented 3 years ago

So on the main instance when you ssh it, is there Ă  path : /var/lib/docker ?

Le mar. 15 juin 2021 Ă  20:28, Xitee @.***> a Ă©crit :

As i said, I use the default Home Assistant image.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861735912, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E62FYEDICQATLSCUXLTS6LWPANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

No, there isn't

Valdun commented 3 years ago

Try : find / -name docker

Le mar. 15 juin 2021 Ă  20:32, Xitee @.***> a Ă©crit :

No, there isn't

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861738099, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E4G5PJRHY2K3AB3FQTTS6MD5ANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

It returns nothing.

Valdun commented 3 years ago

It's a completely locked instance. Too bad

You connect to the hassio main instance and not the host.

I would sugest you to save you yml file and reinstall it from scratch. As we can't. Do anything. My side I installed Ă  debian and pulled the docker container

Le mar. 15 juin 2021 Ă  20:38, Xitee @.***> a Ă©crit :

It returns nothing.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861741663, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E3VPW64SER7IDEOANDTS6M2ZANCNFSM4XCNR3BQ .

Xitee1 commented 3 years ago

I will try that. But i don't think it's gonna work because it looks like a lot other people also have this problem. And that's the only thing that doesn't work on my Home Assistant. Everything else works completely fine.

Valdun commented 3 years ago

I had it.

And I made Ă  lot of troobleshhoting before making it worked.

But I wanted to keep the hand on the host

Le mar. 15 juin 2021 Ă  20:44, Xitee @.***> a Ă©crit :

I will try that. But i don't think it's gonna work because it looks like a lot other people also have this problem. And that's the only thing that doesn't work on my Home Assistant. Everything else works completely fine.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-motioneye/issues/168#issuecomment-861745805, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQ3E45KG2UVEBIMLQP7HTTS6NSLANCNFSM4XCNR3BQ .

sinclairpaul commented 3 years ago

Although there seems to be a number of different issues in this thread, for the /var/lib/motioneye error, I would be interested to know are you setting external paths for saving media?

By default the addon saves media to /share/motioneye

As can be seen at:

https://github.com/hassio-addons/addon-motioneye/blob/e3dfeec5a9b3c0d4b13f6a8e8ba682126c1564e0/motioneye/rootfs/etc/motioneye/motioneye.conf#L12

If you are using different paths, I wonder if Motioneye falls back if not available, to a folder that does not exist within the addon. For those with a different error, apologies for the spam notification....

aweb-01 commented 3 years ago

@sinclairpaul yeah I think the stuff about proxy/ssl is unrelated to the core of this issue.

That being said I did notice that my save paths were all custom paths, I'll try it with those set back to default, thanks for the suggestion.

Xitee1 commented 3 years ago

It works! I didn't knew that it uses another path and i just imported my backup from my old installation where i used the /var/lib/motioneye default path.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment đź‘Ť This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!