Page 1 of 1

Can't create missing temporary directory '/var/run/zm'...

Posted: Sun Dec 14, 2014 9:18 am
by McFuzz
Pretty much as title says - after upgrading to 1.28.0, I've been getting that message upon every reboot:

Code: Select all

Can't create missing temporary directory '/var/run/zm': Permission denied
It's not a big deal since I can go ahead and manually create the directory, but I am not quite sure why it suddenly started whining about it. Other than that, everything works just fine.

And yes, the package has been compiled as root...

Suggestions?

Thanks!

Re: Can't create missing temporary directory '/var/run/zm'..

Posted: Mon Dec 15, 2014 5:54 pm
by McFuzz
Anyone...?

Re: Can't create missing temporary directory '/var/run/zm'..

Posted: Tue Dec 16, 2014 4:36 pm
by knight-of-ni
The answer depends on whether or not you are running a distro that is using systemd, rather than the legacy sys v init.

Re: Can't create missing temporary directory '/var/run/zm'..

Posted: Wed Dec 17, 2014 12:02 am
by McFuzz
It does not appear that systemd is installed on my debian wheezy install; just a login utility library:

Code: Select all

root@lulzsec:~# dpkg -l | grep systemd
ii  libsystemd-login0:amd64            44-11+deb7u4                       amd64        systemd login utility library

Re: Can't create missing temporary directory '/var/run/zm'..

Posted: Wed Dec 17, 2014 1:09 am
by knight-of-ni
Debian/Ubuntu has all sorts of systemd-related packages and I'm not sure which is the "right" one.
You can have both systemd & sys v init packages installed at the same time too, which makes things interesting.

Note that zoneminder checks what is *running*, rather than what package is installed.
The best test for systemd running is this:

Code: Select all

ps -o comm="" 1
INIT
If that returns "init" then you are running sys v init. To fix the /var/run/zm folder issue, you should verify your init script under /etc/init.d is creating the folder correctly. Note that, even with a properly configure init script, you can still get the missing /var/run/zm error if you try to start zoneminder the first time from the web UI. That is because the web user does not have permission to create the folder (this is by design). Always start zoneminder as a service (or as root) the first time.

SYSTEMD
If the test returns "systemd" then you should make sure you *don't* have a zoneminder init script under /etc/init.d. Instead, follow all the instructions here to properly configure zoneminder: http://www.zoneminder.com/wiki/index.ph ... se_systemd

Skip the first part for enabling systemd as you have already established it is running.

Re: Can't create missing temporary directory '/var/run/zm'..

Posted: Wed Dec 17, 2014 1:23 am
by McFuzz
knnniggett wrote:Debian/Ubuntu has all sorts of systemd-related packages and I'm not sure which is the "right" one.
You can have both systemd & sys v init packages installed at the same time too, which makes things interesting.

Note that zoneminder checks what is *running*, rather than what package is installed.
The best test for systemd running is this:

Code: Select all

ps -o comm="" 1
INIT
If that returns "init" then you are running sys v init. To fix the /var/run/zm folder issue, you should verify your init script under /etc/init.d is creating the folder correctly. Note that, even with a properly configure init script, you can still get the missing /var/run/zm error if you try to start zoneminder the first time from the web UI. That is because the web user does not have permission to create the folder (this is by design). Always start zoneminder as a service (or as root) the first time.

SYSTEMD
If the test returns "systemd" then you should make sure you *don't* have a zoneminder init script under /etc/init.d. Instead, follow all the instructions here to properly configure zoneminder: http://www.zoneminder.com/wiki/index.ph ... se_systemd

Skip the first part for enabling systemd as you have already established it is running.

INIT was the response so I guess no systemd for me. I assume that by init script, you refer to the zm script within /etc/init.d, correct? If so - it appears there is no reference to creating /var/run/zm; I assume modifying that should do the trick, correct?

Re: Can't create missing temporary directory '/var/run/zm'..

Posted: Wed Dec 17, 2014 1:42 am
by knight-of-ni
This is the template for the legacy sys v init script:
https://github.com/ZoneMinder/ZoneMinde ... ipts/zm.in

For you, the make macro "@ZM_RUNDIR@" should be /var/run/zm
Further down, you can see it checks for this folder and then creates it if it doesn't exist:

Code: Select all

#Make sure the directory for our PID folder exists or create one.
[ ! -d $pidfile ] \
&& mkdir -m 774 $pidfile \
&& chown $ZM_WEB_USER:$ZM_WEB_GROUP $pidfile

Re: Can't create missing temporary directory '/var/run/zm'..

Posted: Wed Dec 17, 2014 1:57 am
by McFuzz
Weird - mine looks completely different...

Code: Select all

#!/bin/sh
### BEGIN INIT INFO
# Provides:          ZM
# Required-Start:    $network mysql $local_fs
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: <Enter a short description of the sortware>
# Description:       <Enter a long description of the software>
#                    <...>
#                    <...>
### END INIT INFO

prog=ZoneMinder
ZM_PATH_BIN="/usr/local/bin"
command="$ZM_PATH_BIN/zmpkg.pl"

start() {
        echo -n "Starting $prog: "
        $command start
        RETVAL=$?
        [ $RETVAL = 0 ] && echo success
        [ $RETVAL != 0 ] && echo failure
        return $RETVAL
}
stop() {
        echo -n "Stopping $prog: "
        $command stop
        RETVAL=$?
        [ $RETVAL = 0 ] && echo success
        [ $RETVAL != 0 ] && echo failure
}
status() {
        result=`$command status`
        if [ "$result" = "running" ]; then
                echo "ZoneMinder is running"
                RETVAL=0
        else
                echo "ZoneMinder is stopped"
                RETVAL=1
        fi
}

case "$1" in
'start')
        start
        ;;
'stop')
        stop
        ;;
'restart')
        stop
        start
        ;;
'status')
        status
        ;;
*)
        echo "Usage: $0 { start | stop | restart | status }"
        RETVAL=1
        ;;
esac
exit $RETVAL

Re: Can't create missing temporary directory '/var/run/zm'..

Posted: Wed Dec 17, 2014 2:05 am
by knight-of-ni
Right, those Debian guys just have to be different.
Well, check out this one then:
https://github.com/ZoneMinder/ZoneMinde ... ian/init.d

Just fill in the bits that are missing from yours.

Re: Can't create missing temporary directory '/var/run/zm'..

Posted: Wed Dec 17, 2014 6:18 am
by McFuzz
knnniggett wrote:Right, those Debian guys just have to be different.
Well, check out this one then:
https://github.com/ZoneMinder/ZoneMinde ... ian/init.d

Just fill in the bits that are missing from yours.
Awesome! That did the trick; thanks d00d!