ZoneMinder / zoneminder

ZoneMinder is a free, open source Closed-circuit television software application developed for Linux which supports IP, USB and Analog cameras.
http://www.zoneminder.com/
GNU General Public License v2.0
4.9k stars 1.2k forks source link

Live view not working - Unable to authenticate user (zms.cpp 212) #2565

Closed Giulio2333 closed 4 years ago

Giulio2333 commented 5 years ago

Describe Your Environment

Describe the bug Zm is recording feed from the 4 camers is connected to, but when I try to access live feed can't see nothing and geneates errors in log: - Unable to authenticate user (zms.cpp 212) - Socket /var/run/zm/zms-999953s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048

The system worked properly for several months and seems to have stop working yesterday. Don't know if it's correlated, but between yesterday and the day before here in Italy time changed (DST).

To Reproduce Steps to reproduce the behavior: Just open a live feed tab (Cycle, Montage, Montage Review...)

Expected behavior Should be able to see live feed

Relevant part of the config OPT_USE_AUTH - yes AUTH_TYPE - builtin AUTH_RELAY - hashed AUTH_HASH_IPS - yes AUTH_HASH_LOGINS - yes Apache HTTPS server

Debug Logs

2019-04-01 08:00:14 zmc_m4 2677 INF East: images:300 - Capturing at 5.00 fps, capturing bandwidth 15145bytes/sec zm_monitor.cpp 2477 2019-04-01 08:00:14 zms_m1 2949 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:13 zms_m4 2944 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:13 zms_m4 2945 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:13 web_php 1706 ERR Socket /var/run/zm/zms-999953s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:13 zms_m1 2946 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:13 zmfilter_1 2687 INF Checking filter PurgeWhenFull delete returned 0 events zmfilter.pl 2019-04-01 08:00:13 zms_m1 2948 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:13 zma_m2 2664 INF West: 200 - Analysing at 4.76 fps zm_monitor.cpp 1247 2019-04-01 08:00:12 web_php 1288 ERR Socket /var/run/zm/zms-307188s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:12 zms_m4 2942 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:12 zms_m4 2943 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:11 zms_m3 2936 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:11 web_php 1289 ERR Socket /var/run/zm/zms-938276s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:11 zms_m3 2937 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:11 zms_m2 2938 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:11 zms_m3 2939 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:11 zms_m2 2940 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:11 zms_m3 2941 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:10 web_php 1288 ERR Socket /var/run/zm/zms-726399s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:10 zms_m3 2933 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:10 zms_m3 2934 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:10 zms_m3 2935 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:09 zms_m2 2932 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:09 zma_m1 2647 INF Magazzino: 300 - Analysing at 5.00 fps zm_monitor.cpp 1247 2019-04-01 08:00:09 zmc_m3 2668 INF South: images:200 - Capturing at 5.00 fps, capturing bandwidth 19985bytes/sec zm_monitor.cpp 2477 2019-04-01 08:00:09 zms_m2 2931 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:09 zms_m1 2930 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:09 zms_m2 2929 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:09 zms_m1 2928 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:08 web_php 1706 ERR Socket /var/run/zm/zms-938276s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:08 zmc_m2 2651 INF West: images:200 - Capturing at 5.00 fps, capturing bandwidth 22357bytes/sec zm_monitor.cpp 2477 2019-04-01 08:00:08 web_php 1290 ERR Socket /var/run/zm/zms-999953s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:08 zmc_m1 2642 INF Magazzino: images:300 - Capturing at 5.00 fps, capturing bandwidth 176070bytes/sec zm_monitor.cpp 2477 2019-04-01 08:00:08 zms_m4 2927 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:08 zms_m2 2926 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:08 zms_m2 2925 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:08 zms_m4 2924 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:07 web_php 2361 ERR Socket /var/run/zm/zms-938276s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:07 web_php 1291 ERR Socket /var/run/zm/zms-307188s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:07 zms_m2 2923 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:07 zms_m3 2922 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:07 zms_m2 2921 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:07 zms_m3 2920 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:07 zms_m2 2919 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:06 zms_m3 2918 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:06 web_php 1289 ERR Socket /var/run/zm/zms-938276s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:06 zms_m3 2917 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:06 zms_m3 2916 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:06 zms_m3 2915 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:05 zms_m1 2912 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:05 zms_m2 2913 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:05 zms_m1 2914 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:05 web_php 1288 ERR Socket /var/run/zm/zms-726399s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:04 zms_m4 2907 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:04 zms_m3 2908 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:04 zms_m4 2909 ERR Unable to authenticate user zms.cpp 212 2019-04-01 08:00:04 web_php 1289 ERR Socket /var/run/zm/zms-999953s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. /usr/share/zoneminder/www/includes/functions.php 2048 2019-04-01 08:00:04 web_php 2047 ERR Socket /var/run/zm/zms-938276s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go tohttp://zoneminder.readthedo`

