Cannot write to content dirs('events','images')

Forum for questions and support relating to the 1.30.x releases only.
Locked
Prapovednik
Posts: 6
Joined: Tue Jan 22, 2019 2:40 pm

Cannot write to content dirs('events','images')

Post by Prapovednik »

Dear friends, I need Your help, please.
Zoneminder v1.30.4, running on Debian 9 and all installed today.

I have 10TB (4x5TB) RAID10 created with mdadm utility which I want to use as a drive for ZM events (/mnt/sdb1).

I have installed and passed all steps by these instructions:
https://zoneminder.readthedocs.io/en/st ... drive.html
https://wiki.zoneminder.com/Debian_9_64 ... e_Easy_Way
https://wiki.zoneminder.com/Common_Issu ... ive_or_NAS

I do have a folder 'zoneminder/events and zoneminder/images' in /mnt/sdb1 and I even can create/delete files inside of them. But I have lots of errors in Zoneminder log:
Date/Time Component Server PID Level Message File Line
2019-01-22 09:46:51.744539 web_php 858 ERR Cannot write to content dirs('events','images'). Check that these exist and are owned by the web account user /usr/share/zoneminder/www/index.php 159
2019-01-22 09:46:50.967323 web_php 860 ERR Cannot write to content dirs('events','images'). Check that these exist and are owned by the web account user /usr/share/zoneminder/www/index.php 159

Also I mentioned the events stores here: /usr/share/zoneminder/www/events and I used that command: ln -s /mnt/sdb1/zoneminder/events /usr/share/zoneminder/www/events

What should I do? ZOneminder doesn't use /mnt/sdb1 folder to save data.
mikb
Posts: 586
Joined: Mon Mar 25, 2013 12:34 pm

Re: Cannot write to content dirs('events','images')

Post by mikb »

When you say "I can create...", who is "I" ... root, an ordinary user, or otherwise? It sounds like you might have a permissions problem.

Maybe the hint is the 2nd half of the error message :- "and are owned by the web account user"

What does "ls -la /usr/share/zoneminder/" "ls -la /usr/share/zoneminder/events" and "ls -la /usr/share/zoneminder/images" show?

Mine show everything owned by "apache.apache", but I'm on Slackware and running an older version of ZM, so advice may differ for your system.
Prapovednik
Posts: 6
Joined: Tue Jan 22, 2019 2:40 pm

Re: Cannot write to content dirs('events','images')

Post by Prapovednik »

Yes, I say I - I mean root,

root@srv-dvr:/# ls -la /usr/share/zoneminder/
total 24
drwxr-xr-x 4 www-data www-data 4096 Jan 22 02:27 .
drwxr-xr-x 279 root root 12288 Jan 22 03:43 ..
drwxr-xr-x 2 www-data www-data 4096 Jan 22 02:27 db
drwxr-xr-x 14 www-data www-data 4096 Jan 22 09:43 www

root@srv-dvr:/# ls -la /usr/share/zoneminder/events
ls: cannot access '/usr/share/zoneminder/events': No such file or directory

root@srv-dvr:/# ls -la /usr/share/zoneminder/images
ls: cannot access '/usr/share/zoneminder/images': No such file or directory

As I wrote in first topic: "images" are placed here: "/usr/share/zoneminder/www/images" and "events" are here: "/usr/share/zoneminder/www/events" (but it's not me who changed the path).

root@srv-dvr:/# ls -la /usr/share/zoneminder/www/images
lrwxrwxrwx 1 root root 27 Jan 22 09:43 /usr/share/zoneminder/www/images -> /mnt/sdb1/zoneminder/images

root@srv-dvr:/# ls -la /usr/share/zoneminder/www/events
total 16
drwxr-xr-x 4 www-data www-data 4096 Jan 22 10:03 .
drwxr-xr-x 14 www-data www-data 4096 Jan 22 09:43 ..
drwxr-xr-x 3 www-data www-data 4096 Jan 22 09:25 2
drwxr-xr-x 3 www-data www-data 4096 Jan 22 08:39 3
lrwxrwxrwx 1 www-data www-data 1 Jan 22 07:08 Stroyka -> 2
Prapovednik
Posts: 6
Joined: Tue Jan 22, 2019 2:40 pm

Re: Cannot write to content dirs('events','images')

Post by Prapovednik »

I decided to move to Ubuntu.
Fortunately, the problem with folder redirection is solved, but I have a problem with cameras - they are disappeared. I will continue in another topic. Thanks for all involved ))

