Must CHMOD 777 every time to get cameras working

Support and queries relating to all previous versions of ZoneMinder
Locked
Drakeweb
Posts: 15
Joined: Fri Apr 06, 2007 7:15 pm

Must CHMOD 777 every time to get cameras working

Post by Drakeweb »

When booting my zoneminder server (Ubuntu server) zoneminder starts automatically. Unfortunately, it fails to start the cameras, returning errors (exited abnormally etc.)

My /dev/video already has its permissions set to 777.

If I chmod 777 /dev/video, however, it brings the cameras on-line and stops all the errors.

Obviously, this is a workaround that I can do each time I boot the server, which is not often, but it does seem weird.

Anyone have any explanation, and a possible long-term solution?

Cheers,

Adam
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Is /dev/video a symlink to /dev/video0? If so does that have the correct permissions? The zmfix binary should set the permissions on the devices but may only work if your monitors are set to use the real device files and not links to them.
Phil
Drakeweb
Posts: 15
Joined: Fri Apr 06, 2007 7:15 pm

Post by Drakeweb »

I've changed the cameras to source from /dev/video0 instead of the symlink and the same problem happens. Everything is set to 777, then I reboot, then the cameras stop working and generate errors in the log, then I chmod 777 /dev/video0 and the cameras start working again!
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

The zmfix binary should be setuid, that is when you do

Code: Select all

ls -l zmfix
it should look like this

Code: Select all

-rwsr-xr-x 1 root root 128011 Apr  3 17:09 /usr/local/bin/zmfix
and show an 's' instead of an 'x' in the first block of permissions. What do you get if you do that?
Phil
Drakeweb
Posts: 15
Joined: Fri Apr 06, 2007 7:15 pm

Post by Drakeweb »

Hmmm, mine is as you thought:

Code: Select all

-rwxr-xr-x 1 root root 38780 2007-02-25 23:44 /usr/bin/zmfix
So how do I go about changing it, and will it make a difference?
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

This will get you set:

Code: Select all

chmod 4755 /usr/bin/zmfix
Drakeweb
Posts: 15
Joined: Fri Apr 06, 2007 7:15 pm

Post by Drakeweb »

Sweet! That seemed to do it. Thanks. I just rebooted having changed the permissions and the cameras came up without a problem.

Could you please explain why that worked? What did it do that made everything ok?

Thanks,

Adam
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

It sets a suid flag so even though apache is executing the file, it runs as root (the file user) so that it can set the permissions for the video device.
barbaq
Posts: 5
Joined: Mon Dec 19, 2005 10:42 pm

Problem solved.

Post by barbaq »

Thanks this topic solved my latest issues with Zoneminder. Ive installed it using apt-get with Debian but had to change /usr/bin/zmfix permissions to make it display images.
John Williams
Posts: 23
Joined: Wed Apr 11, 2007 1:27 pm
Location: Austin, Texas USA

Post by John Williams »

Another way is to create a group called video and add www_data to it. Ubuntu created the /dev/video device in the video group, which does not exist. Zoneminder runs the capture as user www_data. This fix worked for me...
-----------
John
cyrulution
Posts: 52
Joined: Sat Jul 28, 2007 12:27 pm
Location: Kinzweiler, Germany and Beith, Scotland

Post by cyrulution »

John Williams wrote:Another way is to create a group called video and add www_data to it. Ubuntu created the /dev/video device in the video group, which does not exist. Zoneminder runs the capture as user www_data. This fix worked for me...
Ubuntu won't let me create www_data as a user. No understrokes possible.
I still don't have the cameras running.

Just to explain why I install Ubuntu 7.10 now (Jan 2009): I haven't found a way to get the so named "Pico" card working with Ubuntu 8.xx. So I need to use 7.10. I had installed the 2008 ZMLiveCD from isentrix.com. But the display with the blue and red boxes under the picture did not really work. And I'm using Ubuntu on other machines.
Serenity is not freedom from storm; it's peace within the storm
nuck
Posts: 148
Joined: Tue Nov 11, 2008 1:43 am
Location: Canada

Post by nuck »

cyrulution wrote:Ubuntu won't let me create www_data as a user. No understrokes possible.
I still don't have the cameras running.

Just to explain why I install Ubuntu 7.10 now (Jan 2009): I haven't found a way to get the so named "Pico" card working with Ubuntu 8.xx. So I need to use 7.10. I had installed the 2008 ZMLiveCD from isentrix.com. But the display with the blue and red boxes under the picture did not really work. And I'm using Ubuntu on other machines.
Does this help you at all? http://wiki.robotz.com/index.php/Pico_I ... V_DVR_Card (look towards the bottom of the page)

Chances are that if you can get it working at all with an older Linux distro it'll work (maybe better) with newer. Once you've got a working card in Linux ZM should have no problems with it.
cyrulution
Posts: 52
Joined: Sat Jul 28, 2007 12:27 pm
Location: Kinzweiler, Germany and Beith, Scotland

Post by cyrulution »

nuck wrote:Does this help you at all? http://wiki.robotz.com/index.php/Pico_I ... V_DVR_Card (look towards the bottom of the page)

Chances are that if you can get it working at all with an older Linux distro it'll work (maybe better) with newer. Once you've got a working card in Linux ZM should have no problems with it.
The information from robotz is really useful for using my cards.

After all I decided to start from scratch.
I thoroughly followed the steps in distribution specific installation guide from the ZM wiki for Ubuntu 8.04 (I'm running Ubuntu on other machines since years)
I downloaded Ubuntu 8.04 i386 server (the LTS= Long Time Support version of Ubuntu). After i added a file "bttv" with the line

Code: Select all

options bttv card=77,77
to /etc/modprobe.d/ both my cards started working fine.
I think this is the best solution for my rather modern amd64 machine.
Serenity is not freedom from storm; it's peace within the storm
Locked