Rising from the ashes: NSLU2

Despite having a Synology Diskstation DS212+ for storing my data (photos, videos and PC/laptop backups), I also backup that data to an external disk connected to my faithful Linksys NSLU2 bought in 2005 using rsync from the Diskstation.

The NSLU2 is flashed ith the openSlug 5.3Beta firmware since 2009 (when it came out), with the operating system installed in a crappy 2GB SD card.

But this weekend due to a power failure, the NSLU2 failed to boot up. It kept the amber led blinking signalling that it couldn’t forward from the initial stages of booting up.

Using my desktop computer, I’ve FSCK’ed the external disk filesystem, that had some inconsistencies, nothing serious (most of the time it is dormant), and FSCK’ed the SD card, and, well, most of the /etc and /var directory where gone.

Due to having a backup of the SD card (these things die…), I’ve recovered the /etc directory, but still the NSLU2 didn’t boot.

Booting up without SD card, the NSLU2 did finish booting up, but it wouldn’t ping, neither the original IP address (192.168.1.77) neither the configured IP address. All I had on my Linux machine was incomplete at the arp table…

nslu2 (191.168.1.32) at <incomplete> [ether] on enp4s0f2

Not good….

I’ve flashed it again with the openSlug firmare, but still I was unable to ssh to it so I could initialize. Because I was able to flash it again with the upslug2 tool, it mean that the ethernet port was ok, and probably everything was ok, except the NVRAM settings that define the ip address where pretty much corrupted… Let’s hope that.

So the solution was to boot into RedBoot and erase the NVRAM (http://www.nslu2-linux.org/wiki/HowTo/ResetSysConf) with the following command: fis erase -f 0x50040000 -l 0x20000  (Attention to this command!!!! Don’t get it wrong)

And then upgrade from the RedBoot interface. The original Linksys firmware was flashed and after rebooting this firmware initialized the NVRAM with default settings: IP address 192.168.1.77, and bingo, ping works, and I can access the original Linksys Web Interface. On the web interface I’ve configured the old IP address, DNS, host name, and so on, and rebooted.

After reseting the NVRAM from redboot you must install the original Linksys firmware, because the openSlug doesn’t initialize the NVRAM.

Everything was fine, and the NSLU2 was working on the new IP. From this point on I’ve just flashed again the openSlug firmware, and formatted the SD Card (turnup with the memstick otion), and configured everything again (crontab, ntpclient and rsync daemon).

In no time I had the Diskstation again backing up to the NSLU2 external disk.

So, welcome again NSLU2 🙂

Advertisements

Aiptek MegaCam 1.3 on the NSLU2

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.

Backup your digital photographs

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 them, there was almost no way to get it back. But at least the photo prints might be available.

With digital cameras, all photos are computer files, are easier to mantain, easier to copy, and yes, also 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 loose 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 Photos, 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 happened during the copy process or not.

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

So now 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 Picaca 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 ends. 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 disks, 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 DeltaCopyprogram.

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 rsnapshotprogram. 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.

NSLU2: Using sftp-server with bash as shell

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