v103 Wheezy | Motion 100% CPU + Autostart at Boot

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
Zombievirus
Posts: 119
Joined: Sun Sep 20, 2015 2:07 am

v103 Wheezy | Motion 100% CPU + Autostart at Boot

Post by Zombievirus »

Hi,

I am working on a Motion Detection Website powered by DietPiCam. I need the external motion detection enabled in DietPiCam for that.

The following command tells me that motion is very well installed on the system.

Code: Select all

root@pi:/DietPi# dpkg -l | grep motion
ii  motion                          3.2.12-3.4                              armhf        V4L capture program supporting motion detection
Now there is just a little Problem. I can't get Motion to start at boot without it running at 100% CPU.

Even if i start it manually by typing motion in the command line it runs at 100%.

The Fact that it doesn't run at boot is a popular Bug in Motion. It's not that difficult to get it running at boot but the 100% CPU Usage is giving me Diarrhea!

Any Suggestions?

Thanks.
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: v103 Wheezy | Motion 100% CPU + Autostart at Boot

Post by Fourdee »

Hi Zombie,

Thanks for the report.

I've created a Git ticket for this. Will let you know what I find.
https://github.com/Fourdee/DietPi/issues/143
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: v103 Wheezy | Motion 100% CPU + Autostart at Boot

Post by Fourdee »

Just done a fresh Wheezy install + DietPi-cam.

Iam unable to replicate the 100% cpu usage: https://github.com/Fourdee/DietPi/issue ... -164287331

I've never used the motion detection before. If you can let me know how and what you are testing, it will help me to debug the issue.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Zombievirus
Posts: 119
Joined: Sun Sep 20, 2015 2:07 am

Re: v103 Wheezy | Motion 100% CPU + Autostart at Boot

Post by Zombievirus »

Hi FourDee,


Well, i tried a lot of things. nothing helped so i did a clean reinstall of DietPi Wheezy and DietPiCam.

Then i enabled the motion daemon in /etc/default/motion file.

didn't even touch the motion.conf in /etc/motion/

rebooted the pi and checked if motion was running. it was running and running at a very low cpu usage.

solved this problem this way. Clean Install seems to be the ultimate weapon lol

now i am trying to get motion detection to work for real in the web interface. no success until yet. I wrote about my misery in the foundations forum. Let's see if they can help me with my problem.


Regards
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: v103 Wheezy | Motion 100% CPU + Autostart at Boot

Post by Fourdee »

Zombievirus wrote:solved this problem this way. Clean Install seems to be the ultimate weapon lol

now i am trying to get motion detection to work for real in the web interface. no success until yet. I wrote about my misery in the foundations forum. Let's see if they can help me with my problem.


Regards
lol, yep.
You might want to try dietpi-backup. This way you can create a restore point, play around with settings/configs for testing, then restore when you want to try something else. Saves you having to reinstall everytime.

I've seen your request for an alternative motion, i'll look into it when I can.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Zombievirus
Posts: 119
Joined: Sun Sep 20, 2015 2:07 am

Re: v103 Wheezy | Motion 100% CPU + Autostart at Boot

Post by Zombievirus »

I use Win32DiskImager to create an Image directly from the SDCard. Whenever i need a clean install, i erase the card with SD Card Formatter and flash the backup onto the SDCard.

So usually whenever you release a new DietPi Image i do a real manual clean install including dietpi optimized software and then create an image via DiskImager. I use this image whenever i mess stuff up.

That is why i am not so scared of messing things up ;)
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: v103 Wheezy | Motion 100% CPU + Autostart at Boot

Post by Fourdee »

Zombievirus wrote:I use Win32DiskImager to create an Image directly from the SDCard. Whenever i need a clean install, i erase the card with SD Card Formatter and flash the backup onto the SDCard.

So usually whenever you release a new DietPi Image i do a real manual clean install including dietpi optimized software and then create an image via DiskImager. I use this image whenever i mess stuff up.

That is why i am not so scared of messing things up ;)
Are you shrinking and zerofreeing the image after you've saved it? I wouldn't recommend writing the full size of SD card each time, will wear it out.

I made this script to shrink the images I've created for DietPi.
You will need a linux desktop (or vnc server) with gparted and zerofree installed:

Code: Select all

#!/bin/bash
{

	#VM
	#IMAGE_FP="/mnt/dietpi"

	#XU4
	#vncserver :0 -geometry 1280x720 -depth 16
	#killall Xtightvnc
	IMAGE_FP="/mnt/samba/#Backups/_Daniel/Projects/DietPi"

	IMAGE_NAME="PiHole"
	IMAGE_NAME+=".img"

	modprobe loop
	losetup -f
	losetup /dev/loop2 "$IMAGE_FP/$IMAGE_NAME"
	partprobe /dev/loop2

	#Add +20MB to end of partition.
	gparted /dev/loop2

	#Clear Freespace
	#zerofree -v /dev/loop2p1
	zerofree -v /dev/loop2p2

	losetup -d /dev/loop2

	END_PARTITION=$(( $(fdisk -l "$IMAGE_FP/$IMAGE_NAME" | grep ".img2" | awk '{print $3}') + 1 ))
	END_PARTITION=$(( $END_PARTITION * 512 ))

	truncate --size=$END_PARTITION "$IMAGE_FP/$IMAGE_NAME"

	read -p "Press any key to continue....."

	exit

}
DietPi-Backup will have the same result as you saving the image and rewriting it again, but alot quicker (rsync based). Give it a whirl sometime :)

Some tips for DietPi-Backup usage:
Go through the 1st run setup, once everything is how you want it and the system is ready for use, run dietpi-backup and create one. Then all you need to do is run dietpi-backup and restore every time you want the system to be exactly how it was when you ran the backup.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Post Reply