ZM trying to write to root dir

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
jaeger1957
Posts: 6
Joined: Wed Oct 23, 2019 11:35 pm

ZM trying to write to root dir

Post by jaeger1957 » Thu Oct 24, 2019 12:17 am

I'm running ZM 1.32.3 on Linux Mint 19.2, followed the installation guide for Bionic, things seemed to go well. Was able to find tips to be able to get video from Reolink IP cameras, hear audio just fine.

When I try to record from the cameras, I see events come up in the console web page, but I can't pull up the videos. When I look at the log, I see this:

2019-10-23 15:32:35 zma_m4 12327 ERR Can't open /3574/snapshot.jpg: No such file or directory zm_image.cpp 961
2019-10-23 15:32:35 zma_m4 12327 INF Front yard north: 001 - Opening new event 3574, section start zm_monitor.cpp 1482
2019-10-23 15:32:35 zma_m4 12327 ERR Failed opening video stream zm_event.cpp 215
2019-10-23 15:32:35 zma_m4 12327 ERR Failed creating mp4 file: /3574/3574-video.mp4 zm_video.cpp 179
2019-10-23 15:32:35 zma_m4 12327 ERR Can't fopen /3574/.3574: No such file or directory zm_event.cpp 188
2019-10-23 15:32:35 zma_m4 12327 ERR Can't mkdir /3574: Permission denied zm_event.cpp 180

It looks like ZM is trying to write to the root directory. To test this, I opened up write permissions on the root directory and the directories and files were created. I can't tell where in the configuration it is pointing to the root directory. I was looking at the documentation, and it indicated that I should look under Options > Paths, but I don't find any Paths item under options in the web GUI.

Can someone direct me to where I can correct this path to store the video in the correct location?

Thanks!

kitkat
Posts: 88
Joined: Sun Jan 27, 2019 5:17 pm

Re: ZM trying to write to root dir

Post by kitkat » Thu Oct 24, 2019 9:40 am

You could try looking at the files in /etc/zm/conf.d, and/or at Options->Storage in the console.

jaeger1957
Posts: 6
Joined: Wed Oct 23, 2019 11:35 pm

Re: ZM trying to write to root dir

Post by jaeger1957 » Thu Oct 24, 2019 10:48 pm

I still see nothing in either of those locations that would suggest that ZM should try to write to root:

$ egrep -v '^$|^#' /etc/zm/conf.d/*.conf | less
/etc/zm/conf.d/01-system-paths.conf:ZM_DIR_EVENTS=/var/cache/zoneminder/events
/etc/zm/conf.d/01-system-paths.conf:ZM_DIR_IMAGES=/var/cache/zoneminder/images
/etc/zm/conf.d/01-system-paths.conf:ZM_DIR_SOUNDS=sounds
/etc/zm/conf.d/01-system-paths.conf:ZM_DIR_EXPORTS=/tmp/zm
/etc/zm/conf.d/01-system-paths.conf:ZM_PATH_ZMS=/zm/cgi-bin/nph-zms
/etc/zm/conf.d/01-system-paths.conf:ZM_PATH_MAP=/dev/shm
/etc/zm/conf.d/01-system-paths.conf:ZM_PATH_SOCKS=/var/run/zm
/etc/zm/conf.d/01-system-paths.conf:ZM_PATH_LOGS=/var/log/zm
/etc/zm/conf.d/01-system-paths.conf:ZM_PATH_SWAP=/tmp/zm
/etc/zm/conf.d/01-system-paths.conf:ZM_PATH_ARP="/usr/sbin/arp"
/etc/zm/conf.d/zm.conf:ZM_PATH_DATA=/usr/share/zoneminder
/etc/zm/conf.d/zm.conf:ZM_PATH_BIN=/usr/bin
/etc/zm/conf.d/zm.conf:ZM_PATH_LIB=/usr/lib/x86_64-linux-gnu
/etc/zm/conf.d/zm.conf:ZM_PATH_CONF=/etc/zm
/etc/zm/conf.d/zm.conf:ZM_PATH_WEB=/usr/share/zoneminder/www
/etc/zm/conf.d/zm.conf:ZM_PATH_CGI=/usr/lib/zoneminder/cgi-bin
/etc/zm/conf.d/zm.conf:ZM_WEB_USER=www-data
/etc/zm/conf.d/zm.conf:ZM_WEB_GROUP=www-data
/etc/zm/conf.d/zm.conf:ZM_DB_TYPE=mysql
/etc/zm/conf.d/zm.conf:ZM_DB_HOST=localhost
/etc/zm/conf.d/zm.conf:ZM_DB_NAME=zm
/etc/zm/conf.d/zm.conf:ZM_DB_USER=zmuser
/etc/zm/conf.d/zm.conf:ZM_DB_PASS=zmpass
/etc/zm/conf.d/zm.conf:ZM_DB_SSL_CA_CERT=
/etc/zm/conf.d/zm.conf:ZM_DB_SSL_CLIENT_KEY=
/etc/zm/conf.d/zm.conf:ZM_DB_SSL_CLIENT_CERT=
/etc/zm/conf.d/zm.conf:ZM_SERVER_HOST=
/etc/zm/conf.d/zm.conf:ZM_DIR_EVENTS=/var/cache/zoneminder/events
/etc/zm/conf.d/zm.conf:ZM_DIR_IMAGES=/var/cache/zoneminder/images

Options > Storage only shows the default:

1 Default /var/cache/zoneminder/events local Shallow Default 676.33GB of 5.41TB

So I'm no closer to a resolution yet. Any other suggestions where this might be set?

jaeger1957
Posts: 6
Joined: Wed Oct 23, 2019 11:35 pm

Re: ZM trying to write to root dir

Post by jaeger1957 » Sat Oct 26, 2019 4:29 am

Update: When I open up permissions for ZM to write to the root dir and it creates the files, the GUI says it can't display the recordings, but they are readable .mp4 files that will play fine in VLC or other player; ZM either can't find them or won't read them. I tried to move one of the created directories from root to the /var/cache/zoneminder/events directory specified in the zm.conf file, and it still won't play them. Dunno if it's a format issue or if ZM is just looking in the wrong place for them.

mikb
Posts: 415
Joined: Mon Mar 25, 2013 12:34 pm

Re: ZM trying to write to root dir

Post by mikb » Sat Oct 26, 2019 2:39 pm

jaeger1957 wrote:
Thu Oct 24, 2019 12:17 am
It looks like ZM is trying to write to the root directory. To test this, I opened up write permissions on the root directory and the directories and files were created.
Eek!

Be thankful that in doing that test, zm-audit didn't notice that there was a lot of files in your drive for which there were no accompanying database entries, and remove them all, trashing your filesystem.

I realize you are trying to fault-find the situation, but think VERY carefully why the phrase "so I let it loose on my root directory" might be a bad test to make.

"It looks like ZM is trying to blow my foot off. So I placed both feet under the barrels and that worked ... any ideas?" :shock:

You're right that it is attempting to write to the root directory, and it absolutely should not be doing that, and nor should you let it. There's a paths problem somewhere in ZoneMinder, which means you're not getting the prefix of "/wherever/the/events/go" prepended to "/camera/date/..."

jaeger1957
Posts: 6
Joined: Wed Oct 23, 2019 11:35 pm

Re: ZM trying to write to root dir

Post by jaeger1957 » Mon Oct 28, 2019 2:10 am

So of course, I did close down the permissions again after a short test. I have not found anything that would point to the root directory in any of the paths in the GUI or in the config files, so I'm at a loss as to why it was trying to write there.

I went and defined an alternate storage location (bulk) on a large partition and pointed all the cameras at that storage, and also updated the ZM_DIR_EVENTS and ZM_DIR_IMAGES in /etc/zm/conf.d/zm.conf to point to the bulk storage, and now I am seeing video files in that location. I am able to click on events in the list below the camera view and get them to play back and speed up playback with the onscreen controls.

The default storage had been pointing at the same directory, but via a symbolic link. I don't know if the symbolic link was the problem, but pointing directly to the actual directory seems to have corrected the issue so far.

mikb
Posts: 415
Joined: Mon Mar 25, 2013 12:34 pm

Re: ZM trying to write to root dir

Post by mikb » Mon Oct 28, 2019 4:51 pm

jaeger1957 wrote:
Mon Oct 28, 2019 2:10 am
So of course, I did close down the permissions again after a short test.
I hope so :) -- my point was it's not a good test to make at all, unless you have an entirely throwaway attitude to your system and data (e.g. a scratch system of no importance, a virtual machine instance), in which case go for it.
jaeger1957 wrote:
Mon Oct 28, 2019 2:10 am
I have not found anything that would point to the root directory in any of the paths in the GUI or in the config files, so I'm at a loss as to why it was trying to write there....
That's the thing, the fact that it's writing to /root is probably because a prefix is not being stuck on the front. The total path is (apparently) assembled from

Code: Select all

PREFIX
/event/details/stuff/0000.jpg
And you are missing the prefix part. From a personal/programming preference, I'd do it as

Code: Select all

PREFIX/
event/details/stuff/0000.jpg
Simply so that if the prefix variable goes up in smoke, the resulting shortened path is local to "here", and not starting from "/root", limiting any potential damage, but that's just me :wink:
jaeger1957 wrote:
Mon Oct 28, 2019 2:10 am
but via a symbolic link. I don't know if the symbolic link was the problem, but pointing directly to the actual directory seems to have corrected the issue so far.
Symbolic links can cause trouble, if not done correctly, so it may actually be the symbolic link was pointing to the wrong place (root directory) ?

kitkat
Posts: 88
Joined: Sun Jan 27, 2019 5:17 pm

Re: ZM trying to write to root dir

Post by kitkat » Tue Oct 29, 2019 11:24 am

jaeger1957 wrote:
Mon Oct 28, 2019 2:10 am
The default storage had been pointing at the same directory, but via a symbolic link. I don't know if the symbolic link was the problem, but pointing directly to the actual directory seems to have corrected the issue so far.
Symlinks may not work, but bind mounts do...

Code: Select all

mount --bind /my/new/storage/location /var/cache/zoneminder

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests