Primal Cortex’s Weblog

Amnesia sets in…

Posts Tagged ‘nslu2’

Aiptek MegaCam 1.3 on the NSLU2

Posted by primalcortex on October 24, 2008

I have this camera for around 6 years, and it was gathering dust on my desk. I’ve tried previously to use it on the NSLU2, but on a prior version it didn’t work and it wasn’t supported.

But now the spca5xx chip used by this camera is supported in Linux,and there is a package for driver on the NSLU2 SlugOS package list, so here are the instructions:

Please make sure that first you have enabled the Optware repositories for installation of Optware packages

1) Install the usbutils: ipkg install usbutils
2) Install the video and the gspca1 module which supports the SPCA504a? chipset used by this WebCam?: ipkg install gspca1
3) Install the vidcat program: ipkg-opt install w3cam

That’s it:

1) Connect your usb camera anda make sure it is detected:

root@nslu2-nas:/var/log# lsusb
Bus 2 Device 1: ID 0000:0000
Bus 1 Device 2: ID 04b4:6830 Cypress Semiconductor Corp. USB-2.0 IDE Adapter
Bus 1 Device 1: ID 0000:0000
Bus 3 Device 3: ID 04fc:504a Sunplus Technology Co., Ltd SPCA504a Digital Camera
Bus 3 Device 1: ID 0000:0000

2) Insert the drivers:

modprobe videodev
modprobe gspca

The lsmod output should be something like:

Module                  Size  Used by
gspca                 600708  0
videodev               23072  1 gspca
v4l2_common            12640  1 videodev
v4l1_compat            11652  1 videodev

3) Try it: /opt/bin/vidcat -d /dev/video0 > photo.jpg
It takes a while (around 30s to 1 minute) just be patient.

I’ve posted this on the NSLU2 wiki also.

Posted in Linux | Tagged: , | Leave a Comment »

Backup your digital photographs

Posted by primalcortex on October 10, 2008

When film ruled you had the prints and the negatives, and that’s was about it. If you lose the negatives, or by any chance destroyed or corrupted there was almost no way to get it back. But at least the prints might be available.

With digital cameras, all photos are computer files, are easier to mantain, easier to copy, and yes easier to lost them. I know people that have lost huge amount of photos, including their unique family photos, and didn’t even had a print of them, just because it was all stashed on one computer and one hard disk. You know, hard disks do fail…

So when I’ve switched to digital, my mind kept worrying in how to make sure if disaster strikes at least the loss is not a huge one.

So I’m documenting here my digital photography backup process. This method has two parts: A easy one that every one can do, and the complex part just make sure that some lose ends are covered…

The easy part:

I use a external card reader to read my camera SD cards. Why? They are normally faster than connecting to the camera directly, and during the copy process the camera is safely stored. Also there is no fiddling with USB cables and low battery’s.  My Nikon D80 uses SD cards, and an external USB 2.0 card reader costs around 3€.

I also use Picasa to organize and browse my photos. So I copy all the photos from the cards to a meaningful named folder (Ex: 2008-Holidays_Portugal) under a root folder that I named Photograph, that Picasa scans automatically. After all photos are scanned by Picasa, it’s time for quality control.

Please notice that at this point I’ve not deleted anything from the cards. The cards are like the original master copy.

Using Picasa, I view and check every single photo that was copied. It can be time consume process but it’s necessary. This is to make sure if a corrupted photo appears, you can check the card to see if it happned during the copy process or not.

At this point still don’t format your cards. First make a backup of your Picasa folder!

So at this point you have all your photos checked, and it’s time for the first backup.

I use an external USB hard disk with it’s own power connection. This disk is always disconnected from the PC and from the mains. Why? If a power surge happens It can fry my computer, but it will not fry the hard disk and it’s power supply…

So run a Picacas backup procedure into your external hard disk. If you want you can also copy them to DVD, albeit my experience with DVD’s are not very good.

(If you have several hard disks, you can make multiple backups, for example, and one of the hard disks is stored at safe).

So now you have three copys of your photos: The master original on your SD cards, on your computer hard disk and on your external hard disk.

After seeing that all photos are ok, using the camera I format all the used cards. Why? First, formating on the camera will make sure that the card is usable by it, and second, if you don’t do this when using again the camera and the card has photos, you may get the doubt if you already have copy them or not…

So, now you are safe, right?

Well, more or less.

This is the point where the easy process end’s. With the above instructions, you are almost 100% covered, and if you store your external hard disk on a fire proof vault, it will be safe from fire or being stolen. Yet, it’s not safe if it fails, so you may use at least two different hard disk, preferably from different vendors, so that you do not hit the misfortune of a bad hard disk batch from the same vendor…

The complex part:

Despite of no hardware problems with the hard disks, data corruption happens, due to software or hardware glitch.  So I have a second level and a third level of data protection. These are based on the rsync command and on the Linksys NSLU2 with the SlugOS firmware that allows a full blown Linux operating system to be running on a device that consumes around 5W of energy… (http://www.nslu2-linux.org). I’ve installed on all my windows PC’s the DeltaCopy program.

This will allow to do backups into my NLSU2 rsync daemon of the folders and files that I want, namely my digital photography files. You can start the backup process manually or you can schedulle it at a time that it’s more probable that you have your home computer on.

So, all my data from my home computer, and wife’s laptop are backup into the NSLU2 external hard disk. This is just like the Picasa backup, but with the possibility of backing up other files also.

For protecting data corruption and inadvertent change on files, the NSLU2 is also running internally the rsnapshot program. This is in practice like Apple Time Machine or Linux Time vault, without the fancy interface.

So now I have a full history of all my files and associated changes, and if by any chance I do find a corrupted file or change that I want to revert, I can go to the snapshot folders and retrieve the file until a year ago if necessary.

Finally, because the NSLU2 can’t run inside a fire proof vault, I do an off-site backup by using rsync over ssh from my Kubuntu laptop located in my work. Ideally it should be another NSLU2 on the datacenter, but let’s keep this simple…

Because this is personal data, my work computer has an external hardisk for this. To avoid, if stolen, any access to my files all the backups are done into a TrueCrypt volume.

So at around two o’clock in the morning, my work computer connects through ssh to my home NSLU2 and rsync’s all changes into the truecrypt volume.

If the laptop is stolen and/or the hard disk is stolen, nobody will know what’s the data inside it.

Hope that this can give some ideas to how a complete set of instructions to backing up your photographs can be done.

Posted in Geral, Linux | Tagged: , , | Leave a Comment »

NSLU2: Using sftp-server with bash as shell

Posted by primalcortex on October 9, 2008

I’ve installed the bash shell on my Linksys NSLU2, and replaced the root’s shell with bash by editing the /etc/passwd file.

It worked fine, until I noticed that scp’ing to the NSLU2 didn’t work anymore… Reverting back to the sh shell, scp started to work again… The error was right after startup of scp it replied with “Connection closed”. No info on logs, what so ever.

I’m running SlugOS, and according to this thread: http://tech.groups.yahoo.com/group/nslu2-general/message/6537 it looked like a bash version bug.

Indeed I did have version 3.2-r2 installed… and so it would not work.

Because I have the optware repository enabled ( http://www.nslu2-linux.org/wiki/Optware/Slugosbe) I’ve checked that the bash version on this repository was newer. So:

- ipkg remove bash

- ipkg-opt install bash

- cp /opt/bin/bash /bin/bash

And while mantaining an open session, changed the shell to bash on one user and tried to logon. It worked.

And scp? It worked also, so with my finger’s crossed, I’ve changed again the root shell to bash, and logon on a new session. No problem. Indeed scp worked right away also.

So if any problems with scp failing, just upgrade your bash version.

Key words: sftp-server bash connection closed failed error 0

Posted in Linux | Tagged: , , , | 2 Comments »