Admin, please, close this thread.
mikb
Posts: 586
Joined: Mon Mar 25, 2013 12:34 pm

Re: Cannot write to content dirs('events','images')

Post by mikb »

Prapovednik wrote: Wed Jan 23, 2019 7:23 am Yes, I say I - I mean root,
Ah well, a lot of things work when you are root, which fail when you are an ordinary user. This is why the permissions need to be correct. Running and testing as root is not a good solution.

Apologies for the ls -la example error, didn't notice your extra "www" there!

Code: Select all

root@srv-dvr:/# ls -la /usr/share/zoneminder/www/events
total 16
drwxr-xr-x  4 www-data www-data 4096 Jan 22 10:03 .
drwxr-xr-x 14 www-data www-data 4096 Jan 22 09:43 ..
drwxr-xr-x  3 www-data www-data 4096 Jan 22 09:25 2
drwxr-xr-x  3 www-data www-data 4096 Jan 22 08:39 3
lrwxrwxrwx  1 www-data www-data    1 Jan 22 07:08 Stroyka -> 2

That looks in order to me, clearly ZoneMinder has been creating things in there (a camera ID number 2, named "Stroyka") so it must have been able to write in there at some point.
Prapovednik
Posts: 6
Joined: Tue Jan 22, 2019 2:40 pm

Re: Cannot write to content dirs('events','images')

Post by Prapovednik »

mikb wrote: Wed Jan 23, 2019 5:25 pm ....
Don't apologise, my friend, appreciated much for your effort.
I reinstalled to Ubuntu, have had some headache also, but spending 4-5 hours I, at least, have working zoneminder environment )))) What can I say: following Ubuntu instructions you have more chance to had everything work despite of Debian (because of I 100% followed all instructions, but had troubles). And I re-installed Debian with ZM several times, but no luck.

Dear Mikb, I wish You all the best and thanks again for your willingness to help!
pepe123
Posts: 1
Joined: Fri Aug 23, 2019 2:17 pm

Re: Cannot write to content dirs('events','images')

Post by pepe123 »

Hi All,

I'm new in Zoneminder and this forum. I have a similar issue.

My current set up is:
- Raspberry Pi with just 1 camera. Running zoneminder 1.30.
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"

I moved 'events' and 'images' folder to a pendrive adding the parameters ZM_DIR_EVENTS and ZM_DIR_IMAGES in zm.con file. I made www-data owner in both folders.

The log in zm says "Cannot write to content dirs('./media/pi/external/zm/events','./media/pi/external/zm/images')" but I can see events recorded (I can also reproduce them). So even if there is a error message, seems it's working. How can it be?

Thanks in advance!
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Cannot write to content dirs('events','images')

Post by bbunge »

pepe123 wrote: Fri Aug 23, 2019 2:28 pm Hi All,

I'm new in Zoneminder and this forum. I have a similar issue.

My current set up is:
- Raspberry Pi with just 1 camera. Running zoneminder 1.30.
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"

I moved 'events' and 'images' folder to a pendrive adding the parameters ZM_DIR_EVENTS and ZM_DIR_IMAGES in zm.con file. I made www-data owner in both folders.

The log in zm says "Cannot write to content dirs('./media/pi/external/zm/events','./media/pi/external/zm/images')" but I can see events recorded (I can also reproduce them). So even if there is a error message, seems it's working. How can it be?

Thanks in advance!
Use the systemd mount procedure from the zm Ubuntu wiki. Will work for debian. Don't change the zm.conf
Locked