dlandon / zoneminder.machine.learning

Zoneminder Docker
GNU General Public License v2.0
320 stars 144 forks source link

Permission issues, ubuntu docker host. #90

Closed triDcontrols closed 3 years ago

triDcontrols commented 4 years ago

I read through all the closed issues and open ones for that matter, and I am seeing bit different results. my user id on my docker host has UID=1000 and GID=1000, this is what i used when mounting my nas mount point through /etc/fstab at location /mnt/nas-dvr it get's mounted, and zoneminder folders created, but when accessing https://docker:9443/zm, I get the

Cannot write to event folder /var/cache/zoneminder/events. Check that it exists and is owned by the web account user.

Here's the docker command I ran, copied and paste from dockerhub.

sudo docker run -d --name="Zoneminder" \
--net="bridge" \
--privileged="true" \
-p 9443:443/tcp \
-p 9532:9000/tcp \
-e TZ="America/Los_Angeles" \
-e SHMEM="50%" \
-e PUID="99" \
-e PGID="100" \
-e INSTALL_HOOK="0" \
-e INSTALL_FACE="0" \
-e INSTALL_TINY_YOLO="0" \
-e INSTALL_YOLO="0" \
-e MULTI_PORT_START="0" \
-e MULTI_PORT_END="0" \
-v "/home/user/docker-data/zoneminder":"/config":rw \
-v "/mnt/nas-dvr/zoneminder":"/var/cache/zoneminder":rw \
dlandon/zoneminder

I also tried setting PUID and PGID to 1000 and same result, cannot set ownership to www-data:www-data.

heres the output when I try to manually change ownership when connected to zoneminder container.

root@fe97673e386e:/# cd var/cache/
root@fe97673e386e:/var/cache# ls -l
total 28
drwxr-xr-x 3 root   root 4096 Apr  3 17:44 apache2
drwxr-xr-x 1 root   root 4096 Jul 24  2018 apt
drwxr-xr-x 1 root   root 4096 Apr 14 20:46 debconf
drwxr-xr-x 1 root   root 4096 Apr  3 17:54 fontconfig
drwx------ 1 root   root 4096 Apr 14 20:47 ldconfig
drwxr-xr-x 2 1000 1000    0 Apr 14 19:57 zoneminder
root@fe97673e386e:/var/cache# chown www-data:www-data /var/cache/zoneminder/
root@fe97673e386e:/var/cache# ls -l
total 28
drwxr-xr-x 3 root   root 4096 Apr  3 17:44 apache2
drwxr-xr-x 1 root   root 4096 Jul 24  2018 apt
drwxr-xr-x 1 root   root 4096 Apr 14 20:46 debconf
drwxr-xr-x 1 root   root 4096 Apr  3 17:54 fontconfig
drwx------ 1 root   root 4096 Apr 14 20:47 ldconfig
drwxr-xr-x 2 1000 1000    0 Apr 14 19:57 zoneminder
root@fe97673e386e:/var/cache#

The log output when container is restarted.

*** 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...,
Apr 14 21:01:31 96ca99987076 syslog-ng[16]: syslog-ng starting up; version='3.13.2',
*** Running /etc/my_init.d/20_apt_update.sh...,
Performing updates...,
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease,
Hit:2 http://ppa.launchpad.net/iconnor/zoneminder-1.34/ubuntu bionic InRelease,
Hit:3 http://security.ubuntu.com/ubuntu bionic-security InRelease,
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease,
Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease,
Hit:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease,
Reading package lists...,
Reading package lists...,
Building dependency tree...,
Reading state information...,
Calculating upgrade...,
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.,
Reading package lists...,
Building dependency tree...,
Reading state information...,
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.,
*** 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,
Event Server version: '5.11-Docker'.,
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,
chmod: cannot access '/config/control/*': No such file or directory,
Using existing data directory for events,
Correcting /var/cache/zoneminder/events ownership...,
Correcting /var/cache/zoneminder/events permissions...,
Using existing data directory for images,
Correcting /var/cache/zoneminder/images ownership...,
Correcting /var/cache/zoneminder/images permissions...,
Using existing data directory for temp,
Correcting /var/cache/zoneminder/temp ownership...,
Correcting /var/cache/zoneminder/temp permissions...,
Using existing data directory for cache,
Correcting /var/cache/zoneminder/cache ownership...,
Correcting /var/cache/zoneminder/cache permissions...,
no crontab for root,
Setting shared memory to : 50% of 6965920 bytes,
Starting services...,
 * Starting MariaDB database server mysqld,
   ...done.,
