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

Forum for questions and support relating to the 1.28.x releases only.
Locked
McFuzz
Posts: 181
Joined: Tue Aug 28, 2012 7:03 am

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

Post 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!
McFuzz
Posts: 181
Joined: Tue Aug 28, 2012 7:03 am

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

Post by McFuzz »

Anyone...?
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

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

Post 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.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
McFuzz
Posts: 181
Joined: Tue Aug 28, 2012 7:03 am

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

Post 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
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

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

Post 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.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
McFuzz
Posts: 181
Joined: Tue Aug 28, 2012 7:03 am

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

Post 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?
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

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

Post 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
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
McFuzz
Posts: 181
Joined: Tue Aug 28, 2012 7:03 am

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

Post 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
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

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

Post 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.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
McFuzz
Posts: 181
Joined: Tue Aug 28, 2012 7:03 am

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

Post 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!
Locked