Nardo86 / zm-docker

My personal ZoneMidner on a Raspberry Pi 4
4 stars 3 forks source link

ZM won't start. /run/zm/zmdc.sock: No such file or directory #1

Open meren-den opened 6 days ago

meren-den commented 6 days ago

Hello! ZM won't start. There is an error in the logs. Can you give me some advice on how to solve this problem?

20.11.24 10:36:24 zmpkg 737 ERR Unable to run "sudo -u www-data /usr/bin/zmdc.pl start zmstats.pl", output is "Unable to connect to server using socket at /run/zm/zmdc.sock", status is 255 zmpkg.pl - 20.11.24 10:36:24 zmpkg 737 ERR Unable to run "sudo -u www-data /usr/bin/zmdc.pl start zmupdate.pl -c", output is "Unable to connect to server using socket at /run/zm/zmdc.sock", status is 255 zmpkg.pl - 20.11.24 10:36:23 zmpkg 737 ERR Unable to run "sudo -u www-data /usr/bin/zmdc.pl start zmwatch.pl", output is "Unable to connect to server using socket at /run/zm/zmdc.sock", status is 255 zmpkg.pl - 20.11.24 10:36:23 zmpkg 737 ERR Unable to run "sudo -u www-data /usr/bin/zmdc.pl start zmfilter.pl --filter_id=2 --daemon", output is "Unable to connect to server using socket at /run/zm/zmdc.sock", status is 255 zmpkg.pl - 20.11.24 10:36:23 zmpkg 737 ERR Unable to run "sudo -u www-data /usr/bin/zmdc.pl start zmfilter.pl --filter_id=1 --daemon", output is "Unable to connect to server using socket at /run/zm/zmdc.sock", status is 255 zmpkg.pl - 20.11.24 10:36:23 zmpkg 737 INF Single server configuration detected. Starting up services. zmpkg.pl - 20.11.24 10:36:23 zmpkg 737 ERR Unable to run "sudo -u www-data /usr/bin/zmdc.pl startup", output is "Starting server", status is 255 zmpkg.pl - 20.11.24 10:36:23 zmdc 748 FAT Can't connect to zmdc.pl server process at /run/zm/zmdc.sock: No such file or directory zmdc.pl - 20.11.24 10:36:15 zmpkg 737 INF Command: start zmpkg.pl - 20.11.24 10:36:15 zmpkg 737 INF Sanity checking States table...

Nardo86 commented 6 days ago

Hi @meren-den, I'm glad you're using my publication and thanks for reporting the issues.

However, I need some more information from you to help investigate: from my tests, the application starts correctly both on initial installation and updates. To better understand the problem, could you please provide me with the following details:

meren-den commented 6 days ago

Hello @Nardo86 Thanks for the quick response! I run the image like this:

docker run -d\ --name=ZoneMinder\ -p 10443:443/tcp\ -e TZ=Asia/Irkutsk \ -e SELFSIGNED=0 \ --shm-size=1.5g \ -v /docker/zoneminder/config:/config\ -v /docker/zoneminder/zmcache:/var/cache/zoneminder\ -v /docker/zoneminder/letsencrypt/live:/sslcert/live\ -v /docker/zoneminder/letsencrypt/archive:/sslcert/archive\ --restart always \ nardo86/zoneminder

I noticed one pattern. If you launch ZM using the button via the web interface in the upper right corner, the service starts successfully. But after restarting the Docker container, the service does not start automatically. There are errors in the logs that I wrote about above. I also tried to start the service manually using the "zmpkg.pl start" command, but the errors were still the same.

Nardo86 commented 6 days ago

Are you using a raspberry? I tried your prompt with the addition of the FQDN (mandatory if you do not use the self-signed certificate) and the system started correctly, even from the interface everything is ok.

Did you already have a configuration and it stopped working after the last update?

sudo docker run \ --name=ZoneMinder \ -p 10443:443/tcp \ -e TZ=Asia/Irkutsk \ -e SELFSIGNED=0 \ -e FQDN="xxxxxxxxxxxxxxx.org" \ --shm-size=1.5g \ -v /home/eros/Storage/DockerConfig/Swag/etc/letsencrypt/live:/sslcert/live \ -v /home/eros/Storage/DockerConfig/Swag/etc/letsencrypt/archive:/sslcert/archive \ --restart always \ nardo86/zoneminder

Current default time zone: 'Asia/Irkutsk' Local time is now: Wed Nov 20 21:26:12 +08 2024. Universal Time is now: Wed Nov 20 13:26:12 UTC 2024.

