DietPiCam Jessie : Motion.php broken.

I tried out DietPiCam on DietPi ages ago and couldn’t get it to work, so I gave up on it for a while and just got around to testing it again.

After installing again, I found that I was getting the same problem as before; namely that I was able to see the webpage (http://dietpi/dietpicam), but was not getting any camera feed or preview.

I tested the camera by using the raspivid command and found it working OK, so I then went back to the RPi-Cam-Web-Interface documentation and found the following under Troubleshooting:

Web interface starts up but just shows ‘Loading’. There are a number of causes for this but most are caused by the core raspimjpeg process not running or not running correctly.

I then entered the command raspimjpeg into the command line and voilà! The camera immediately lit up and the preview appeared in the webpage.

Were you aware that DietPiCam was not automatically starting raspimjpeg?
Can this be fixed?

My suggestion would be to start raspberrymjpeg as a service ie. create an init conf file.

Also, I see that you forked this from silvanmelchior’s project quite a while ago and I have noticed that there has been quite a lot of development going on over there. Might it be time to have another look and bring this version more up-to-date?

Thanks for all the hard work,
Rich
:slight_smile:

Hi Rich,

Thanks for the report.

Strange, DietPi should run the init for raspberrymjpeg during boot. It must be failing to start, I’ll look into this when I can and get back to you.

What RPi version and Distro are you running?

Also, could you send a DietPi bug report so I can check your settings please:

dietpi-bugreport

No need to fill the text out, just need the Reference CODE:.

Heres the current script that runs raspberrymjpeg during boot:
https://github.com/Fourdee/DietPi/blob/master/dietpi/conf/dietpicam_raspimjpeg_init

Bug report sent :slight_smile:

Reference Code: 74da383582db-0

When I run

/etc/raspimjpeg_init start

(or restart) I get the following output:

This account is currently not available.
This account is currently not available.

When I run the following commands, I get the same result:

su -c 'raspimjpeg > /dev/null &' www-data



This account is currently not available.


su -c 'php /var/www/dietpicam/schedule.php > /dev/null &' www-data



This account is currently not available.

Running raspimjpeg as root gives me:

~# raspimjpeg
start monitoring for pid: 26306
{2015/11/23 01:10:18} start monitoring for pid: 26306
RaspiMJPEG Version 5.2.10
recommended video buffers 1
h264 buffers set to recommended 1
MJPEG streaming, ready to receive commands
send smd 9

And it works.

Does raspimjpeg require root privileges to run, or something?
User www-data does not and indeed should not have root privilages, for security reasons.

Just a guess…

Raspbian Jessie on a Pi 2, though I was getting the same on my model B under Jessie, too.
It was a while ago now, so I’m not sure, but I may have been experiencing the same issue under Wheezy, a few months ago.

Thanks Rich,

I’ve created a Git ticket: https://github.com/Fourdee/DietPi/issues/119.

They all get ran as www-data. And yes, giving www-data root permissions is just asking for trouble.

Resolved for V102.

I’ve updated the init code to use sudo -u instead of su -c. Thanks for your help with debugging on this, saved me alot of time :slight_smile:

You can manually patch your system now if you like:

nano /etc/raspimjpeg_init

Replace the su -c lines with the following:

	Raspimjeg_Start(){
		mkdir -p /dev/shm/mjpeg
		chown www-data:www-data /dev/shm/mjpeg
		chmod 777 /dev/shm/mjpeg

		sleep 1
		sudo -u www-data raspimjpeg > /dev/null &

		sleep 1
		sudo -u www-data php /var/www/dietpicam/schedule.php > /dev/null &
	}

Thanks, Dan. :smiley:
I responded on the bug report page in more detail.
Rich.

Yep. Works a treat!
I had to install sudo, though. :wink:

Now that’s fixed for me, I’m having some trouble getting motion detection working on the damn thing. :frowning:
Motion detection starts up, it shows up in the log file and the motion service is listed as running on the system, but the weird thing is that motion.php page is utterly blank and no recording is being triggered.
I’m really just stumbling around in the dark here. I’ve been working my way through http://elinux.org/RPi-Cam-Web-Interface but it’s quite dense reading and doesn’t really have a quickstart section, explaining the basics.
i’d have a proper go at reading the forum thread at https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=63276 but it’s 121 pages long!

Does anyone have a Pi set up with dietpicam up and running properly?
Dan, do you have a test rig set up with a camera to test this functionality?

I’m not sure whether it’s just me being dense and missing something simple in the setup, or that there may be some more bugs in this which need sorting out.
I haven’t really seen a great deal of discussion about dietpicam, so some more input might be useful. It’s just so straightforward to install, compared with the upstream RPi-Cam-Web-Interface project. I still haven’t managed to get that one installed without major aggravation; my last two attempts failed miserably due to webserver problems.

Thanks,
Rich

Its been a while since i last tested motion detection. I’ll take a look at the guide you linked and run through it, then get back to you with results.

Git ticket: https://github.com/Fourdee/DietPi/issues/120

Right. So I spent most of the day troubleshooting this stuff. I tried out multiple installs and various configurations and came to several conclusions:

Firstly, RPi-Cam-Web-Interface and therefore DietPiCam is pretty badly broken under Raspbian Jessie and seems to need a lot of reconfiguring on the fly to get it going. Things seem to have broken on the webserver side in both Apache and Nginx as well as in PHP. Default directories have changed and permissions and security settings have been screwed around with.

I haven’t gotten the chance to try out DietPiCam on DietPi-Wheezy yet, but I did install the full RPi-Cam-Web-Interface (on a full Raspbian-Wheezy) from the official GitHub repo (testing it under both Apache and Nginx options) and it pretty much worked straight away, without any fuss.

The one major problem I am still having is in getting motion to detect movement and trigger a recording.
I tried the suggestions laid out in the Troubleshooting → Motion Detection section at the bottom of the wiki page (http://elinux.org/RPi-Cam-Web-Interface#Motion_Detection) but, although I got stop messages on shutdown, was unable to get the thing to trigger a start event at all.

I was all set to give up on it entirely (for today, at least) when I thought I’d have another try at it’s experimental, internal motion detection method. It worked! (It, however, did not work on DietPiCam last time i tried it.) :frowning:
I’ll give it another try, but in DietPi-Wheezy this time, ASAP.

Looking at http://www.lavrsen.dk/foswiki/bin/view/Motion/TuningMotion I figured that this might be a good way of getting Motion configured, but alas, I hit a dead end there as well; It wouldn’t detect the camera. :imp:

If it could be made to work with RPiCam/DietPiCam, this might be a great help.

I’ll leave it there for the moment, but hopefully this will help with the diagnosis.

Rich.

Hi Rich,

Yep, motion.php appears broken on Jessie.

I’ll try installation on Wheezy and see if that works. Either way, I’ll also look at updating DietPi-Cam to latest RPi-cam-web version.

Confirmed working on Wheezy. Appears to be a bug in RPi-cam-web-interface on Jessie.

Will attempt to update DietPi-Cam version to latest RPi-cam-web-interface version for a resolution. After v102 is released.

I sent out a buggraport a couple of weeks ago, when this problem started at the newest update.
I used another piece of software in the meantime named: Motionpie, another handy piece of software which supports motion detection and it works really great!

The only downsides compared to dietpicam are:
You can set your resolution MAX to 1600x900
There are not many options available like in dietpicam.

I 'm looking forward to update 102. Hopefully I can use motion detection :smiley:

Info about motionpie:
https://github.com/ccrisan/motionpie

Thanks.

I just tried DietPi-Cam on DietPi Wheezy again and can confirm that the motion.php page still displays there, although I can’t get any sort of motion detection working.

However, as I mentioned above, I was able to get the “Internal” motion detection method to work right away on RPi-cam-web-interface on Raspbian Wheezy, but this does not seem to work on DietPi Wheezy.

Can anyone else confirm this?

Where did you file the bug report?

I had a brief look at this when I was first researching my RasPi CCTV project, but decided that it was a bit too limited (as you mentioned) and instead focussed on the RPi-cam-web-interface project.
I brought this up on the DietPi | Minimal Raspbian. Optional "ready to run" software - Raspberry Pi Forums thread and Dan put it straight into the DietPi project.
Thanks so much, Dan!

My “ToDo” list was a lot smaller back then lol :slight_smile:

Keep the info coming, i’ll try and get this resolved for v102 but it may to wait until the next release. I need to finish up a few things 1st, then I can give it my full attention.

I need to finish up a few things 1st, then I can give it my full attention.

I hope DietPiCam also gets updated to the latest version then :smiley:

For DietPi v103:
I’ve updated DietPiCam to match the current RPi cam control (v6.0.19), but, still having a blank page on jessie for motion.

Turns out this is a known issue for Jessie: motion.php not showing configurations · Issue #214 · silvanmelchior/RPi_Cam_Web_Interface · GitHub
Looks like the cause is with the motion package installation. No doubt the libraries are different to Wheezy.

https://github.com/Fourdee/DietPi/issues/120#issuecomment-162020517

I tried Jessie for about a week and had bunch of troubles with it. Everything went back to normal and super stable after i downgraded to Wheezy.

Jessie is evil :imp: Wheezy is still the best :wink:

That is why i have NO plans of upgrading to Jessie! I am more than happy with Wheezy. The day you drop support for Wheezy will be the day i upgrade to Jessie. Not before that!

I hope DietPiCam 6.0.19 and motion detection works fine with Wheezy though.

Thank You very much for your efforts FourDee. Maintaining all of this beside a normal life must be very difficult and frustrating. Sometimes i am happy that i am not as intelligent and talented as people like you LOL.

Regards

Motion on Wheezy should be fine, next time I run a Wheezy installation, i’ll test it.

The only time we will drop support for Wheezy, is when/if Raspbian drops the support for Wheezy. I still love a Wheezy installation now and then, its proven its stability over the years. Jessie is great, but its new and still has alot of “teething” issues and developers are still adjusting to its new ways.

Thank You very much for your efforts FourDee. Maintaining all of this beside a normal life must be very difficult and frustrating. Sometimes i am happy that i am not as intelligent and talented as people like you LOL.

No worries, although it keeps me busy, i enjoy doing DietPi. Its also an excuse for me to obtain lots of single-board computers lol :slight_smile: