The purpose of this post is to combine two brilliant guides and save them (and the files) from disappearing…and to have them in one place in case I have to redo all this. So the first guide is by Christoph Buenger and can be found here. It describes step by step the basic installation process for motion (And Raspian, which I’ll left out here).
The second guide is by some unknown author I’ve found here and is based on a guide by Jeremy which can be found here. I didn’t use Jeremy’s guide because I had problems with motion in Arch Linux. This guide describes the google drive part. So after having installed Raspian and wi-fi we continue with motion:
sudo apt-get install motion
Since there have still been problems with motion and my RasPi Cam Module I had do continue with Christophs alternative Motion version by doing this:
cd /tmp sudo apt-get install -y libjpeg62 libjpeg62-dev libavformat53 libavformat-dev libavcodec53 libavcodec-dev libavutil51 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev wget https://www.dropbox.com/s/xdfcxm5hu71s97d/motion-mmal.tar.gz tar zxvf motion-mmal.tar.gz sudo mv motion /usr/bin/motion sudo mv motion-mmalcam.conf /etc/motion.conf
With that done you have downloaded and unpacked the alternative version of motion and updated the already installed one with those new files (There will be an alternative download location for all files in this guide compilation at the end).
Now we make the motion deamon run always by running this:
sudo nano /etc/default/motion
and changing the config line to this:
The motion configuration file for this modified version can be found here:
sudo nano /etc/motion.conf
An config example will also be attached to the archive at the end if it’s not available from here.
According to this and the included file location, set the permissions like this:
sudo chmod 664 /etc/motion.conf sudo chmod 755 /usr/bin/motion sudo touch /tmp/motion.log sudo chmod 775 /tmp/motion.log
One additional change to the motion.conf is required here to make the google drive version work.
The following line needs to look like that:
Of course you’ll have to create this location by doing this:
sudo mkdir /home/pi/monitor chgrp motion /home/pi/monitor chmod g+rwx /home/pi/moinitor chmod -R g+rwx /home/pi/monitor
This may change since the Python script is currently not able to delete the .avi/.jpgs. Restart PI.
Now we install python by doing this:
sudo apt-get install pip sudo pip install gdata
The necessary python scripts can be downloaded by doing this:
sudo wget http://files.mihevc.org/raspi/motion/uploader -O /etc/motion/uploader.py sudo wget http://files.mihevc.org/raspi/motion/uploader.cfg -O /etc/motion/uploader.cfg sudo chmod +x /etc/motion/uploader.py
Now edit the config file by adding your google data doing this:
sudo nano /etc/motion/uploader.cfg
Make sure the folder you’ve specified in the config exists on google drive.
Make sure you’ve recorded something by moving wildly in front of your cam. Look into /home/pi/monitor for .avis.
To test the python script run:
python ./uploader.py /etc/motion/uploader.cfg /home/pi/monitor/*.avi
If that worked out open your motion.conf and add this line to the end of the file
sudo nano /etc/motion.conf on_movie_end python /etc/motion/uploader.py /etc/motion/uploader.cfg %f
At the moment the script won’t delete the jpg/avi files because of their rights. I’m working on that.
Ok got a workaround.
Insert in uploader.py after line 116 the following:
Thanks to the almighty Bazz!
All the required files can be found here: RaspiSurv Data (updated uploader.py with workaround above)
Edit: It seems you don’t need the special build of motion anymore: http://www.techrapid.co.uk/raspberry-pi/turn-raspberry-pi-nvr-motion/
So last update on RaspBMC and the new Browser App broke EVERYTHING.
Came to an „Kernel Panic“ screen in the morning.
Experimenting with several COMPLETELY USELESS solutions I finally found one that worked.
So here is what you have to do:
1) Take the SD card out and put it in a different computer. Linux/Win doesn’t matter.
2) Open config.txt in a text editor. As you see, there are several entries saying something with „browser“. Delete everything so that the only content in there is this:
3) Save and put the SD card back in the RasPI. Boot
3b) Optional: delete every file on the SD card with „browser“ in the filename. I did this because I was pissed off. Did not break anything and since I’m not interested in this „feature“ I didn’t care.
Usually, you should be good at this point. RasPI will boot and update (Stay cool. Can take a while. If you need details, push ESC when it gives you the option).
When you’re back in RaspBMC go to Programs / Raspbmc Settings and press OK. You’ll need to reboot afterwards. If you experience any problems booting up, check the contents of the config.txt on the SD Card again.
Mine looks like this:
Unfortunately I did not get into RaspBMC after step 3. In my case I got this:
Free initramfs and switch to another root fs:
chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,
execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.
This sounded like most of the useless solutions to me. It looked extreme. Something I did not want to do.
It turned out that I had to put the USB drive I was using to the upper port while the keyboard dongle had to go on the lower port.
So booting up I realized that the keyboard didn’t work. RasPI was also not reachable through SSH. At least not through the local IP. It worked great through the WAN IP so I could at least run some commands.
So after even more googling I found a simple solution:
sudo rm /scripts/upd_hist/kver
After the reboot bot the USB and SSH worked again.
P.S. There are HORRIBLE solutions for Linux related problems out there. If you ever come by some people telling you that your hardware is broken or that you have to execute some xx-lines script to solve a problem: LOOK AGAIN, GOOGLE MORE! Most of the times, the solution is easy and does not require you to rebuild everything or buy new hardware…