Check ZoneMinder version Installing new version Selecting previously unselected package zoneminder. (Reading database ... 24360 files and directories currently installed.) Preparing to unpack .../zoneminder_1.36.35~20241030.27-bullseye_amd64.deb ... Unpacking zoneminder (1.36.35~20241030.27-bullseye) ... Setting up zoneminder (1.36.35~20241030.27-bullseye) ... The cgi module is not enabled in apache2. I am enabling it using a2enmod cgi. apache2_invoke: Enable module cgi invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of restart. invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of stop. MySQL/MariaDB not found; assuming remote server. Processing triggers for mailcap (3.69) ... Considering dependency setenvif for ssl: Module setenvif already enabled Considering dependency mime for ssl: Module mime already enabled Considering dependency socache_shmcb for ssl: Enabling module socache_shmcb. Enabling module ssl. See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates. To activate the new configuration, you need to run: service apache2 restart Enabling module rewrite. To activate the new configuration, you need to run: service apache2 restart Enabling module headers. To activate the new configuration, you need to run: service apache2 restart Enabling module expires. To activate the new configuration, you need to run: service apache2 restart Enabling conf zoneminder. To activate the new configuration, you need to run: service apache2 reload Enabling site default-ssl. To activate the new configuration, you need to run: service apache2 reload Configuring MariaDBPath MariaDBPath configuration done Check MariaDB config Starting MariaDB database server: mariadbd .. mysqld is alive mysqlshow: Access denied for user 'zmuser'@'localhost'

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here.

stty: 'standard input': Inappropriate ioctl for device Enter current password for root (enter for none): stty: 'standard input': Inappropriate ioctl for device OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Enabled successfully! Reloading privilege tables.. ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] stty: 'standard input': Inappropriate ioctl for device New password: Re-enter new password: stty: 'standard input': Inappropriate ioctl for device Password updated successfully! Reloading privilege tables.. ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] ... Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] ... Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] - Dropping test database... ... Success!

  • Removing privileges on test database... ... Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] ... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB! Stopping MariaDB database server: mariadbd. Starting MariaDB database server: mariadbd. mysqld is alive MariaDB configuration done Set Php timezone Checking MSMTP configuration Linking to SWAG Set ServerName Setting /var/cache subfolders Starting Starting Apache httpd web server: apache2. [Wed Nov 20 21:26:55.841157 2024] [ssl:warn] [pid 722:tid 722] AH01909: xxxxxxxxxxxxxxx.org:443:0 server certificate does NOT include an ID which matches the server name [Wed Nov 20 21:26:56.099424 2024] [ssl:warn] [pid 727:tid 727] AH01909: xxxxxxxxxxxxxxx.org:443:0 server certificate does NOT include an ID which matches the server name [Wed Nov 20 21:26:56.121710 2024] [mpm_prefork:notice] [pid 727:tid 727] AH00163: Apache/2.4.62 (Debian) OpenSSL/1.1.1w configured -- resuming normal operations [Wed Nov 20 21:26:56.121783 2024] [core:notice] [pid 727:tid 727] AH00094: Command line: '/usr/sbin/apache2' This is the command I used to start and the log of successful execution

