Debian Squeeze

From ZoneMinder Wiki
Jump to navigationJump to search

Zoneminder on Debian Squeeze

Installation of Zoneminder on an Squeeze System

The installation on an Debian system is very easy, because the complete zoneminder software is packaged for all Debian platforms. The current version in Squeeze for Zoneminder is 1.24.2.

Preparations

If you will not use USB or IP cameras please be sure the capture card is working well. First be sure the card supported by the kernel. You can test this with a simple lspci -v with root privileges. Every channel will be shown as a seperate entry. Look for something similar ...SAA71xx....
Take also a look at the used kernel modul.

...
04:08.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01)
        Subsystem: Philips Semiconductors Behold TV 401
        Flags: bus master, medium devsel, latency 32, IRQ 20
        Memory at fdcff000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 1
        Kernel driver in use: saa7134

04:09.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01)
        Subsystem: Philips Semiconductors Behold TV 401
        Flags: bus master, medium devsel, latency 32, IRQ 19
        Memory at fdcfe000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 1
        Kernel driver in use: saa7134

04:0a.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01))
        Subsystem: Philips Semiconductors Behold TV 401
        Flags: bus master, medium devsel, latency 32, IRQ 18
        Memory at fdcfd000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 1
        Kernel driver in use: saa7134

04:0b.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01)
        Subsystem: Philips Semiconductors Behold TV 401
        Flags: bus master, medium devsel, latency 32, IRQ 16
        Memory at fdcfc000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 1
        Kernel driver in use: saa7134

04:0c.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01)
        Subsystem: Philips Semiconductors Behold TV 401
        Flags: bus master, medium devsel, latency 32, IRQ 20
        Memory at fdcfb000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 1
        Kernel driver in use: saa7134

04:0d.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01)
        Subsystem: Philips Semiconductors Behold TV 401
        Flags: bus master, medium devsel, latency 32, IRQ 19
        Memory at fdcfa000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 1
        Kernel driver in use: saa7134

04:0e.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01)
        Subsystem: Philips Semiconductors Behold TV 401
        Flags: bus master, medium devsel, latency 32, IRQ 18
        Memory at fdcf9000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 1
        Kernel driver in use: saa7134

04:0f.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01)
        Subsystem: Philips Semiconductors Behold TV 401
        Flags: bus master, medium devsel, latency 32, IRQ 16
        Memory at fdcf8000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 1
        Kernel driver in use: saa7134
...

As you can see there are 8 channels. We will find them (hopefully :-) )in the devfs filesystem.

ls -ls /dev/video*
0 crw-rw----+ 1 root video 81,  0 30. Jul 15:18 /dev/video0
0 crw-rw----+ 1 root video 81,  2 30. Jul 15:18 /dev/video1
0 crw-rw----+ 1 root video 81,  4 30. Jul 15:43 /dev/video2
0 crw-rw----+ 1 root video 81,  6 30. Jul 15:43 /dev/video3
0 crw-rw----+ 1 root video 81,  8 30. Jul 15:17 /dev/video4
0 crw-rw----+ 1 root video 81, 10 30. Jul 15:17 /dev/video5
0 crw-rw----+ 1 root video 81, 12 30. Jul 15:17 /dev/video6
0 crw-rw----+ 1 root video 81, 14 30. Jul 15:17 /dev/video7

That looks not bad, but there will be problems later. We see every entry is owend by the user 'root' und the group 'video'. But zoneminder will run with www-data rights, so with this constellation zoneminder can't access the devfs entrys. So the easiest way ist to used a special udev rule that changed the ownership of the dev entrys. Let's create this rule. Create a file /etc/udev/rules.d/90-zoneminder.rules.

vi /etc/udev/rules.d/90-zoneminder.rules

and put the following stuff into, this will set the mode of the /dev/video* files to 0666

# allow non-privileged users to access the /dev/video* files
SUBSYSTEM!="video4linux", GOTO="zm_rules_end"
SUBSYSTEM=="video4linux",       MODE="0666",     GROUP="video"
LABEL="zm_rules_end"

After reloading the udev rules the entrys will look like this:

ls -ls /dev/video*
0 crw-rw-rw-+ 1 root video 81,  0 30. Jul 15:18 /dev/video0
0 crw-rw-rw-+ 1 root video 81,  2 30. Jul 15:18 /dev/video1
0 crw-rw-rw-+ 1 root video 81,  4 30. Jul 15:43 /dev/video2
0 crw-rw-rw-+ 1 root video 81,  6 30. Jul 15:43 /dev/video3
0 crw-rw-rw-+ 1 root video 81,  8 30. Jul 15:17 /dev/video4
0 crw-rw-rw-+ 1 root video 81, 10 30. Jul 15:17 /dev/video5
0 crw-rw-rw-+ 1 root video 81, 12 30. Jul 15:17 /dev/video6
0 crw-rw-rw-+ 1 root video 81, 14 30. Jul 15:17 /dev/video7

Installation

The installation is really simple, just type

apt-get install zoneminder

configure apache, this is from /usr/share/doc/zoneminder/README.Debian

ln -s /etc/zm/apache.conf    /etc/apache2/conf.d/zoneminder.conf

restart apache

/etc/init.d/apache2 restart


That's all. Now you have to setup your zoneminder under http://localhost/zm .

Other Issues

No Link to Webserver directories

If you get a 404 error when browsing to http://localhost/zm, Zoneminder has failed to setup a correct link to the Apache2 web directories. This can be fixed via (must be root):

 $ln -s /usr/share/zoneminder /var/www/zm


Inadequate Memory Allocation

On my P Series Lifebook, Zoneminder would install, but image capture from a remote camera wouldn't work. The problem was an inability to allocate enough shared memory, and was could be seen by examining /var/syslog:

 $tail /var/syslog
 zmc_m2[22910]: INF [Starting Capture]
 zmc_m2[22910]: ERR [Invalid response status 401: Unauthorized]
 zmc_m2[22910]: ERR [Unable to get response]
 zmc_m2[22910]: ERR [Failed to capture image from monitor 2 (0/1)]
 zmdc[22798]: ERR ['zmc -m 2' exited abnormally, exit status 255]
 zmwatch[22830]: ERR [Can't get shared memory id '7a6d0002', 2: No such file or directory]
 zmwatch[22830]: ERR [Can't get shared memory id '7a6d0002', 2: No such file or directory]

The solution was to increase the amount of memory allocated to the kernel:

 Open the file “/etc/sysctl.conf”, and paste these lines at the bottom of the file, then reboot.
   # Increase the maximum shared memory
   kernel.shmall = 167772160
   kernel.shmmax = 167772160

If you want to see if this fix works, you can temporarily allocate more memory (must login as root) by doing the following:

echo 167772160 >/proc/sys/kernel/shmall
echo 167772160 >/proc/sys/kernel/shmmax