Zoneminder can t connect to local mysql server through socket /var/run/mysqld/mysqld sock

Zoneminder can t connect to local mysql server through socket /var/run/mysqld/mysqld sock

Zoneminder can t connect to local mysql server through socket /var/run/mysqld/mysqld sock

    • #1

    Using dlandon/zoneminder docker, I run into a DNS issue. Starting this docker gives me this log:

    *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh..., *** Running /etc/my_init.d/05_set_the_time.sh..., *** Running /etc/my_init.d/06_set_php_time.sh..., *** Running /etc/my_init.d/10_syslog-ng.init..., Nov 13 21:59:49 zoneminder syslog-ng[16]: syslog-ng starting up; version='3.13.2', *** Running /etc/my_init.d/20_apt_update.sh..., Performing updates..., Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease, Temporary failure resolving 'archive.ubuntu.com', Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease, Temporary failure resolving 'security.ubuntu.com', Err:3 http://ppa.launchpad.net/iconnor/zoneminder-1.34/ubuntu bionic InRelease, Temporary failure resolving 'ppa.launchpad.net', Err:4 http://ppa.launchpad.net/jonathonf/ffmpeg-4/ubuntu bionic InRelease, Temporary failure resolving 'ppa.launchpad.net', Err:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease, Temporary failure resolving 'archive.ubuntu.com', Err:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease, Temporary failure resolving 'ppa.launchpad.net', Err:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease, Temporary failure resolving 'archive.ubuntu.com', Reading package lists..., W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com', W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com', W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'archive.ubuntu.com', W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com', W: Failed to fetch http://ppa.launchpad.net/iconnor/zoneminder-1.34/ubuntu/dists/bionic/InRelease Temporary failure resolving 'ppa.launchpad.net', W: Failed to fetch http://ppa.launchpad.net/jonathonf/ffmpeg-4/ubuntu/dists/bionic/InRelease Temporary failure resolving 'ppa.launchpad.net', W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/bionic/InRelease Temporary failure resolving 'ppa.launchpad.net', W: Some index files failed to download. They have been ignored, or old ones used instead., Warning: Unable to update! Check Internet connection., *** Running /etc/my_init.d/30_gen_ssl_keys.sh..., using existing keys in "/config/keys", *** Running /etc/my_init.d/40_firstrun.sh..., Using existing conf folder, le zm.conf already moved, Moving zmeventnotification.ini, Moving secrets.ini, Moving opencv.sh, Moving debug_opencv.sh, Moving the event notification server, Moving the pushover api, Using existing ssmtp folder, Using existing mysql database folder, Copy /config/control/ scripts to /usr/share/perl5/ZoneMinder/Control/, Copy /config/conf/ scripts to /etc/zm/conf.d/, Creating symbolink links, usermod: no changes, usermod: group '995' does not exist, usermod: no changes, Using existing data directory for events, Using existing data directory for images, Using existing data directory for temp, Using existing data directory for cache, no crontab for root, Setting shared memory to : 50% of 16303828 bytes, Starting services..., * Starting MariaDB database server mysqld, ...done., Nov 13 21:59:54 zoneminder /etc/mysql/debian-start[352]: Upgrading MySQL tables if necessary., Nov 13 21:59:54 zoneminder /etc/mysql/debian-start[356]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored, Nov 13 21:59:54 zoneminder /etc/mysql/debian-start[356]: Looking for 'mysql' as: /usr/bin/mysql, Nov 13 21:59:54 zoneminder /etc/mysql/debian-start[356]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck, Nov 13 21:59:54 zoneminder /etc/mysql/debian-start[356]: This installation of MySQL is already upgraded to 10.1.47-MariaDB, use --force if you still need to run mysql_upgrade, Nov 13 21:59:54 zoneminder /etc/mysql/debian-start[363]: Checking for insecure root accounts., Nov 13 21:59:54 zoneminder /etc/mysql/debian-start[367]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables, , Database already at version 1.34.22, update skipped., , , Freshening configuration in database, Migratings passwords, if any..., Loading config from DB 230 entries, Saving config to DB 230 entries, * Starting Apache httpd web server apache2, * , Starting ZoneMinder:, Nov 13 21:59:56 zoneminder zmpkg[435]: INF [Sanity checking States table...], Nov 13 21:59:56 zoneminder zmpkg[435]: INF [Command: start], DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) at /usr/share/perl5/ZoneMinder/Database.pm line 110., DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) at /usr/share/perl5/ZoneMinder/Database.pm line 110., Nov 13 21:59:57 zoneminder zmdc[442]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) error val:], DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) at /usr/share/perl5/ZoneMinder/Database.pm line 110., Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 96., BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147., Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33., BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33., Compilation failed in require at /usr/bin/zmdc.pl line 67., BEGIN failed--compilation aborted at /usr/bin/zmdc.pl line 67., Nov 13 21:59:57 zoneminder zmdc[442]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) error val:], Nov 13 21:59:57 zoneminder zmpkg[435]: ERR [Unable to run "sudo -u www-data /usr/bin/zmdc.pl check", output is "", status is 255], neMinder failed to start, , *** /etc/my_init.d/40_firstrun.sh failed with status 1, , *** Killing all processes..., Nov 13 21:59:57 zoneminder syslog-ng[16]: syslog-ng shutting down; version='3.13.2',

    Alles anzeigen

    The container uses the bridged network without any modification. I sticked to the standard configuration recommended by the author.

    docker run -d --name="Zoneminder" \ --net="bridge" \ --privileged="true" \ -p 8443:443/tcp \ -p 8080:80/tcp \ -p 9000:9000/tcp \ -e TZ="Europe/Berlin" \ -e SHMEM="50%" \ -e PUID="1000" \ -e PGID="995" \ -e INSTALL_HOOK="0" \ -e INSTALL_FACE="0" \ -e INSTALL_TINY_YOLOV3="0" \ -e INSTALL_YOLOV3="0" \ -e INSTALL_TINY_YOLOV4="0" \ -e INSTALL_YOLOV4="0" \ -e MULTI_PORT_START="0" \ -e MULTI_PORT_END="0" \ -v "/mnt/Zoneminder":"/config":rw \ -v "/mnt/Zoneminder/data":"/var/cache/zoneminder":rw \ dlandon/zoneminder

    Alles anzeigen

    Any suggestions how to resolve the DNS errors?

    • #2

    You have an issue with the group id "955" and need to change it. Watch some TechnoDadLife YouTube videos on installing docker containers on OMV. PUID and PGID parameters need to be adapted for most docker containers. He explains it very well.

    Not sure you have other issues, too, but I'd fix that one first...

    • #3

    995 is group docker and works fine for more than 20 other containers. I only have this issue with zoneminder.

    • #4

    Hmh, there still is a failure message for this in your log-file. Something's not right. I guess it's permissions.

    Do all your application data folders really sit under /mnt, i.e. /mnt/zoneminder here, for all your docker containers? No need to adapt those paths from dlandon's example configuration?

    • #5

    Hello,

    I've got the same problem from weeks, with no help from dlandon who is not on OMV. I've written issue on his github.

    --- version: "2" services: zoneminder: container_name: zoneminder image: dlandon/zoneminder restart: unless-stopped ports: - 82:80/tcp - 9100:9000/tcp network_mode: "bridge" privileged: true environment: - TZ=Europe/Paris - PGID=100 - PUID=1000 - SHMEM=50% - INSTALL_HOOK=0 - INSTALL_FACE=0 - INSTALL_TINY_YOLOV3=0 - INSTALL_YOLOV3=0 - INSTALL_TINY_YOLOV4=0 - INSTALL_YOLOV4=0 - MULTI_PORT_START=0 - MULTI_PORT_END=0 volumes: - /srv/dev-disk-by-label-4ToNas/Appdata/zoneminder:/config:rw - /srv/dev-disk-by-label-4ToNas/Surveillance:/var/cache/zoneminder:rw

    Alles anzeigen

    and my log ( no problem with pgid) :

    *** Running /etc/my_init.d/05_set_the_time.sh..., *** Running /etc/my_init.d/06_set_php_time.sh..., *** Running /etc/my_init.d/10_syslog-ng.init..., Nov 14 18:01:10 8a6b476cc715 syslog-ng[16]: syslog-ng starting up; version='3.13.2', *** Running /etc/my_init.d/20_apt_update.sh..., Performing updates..., Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease, Temporary failure resolving 'archive.ubuntu.com', Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease, Temporary failure resolving 'security.ubuntu.com', Err:3 http://ppa.launchpad.net/iconnor/zoneminder-1.34/ubuntu bionic InRelease, Temporary failure resolving 'ppa.launchpad.net', Err:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease, Temporary failure resolving 'archive.ubuntu.com', Err:5 http://ppa.launchpad.net/jonathonf/ffmpeg-4/ubuntu bionic InRelease, Temporary failure resolving 'ppa.launchpad.net', Err:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease, Temporary failure resolving 'ppa.launchpad.net', Err:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease, Temporary failure resolving 'archive.ubuntu.com', Reading package lists..., W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com', W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com', W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'archive.ubuntu.com', W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com', W: Failed to fetch http://ppa.launchpad.net/iconnor/zoneminder-1.34/ubuntu/dists/bionic/InRelease Temporary failure resolving 'ppa.launchpad.net', W: Failed to fetch http://ppa.launchpad.net/jonathonf/ffmpeg-4/ubuntu/dists/bionic/InRelease Temporary failure resolving 'ppa.launchpad.net', W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/bionic/InRelease Temporary failure resolving 'ppa.launchpad.net', W: Some index files failed to download. They have been ignored, or old ones used instead., Warning: Unable to update! Check Internet connection., *** Running /etc/my_init.d/30_gen_ssl_keys.sh..., using existing keys in "/config/keys", *** Running /etc/my_init.d/40_firstrun.sh..., Using existing conf folder, le zm.conf already moved, Moving zmeventnotification.ini, Moving secrets.ini, Moving opencv.sh, Moving debug_opencv.sh, Moving the event notification server, Moving the pushover api, Using existing ssmtp folder, Using existing mysql database folder, Copy /config/control/ scripts to /usr/share/perl5/ZoneMinder/Control/, Copy /config/conf/ scripts to /etc/zm/conf.d/, Creating symbolink links, usermod: no changes, usermod: no changes, usermod: no changes, Using existing data directory for events, Correcting /var/cache/zoneminder/events permissions..., Using existing data directory for images, Correcting /var/cache/zoneminder/images permissions..., Using existing data directory for temp, Correcting /var/cache/zoneminder/temp permissions..., Using existing data directory for cache, Correcting /var/cache/zoneminder/cache permissions..., no crontab for root, Setting shared memory to : 50% of 3898336 bytes, Starting services..., * Starting MariaDB database server mysqld, ...done., Nov 14 18:01:15 8a6b476cc715 /etc/mysql/debian-start[357]: Upgrading MySQL tables if necessary., Nov 14 18:01:15 8a6b476cc715 /etc/mysql/debian-start[361]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored, Nov 14 18:01:15 8a6b476cc715 /etc/mysql/debian-start[361]: Looking for 'mysql' as: /usr/bin/mysql, Nov 14 18:01:15 8a6b476cc715 /etc/mysql/debian-start[361]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck, Nov 14 18:01:15 8a6b476cc715 /etc/mysql/debian-start[361]: This installation of MySQL is already upgraded to 10.1.47-MariaDB, use --force if you still need to run mysql_upgrade, Nov 14 18:01:15 8a6b476cc715 /etc/mysql/debian-start[368]: Checking for insecure root accounts., Nov 14 18:01:15 8a6b476cc715 /etc/mysql/debian-start[372]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables, , Database already at version 1.34.22, update skipped., , , Freshening configuration in database, Migratings passwords, if any..., Loading config from DB 230 entries, Saving config to DB 230 entries, * Starting Apache httpd web server apache2, * , Starting ZoneMinder:, Nov 14 18:01:16 8a6b476cc715 zmpkg[440]: INF [Sanity checking States table...], Nov 14 18:01:16 8a6b476cc715 zmpkg[440]: INF [Command: start], DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) at /usr/share/perl5/ZoneMinder/Database.pm line 110., DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) at /usr/share/perl5/ZoneMinder/Database.pm line 110., DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) at /usr/share/perl5/ZoneMinder/Database.pm line 110., Nov 14 18:01:17 8a6b476cc715 zmdc[447]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) error val:], Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 96., BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147., Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33., BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33., Compilation failed in require at /usr/bin/zmdc.pl line 67., BEGIN failed--compilation aborted at /usr/bin/zmdc.pl line 67., Nov 14 18:01:17 8a6b476cc715 zmdc[447]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) error val:], Nov 14 18:01:17 8a6b476cc715 zmpkg[440]: ERR [Unable to run "sudo -u www-data /usr/bin/zmdc.pl check", output is "", status is 255], neMinder failed to start, , *** /etc/my_init.d/40_firstrun.sh failed with status 1, , *** Killing all processes..., Nov 14 18:01:17 8a6b476cc715 syslog-ng[16]: syslog-ng shutting down; version='3.13.2',

    Alles anzeigen

    I don't know how to investigate ...

    thanks for your help too.

    Fabrice

    • #6

    is owned by docker:docker

    I checked with group 100 (users), no issue regarding group any more, but still unreachable ppa's.

    Checking those manually shows availability, so there might be some name resolving issue. I tried setting up a different bridged network as well; specified my router and google as DNS, still the same thing.

    • #7

    From FabriceC01 's post, it seems you are not the only one with this issue. Does not seem to be OMV-specific though. As such, probably

    https://github.com/dlandon/zoneminder/issues

    is the better place to go. I'd scan through some of the recently opened and closed issues there and look for similar problems and hints of solutions.

    • #8

    Hello,

    It seems that there're a lot of network problems in several docker containers images with no access to DNS.

    I saw a solution which seems to works in this thread. I've tried succesfully on my zoneminder container :

    going into the container (console) and running chmod 0644 /etc/resolv.conf?

    It was difficult but I had time to do the command in the portainer console before the "Killing all processes".

    Maybe you can try ...

    Is there a solution to applicate it more easily (in particular when the container stop quickly before entering in the console) ?

    but it's only the first problem and there's the second with mysql (line 83 of your log) and I can't really investigate because of the processes killing. Is it possible to desactivate it and how ? I would like to test if Mariadb is really running.

    Fabrice

    • #9

    Check on using an external database until this issue is fixed. Exporting and importing the database should be a piece of cake.

    DB-configuration is done in

    zm.default within the conf-folder. Create a backup of this configuration in advance. Files will be created after first unsuccessful run.

    Edit: A new version was published today, still same issue.

    According to this post, which has a similar issue, a new setup should do it. I'll try to use a custom user script do solve the DNS-issue at the first start of this container.

    • #10

    Hello,

    things are progressing

    I've identified 2 problems :

    • One with the name resolving on the beginning.
      One with the mysql connection at the end.

    Thanks to the last change of Dan Landon image which permit me to stop the container before the killing (NO_START_ZM mode), I could debug and with some Internet research I found that I have to do this command to solve the first problem :

    Code: Select all

    chmod 0644 /etc/resolv.conf

    the apt install is OK after.


    for the second one which is a permission problem again I need to do :

    Code: Select all

    chmod 0777 /var/run/mysqld/mysqld.sock

    after that zoneminder start succesfully.


    I would like to know the reason of these problems because Dan don't want to modify his image for now and I can't restart my container without redo all of this.


    Is there someone who have an idea of this problem source ?


    thanks in advance.

    Fabrice

    • #11

    Any news on how to start the MySQL with correct permissions?