Date/Time Component Server PID Level Message File Line
11/20/24, 9:27:04 PM GMT+8 zmstats 813 INF Stats Daemon starting in 30 seconds zmstats.pl '-
11/20/24, 9:27:04 PM GMT+8 zmupdate 809 INF Got version: 1.36.35 zmupdate.pl '-
11/20/24, 9:27:03 PM GMT+8 zmupdate 809 INF Checking for updates zmupdate.pl '-
11/20/24, 9:27:03 PM GMT+8 zmwatch 804 INF Watchdog starting, pausing for 30 seconds zmwatch.pl '-
11/20/24, 9:27:03 PM GMT+8 zmfilter_2 800 INF Scanning for events using filter id '2' zmfilter.pl '-
11/20/24, 9:27:02 PM GMT+8 zmfilter_1 795 INF Scanning for events using filter id '1' zmfilter.pl '-
11/20/24, 9:27:01 PM GMT+8 zmdc 813 INF 'zmstats.pl' started at 24/11/20 21:27:01 zmdc.pl '-
11/20/24, 9:27:01 PM GMT+8 zmdc 766 INF 'zmstats.pl' starting at 24/11/20 21:27:01, pid = 813 zmdc.pl '-
11/20/24, 9:27:01 PM GMT+8 zmdc 809 INF 'zmupdate.pl -c' started at 24/11/20 21:27:01 zmdc.pl '-
11/20/24, 9:27:01 PM GMT+8 zmdc 766 INF 'zmupdate.pl -c' starting at 24/11/20 21:27:01, pid = 809 zmdc.pl '-
11/20/24, 9:27:00 PM GMT+8 zmdc 804 INF 'zmwatch.pl' started at 24/11/20 21:27:00 zmdc.pl '-
11/20/24, 9:27:00 PM GMT+8 zmdc 766 INF 'zmwatch.pl' starting at 24/11/20 21:27:00, pid = 804 zmdc.pl '-
11/20/24, 9:27:00 PM GMT+8 zmdc 800 INF 'zmfilter.pl --filter_id=2 --daemon' started at 24/11/20 21:27:00 zmdc.pl '-
11/20/24, 9:27:00 PM GMT+8 zmdc 766 INF 'zmfilter.pl --filter_id=2 --daemon' starting at 24/11/20 21:27:00, pid = 800 zmdc.pl '-
11/20/24, 9:27:00 PM GMT+8 zmdc 795 INF 'zmfilter.pl --filter_id=1 --daemon' started at 24/11/20 21:27:00 zmdc.pl '-
11/20/24, 9:27:00 PM GMT+8 zmdc 766 INF 'zmfilter.pl --filter_id=1 --daemon' starting at 24/11/20 21:27:00, pid = 795 zmdc.pl '-
11/20/24, 9:27:00 PM GMT+8 zmpkg 753 INF Single server configuration detected. Starting up services. zmpkg.pl '-
11/20/24, 9:27:00 PM GMT+8 zmdc 766 INF Socket should be open at /run/zm/zmdc.sock zmdc.pl '-
11/20/24, 9:26:59 PM GMT+8 zmdc 766 INF Server starting at 24/11/20 21:26:59 zmdc.pl '-
11/20/24, 9:26:57 PM GMT+8 zmpkg 753 INF Command: start zmpkg.pl '-
11/20/24, 9:26:57 PM GMT+8 zmpkg 753 INF Sanity checking States table... zmpkg.pl '-

This is the ZoneMinder execution log, again everything is ok

meren-den commented 6 days ago

Thank you! I'll try to start with the parameter -e FQDN="xxxxxxxxxxxxxxx.org" but I don't have FQDN and I'm using ZM on the local network. I tried to enter FQDN="localhost", but in this case Apache2 would not start due to the lack of certificates.

Nardo86 commented 6 days ago

In this case you can use the seflsigned option and remove the mapping for /sslcert/live and /sslcert/archive

docker run -d --name=ZoneMinder -p 10443:443/tcp -e TZ=Asia/Irkutsk -e SELFSIGNED=1 --shm-size=1.5g -v /docker/zoneminder/config:/config -v /docker/zoneminder/zmcache:/var/cache/zoneminder --restart always nardo86/zoneminder

give it a try and let me know, thanks

meren-den commented 6 days ago

Unfortunately, the problem persists. For some reason the file /run/zm/zmdc.sock is not created Использую Debian 12 Docker version 26.1.5+dfsg1, build a72d7cd

docker run -d \ --name=ZM_test \ -p 20443:443/tcp \ -e TZ=Asia/Irkutsk \ -e SELFSIGNED=1 \ --shm-size=1.5g \ -v /docker/test/config:/config \ -v /docker/test/zmcache:/var/cache/zoneminder \ --restart always \ nardo86/zoneminder

Снимок экрана 2024-11-20 в 22 07 40

Nardo86 commented 6 days ago

I'm sorry but I can't replicate the problem.. could it be a permissions problem of the folders you are passing to it? Try launching without any volume just to see if it still gives an error

docker run -d --name=ZM_test -p 20443:443/tcp -e TZ=Asia/Irkutsk -e SELFSIGNED=1 --shm-size=1.5g --restart always nardo86/zoneminder

meren-den commented 6 days ago

Thanks for the advice! But the problem, unfortunately, persists.

docker run -d\ --name=ZM_test \ -p 20443:443/tcp\ -e TZ=Asia/Irkutsk \ -e SELFSIGNED=1 \ --shm-size=1.5g \ --restart always \ nardo86/zoneminder

Снимок экрана 2024-11-21 в 00 00 35

Nardo86 commented 6 days ago