Apr 14 21:01:40 96ca99987076 /etc/mysql/debian-start[774]: Upgrading MySQL tables if necessary.,
Apr 14 21:01:40 96ca99987076 /etc/mysql/debian-start[778]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored,
Apr 14 21:01:40 96ca99987076 /etc/mysql/debian-start[778]: Looking for 'mysql' as: /usr/bin/mysql,
Apr 14 21:01:40 96ca99987076 /etc/mysql/debian-start[778]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck,
Apr 14 21:01:40 96ca99987076 /etc/mysql/debian-start[778]: This installation of MySQL is already upgraded to 10.1.44-MariaDB, use --force if you still need to run mysql_upgrade,
Apr 14 21:01:40 96ca99987076 /etc/mysql/debian-start[785]: Checking for insecure root accounts.,
Apr 14 21:01:40 96ca99987076 /etc/mysql/debian-start[789]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables,
,
Database already at version 1.34.9, 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:,
Apr 14 21:01:42 96ca99987076 zmpkg[857]: INF [Sanity checking States table...],
Apr 14 21:01:42 96ca99987076 zmpkg[857]: INF [Command: start],
Apr 14 21:01:46 96ca99987076 zmdc[869]: INF [Server starting at 20/04/14 21:01:46],
Apr 14 21:01:47 96ca99987076 zmdc[869]: INF [Socket should be open at /var/run/zm/zmdc.sock],
Apr 14 21:01:47 96ca99987076 zmpkg[857]: INF [Single server configuration detected. Starting up services.],
Apr 14 21:01:47 96ca99987076 zmdc[898]: INF ['zmfilter.pl --filter_id=1 --daemon' started at 20/04/14 21:01:47],
Apr 14 21:01:47 96ca99987076 zmdc[869]: INF ['zmfilter.pl --filter_id=1 --daemon' starting at 20/04/14 21:01:47, pid = 898],
Apr 14 21:01:47 96ca99987076 zmdc[869]: INF ['zmfilter.pl --filter_id=2 --daemon' starting at 20/04/14 21:01:47, pid = 903],
Apr 14 21:01:47 96ca99987076 zmdc[903]: INF ['zmfilter.pl --filter_id=2 --daemon' started at 20/04/14 21:01:47],
Apr 14 21:01:47 96ca99987076 zmdc[907]: INF ['zmwatch.pl' started at 20/04/14 21:01:47],
Apr 14 21:01:47 96ca99987076 zmdc[869]: INF ['zmwatch.pl' starting at 20/04/14 21:01:47, pid = 907],
Apr 14 21:01:48 96ca99987076 zmdc[869]: INF ['zmupdate.pl -c' starting at 20/04/14 21:01:48, pid = 911],
Apr 14 21:01:48 96ca99987076 zmdc[911]: INF ['zmupdate.pl -c' started at 20/04/14 21:01:48],
Apr 14 21:01:48 96ca99987076 zmdc[869]: INF ['zmtelemetry.pl' starting at 20/04/14 21:01:48, pid = 915],
Apr 14 21:01:48 96ca99987076 zmdc[915]: INF ['zmtelemetry.pl' started at 20/04/14 21:01:48],
Apr 14 21:01:48 96ca99987076 zmdc[869]: INF ['zmstats.pl' starting at 20/04/14 21:01:48, pid = 919],
Apr 14 21:01:48 96ca99987076 zmdc[919]: INF ['zmstats.pl' started at 20/04/14 21:01:48],
ZoneMinder started successfully,
,
*** Running /etc/my_init.d/999_advanced_script.sh...,
*** Booting runit daemon...,
*** Runit started as PID 922,
Apr 14 21:01:48 96ca99987076 cron[925]: (CRON) INFO (pidfile fd = 3),
Apr 14 21:01:48 96ca99987076 cron[925]: (CRON) INFO (Skipping @reboot jobs -- not system startup),
Apr 14 21:01:53 96ca99987076 zmfilter_2[903]: INF [Scanning for events using filter id '2'],
Apr 14 21:01:53 96ca99987076 zmfilter_1[898]: INF [Scanning for events using filter id '1'],
Apr 14 21:01:53 96ca99987076 zmstats[919]: INF [Stats Daemon starting in 30 seconds],
Apr 14 21:01:53 96ca99987076 zmwatch[907]: INF [Watchdog starting, pausing for 30 seconds],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Cannot write to event folder /var/cache/zoneminder/events. Check that it exists and is owned by the web account user.],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking skins/classic/css/base/skin.css to skins_classic_css_base_skin-base-1586018432.css],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking skins/classic/css/base/views/console.css to skins_classic_css_base_views_console-base-1586018432.css],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking skins/classic/js/dateTimePicker/jquery-ui-timepicker-addon.css to skins_classic_js_dateTimePicker_jquery-ui-timepicker-addon-base-1586018432.css],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking skins/classic/js/jquery-ui-1.12.1/jquery-ui.structure.min.css to skins_classic_js_jquery-ui-1.12.1_jquery-ui.structure.min-base-1586018432.css],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking js/Server.js to js_Server-base-1586018432.js],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking skins/classic/views/js/state.js to skins_classic_views_js_state-base-1586018432.js],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking skins/classic/js/base.js to skins_classic_js_base-base-1586018432.js],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking skins/classic/js/skin.js to skins_classic_js_skin-base-1586018432.js],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking js/logger.js to js_logger-base-1586018432.js],
Apr 14 21:02:14 96ca99987076 web_php[842]: WAR [Failed linking skins/classic/views/js/console.js to skins_classic_views_js_console-base-1586018432.js],
D34DC3N73R commented 4 years ago

mount a new volume in the container /mnt/nas-dvr/zoneminder:/nas-dvr or however you want it, and then define the new storage location /nas-dvr in options > storage.

RHCPNG commented 4 years ago

Hi @triDcontrols

Did you resolve this issue with the solution provided by D34DC3N73R? I can't get a mount point to work.