welcome[bot] commented 5 years ago

Thanks for opening your first issue here! Just a reminder, this forum is for Bug Reports only. Be sure to follow the issue template!

Giulio2333 commented 5 years ago

Update: With OPT_USE_AUTH = OFF, live feed start working again

wormszer commented 5 years ago

I am seeing the same issue on ubuntu 18.04.2 LTS and zone minder 1.32 It was a brand new install and i followed the directions listed at https://zoneminder.readthedocs.io/en/latest/installationguide/ubuntu.html#easy-way-ubuntu-18-04

Everything kept pointing to the PATH_ZMS issue but it wasn't until i found some other post about 1.31 and trying AUTH_RELAY = none then it started working.

The camera was RTMP using ffmpeg and h264.

ctgreybeard commented 5 years ago

I have just installed 1.32.3 on Ubuntu 18.04 and am also see the "Socket /var/run/zm/zms-956384s.sock does not exist." I tried turning OPT_USE_AUTH off with no change. zmc appears to be running but there is no socket for it in /var/run/zm. There is a zmdc.sock= there.

academo commented 5 years ago

I can report the same issue on a fresh install on ubuntu 18.04.

I switched the auth relay option to "none" and solved the issue but this is of course reducing the security of the system.

MAF-398 commented 5 years ago

Same as academo. Solved by auth relay to none.

tahphallus commented 4 years ago

same issue here on Ubuntu 18.04.2 LTS No images vissible on the montage tab or live view. After setting OPT_USE_AUTH = off, everything works again.

However, when setting AUTH_RELAY to NONE it does work. So only when selecting hashed or plain it doesn't work.

Zoneminder version: You are running the most recent version of ZoneMinder, v1.32.3. No update is necessary.

Contents of log:

When not working: 2019-06-24 09:38:41 | zms_m2 |   | 3057 | ERR | Unable to authenticate user | zms.cpp | 212

When working: 2019-06-24 09:51:08 | zms_m3 |   | 3401 | INF | Authenticated user 'username' | zm_user.cpp | 126 2019-06-24 09:51:08 | zms_m3 |   | 3399 | INF | Got signal 15 (Terminated), exiting | zm_signal.cpp | 40

pliablepixels commented 4 years ago

setting auth_relay to none will most likely break newer version of zmNinja. Is this issue prevalent in 1.33?

Siggemada commented 4 years ago

Getting this as well on multi-server install. Trying to view a USB camera on a oragePi (armhf, Debian Stretch with Armbian Linux 4.19.57-sunxi) from other server (intel, Ubuntu 18.04.2).

Also used easy way: https://zoneminder.readthedocs.io/en/latest/installationguide/ubuntu.html#easy-way-ubuntu-18-04

gk998 commented 4 years ago

I have the same issue on Ubuntu 18.04, nginx and Zoneminder 1.33.14~20190821101210-bionic as well. Setting auth_relay to none doesn't help here. Then in get: fcgiwrap[3595]: terminate called after throwing an instance of 'std::logic_error' fcgiwrap[3595]: what(): basic_string::_M_construct null not valid Disabling Auth helps, but I don't want having an open installation. Edit: Replaced nginx with apache and now it works.

mludvig commented 4 years ago

Same experience as everyone above here. Brand new install of Ubuntu 18.04 + ZM 1.32.3 + Apache. Had to set AUTH_RELAY to NONE to make it work.

What implications does this have? Who can do what without authenticating??

mludvig commented 4 years ago

BTW I can see there were quite a few changes in the zms code related to auth in the recent months. Perhaps some of it broke it?