ok last two tests then I don't know what else to try, sorry

  1. try to report the container startup log, maybe the real error comes before the zoneminder startup

    docker run --name=ZM_test -p 20443:443/tcp -e TZ=Asia/Irkutsk -e SELFSIGNED=1 --shm-size=1.5g --restart always nardo86/zoneminder

  2. try running the container in privileged mode (it's not safe but in the past it helped me to unlock some containers that were giving strange errors)

    docker run -d --privileged --name=ZM_test -p 20443:443/tcp -e TZ=Asia/Irkutsk -e SELFSIGNED=1 --shm-size=1.5g --restart always nardo86/zoneminder

meren-den commented 5 days ago

Unfortunately, in both options the error persists. According to option 1, I send the magazine. In any case, thanks for wanting to help! Temporarily solved the problem in the following way: After restarting the container, I launch ZM via the API: curl -XPOST http://server/zm/api/states/change/start.json

--name=ZM_test \ -p 20443:443/tcp \ -e TZ=Asia/Irkutsk \ -e SELFSIGNED=1 \ --shm-size=1.5g \ --restart always \ nardo86/zoneminder

Current default time zone: 'Asia/Irkutsk' Local time is now: Thu Nov 21 09:21:10 +08 2024. Universal Time is now: Thu Nov 21 01:21:10 UTC 2024.

Check ZoneMinder version Installing new version Selecting previously unselected package zoneminder. (Reading database ... 24360 files and directories currently installed.) Preparing to unpack .../zoneminder_1.36.35~20241030.27-bullseye_amd64.deb ... Unpacking zoneminder (1.36.35~20241030.27-bullseye) ... Setting up zoneminder (1.36.35~20241030.27-bullseye) ... The cgi module is not enabled in apache2. I am enabling it using a2enmod cgi. apache2_invoke: Enable module cgi invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of restart. invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of stop. MySQL/MariaDB not found; assuming remote server. Processing triggers for mailcap (3.69) ... Considering dependency setenvif for ssl: Module setenvif already enabled Considering dependency mime for ssl: Module mime already enabled Considering dependency socache_shmcb for ssl: Enabling module socache_shmcb. Enabling module ssl. See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates. To activate the new configuration, you need to run: service apache2 restart Enabling module rewrite. To activate the new configuration, you need to run: service apache2 restart Enabling module headers. To activate the new configuration, you need to run: service apache2 restart Enabling module expires. To activate the new configuration, you need to run: service apache2 restart Enabling conf zoneminder. To activate the new configuration, you need to run: service apache2 reload Enabling site default-ssl. To activate the new configuration, you need to run: service apache2 reload Configuring MariaDBPath MariaDBPath configuration done Check MariaDB config Starting MariaDB database server: mariadbd. mysqld is alive mysqlshow: Access denied for user 'zmuser'@'localhost'

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): stty: 'standard input': Inappropriate ioctl for device stty: 'standard input': Inappropriate ioctl for device OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Enabled successfully! Reloading privilege tables.. ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] stty: 'standard input': Inappropriate ioctl for device New password: Re-enter new password: stty: 'standard input': Inappropriate ioctl for device Password updated successfully! Reloading privilege tables.. ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] ... Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] ... Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] - Dropping test database... ... Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] ... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB! Stopping MariaDB database server: mariadbd. Starting MariaDB database server: mariadbd. mysqld is alive MariaDB configuration done Set Php timezone Checking MSMTP configuration Set ServerName Setting /var/cache subfolders Starting Starting Apache httpd web server: apache2. [Thu Nov 21 09:21:41.237642 2024] [mpm_prefork:notice] [pid 710:tid 710] AH00163: Apache/2.4.62 (Debian) OpenSSL/1.1.1w configured -- resuming normal operations [Thu Nov 21 09:21:41.237820 2024] [core:notice] [pid 710:tid 710] AH00094: Command line: '/usr/sbin/apache2

Nardo86 commented 5 days ago

Thanks for your patience, at this point seeing that the machine creation occurs without errors and there are no permissions problems between host and container it seems that it is a zoneminder problem, perhaps related to the way I did the installation... can you tell the various steps you did to present the error? From what I understood you did a first installation, then you restarted the container (did you use the "docker container restart" command?) and at this point the container restarted but zoneminder was off? Did I understand correctly?

meren-den commented 5 days ago

I completed the installation, waited for the container to fully launch and immediately went to the ZM web interface. I did not restart the container. But if you restart the container later, the error persists. The only thing that helps is enabling ZM through the button in the upper right corner of the ZM web interface.

Nardo86 commented 5 days ago

Thank you again for all the feedback, I will do other tests trying to replicate the problem and understand how to solve it, searching on the internet in the ZoneMinder forums it has happened to others too but I couldn't find a definitive solution.. I will leave the issue open in case someone else wants to contribute

meren-den commented 5 days ago

Thanks for your work! You have the best image I've ever seen.