https://github.com/ZoneMinder/zoneminder/commits/master/src/zms.cpp

connortechnology commented 4 years ago

We believe this is not relevant to 1.33.14

mludvig commented 4 years ago

Apparently it affects a lot of users. Any chance to backport the fix to stable (!) 1.32 branch? I’m guessing it won’t be a complicated fix. Thanks!

connortechnology commented 4 years ago

No. We will be releasing 1.34 soon.

Siggemada commented 4 years ago

I would also check the system timezone with tzdata.

That helped me.

On Tue, Sep 17, 2019, 21:10 Isaac Connor notifications@github.com wrote:

No. We will be releasing 1.34 soon.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ZoneMinder/zoneminder/issues/2565?email_source=notifications&email_token=AF54UXJR6QVYSVZ65QLQ7MDQKETSDA5CNFSM4HCUYRN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD65SYJI#issuecomment-532360229, or mute the thread https://github.com/notifications/unsubscribe-auth/AF54UXNW5EOKSAUJOI3BYJ3QKETSDANCNFSM4HCUYRNQ .

mludvig commented 4 years ago

I would also check the system timezone with tzdata. That helped me.

Brilliant, that was the problem! Mismatch between system timezone and PHP date.timezone. Seems to work now with AUTH_RELAY=hashed :)

mozilla2012 commented 4 years ago

I updated my timezone to match my system timezone, but I still can't see any camera's current view without OPT_USE_AUTH = off, but that's not a safe way to run the system.

It appears to still capture events in the background though with the timezone fixed. So I guess a temporary solution is to keep OPT_USE_AUTH = on all the time unless I need to see a live view temporarily.

Setting AUTH_RELAY=plain doesn't fix it for me, so I'm going to leave it as hashed for now since this workaround works until a more permanent fix is found.

connortechnology commented 4 years ago

If RELAY=plain doesn't fix it, then the issue is not with your timezone.

Marvo2011 commented 4 years ago

Same issue here but just after an upgrade from 1.33 to 1.34.2 PHP and system timezone are the same.

AUTH_RELAY=none fixed it but makes me not happy.

Jemyy-AR commented 4 years ago

the problem still exists. version 1.34.15 Has any body solved the problem?

mludvig commented 4 years ago

@Jemyy-AR I don't remember exactly how I fixed it but I think it had something to do with the server timezone? Somehow I managed to do it without having to resort to disabling the authentication.

(I wish I had reported here so I can find it when I need it next time :)

paul-h commented 3 years ago

Making sure the PHP and system timezone are the same seems to have fixed this for me. So in Ubuntu 20.04.1 LTS I did this

timedatectl set-timezone Europe/London

and also make sure the php date.timezone settings match and are uncommented in both /etc/php/7.4/cli/php.ini and /etc/php/7.4/apache2/php.ini

date.timezone = Europe/London

eddriesen commented 3 years ago

Everything kept pointing to the PATH_ZMS issue but it wasn't until i found some other post about 1.31 and trying AUTH_RELAY = none then it started working.

THANK YOU !!! auth relay did fix it.

It stopped working after I migrated the existing install from an overcrowded ub 18.04 install to a fresh 20.04 install. Went trough the install instructions nevertheless (for correct folder permissions, ....)

DentonGentry commented 3 years ago

Setting the system timezone solved it for me as well: timedatectl set-timezone America/Los_Angeles

I had set the timezone in the Zoneminder options but not in the system. The Zoneminder logs contained errors about a socket being missing, and authentication failure. Setting the system timezone resolved it.

thillRobot commented 2 years ago

Setting the timezone with timedatectl also fixed the problem for me.

jfernandz commented 2 years ago

@thillRobot

Setting the timezone with timedatectl also fixed the problem for me.

Same for me, the problem was actually the mismatching between system, ZM and php timezone. You have to set these three properly. I think this info should be included in here

https://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc

ohaka860 commented 2 years ago

Hi all, i had the issue when i turn on OPT_USE_AUTH and there was a difference between timezone Options in zoneminder 1.36 and the Ubuntu LTS20.04 server timezone.

I also had to refresh my browser page and the issue has gone. This due cause the browser session was also stay with a generic access, and was not reconnected with the user loging in.