Upgrading my LibraryBox - to a bigger flash drive & to version 2.1
LibraryBox is a nice way to share content with family/friends/community. I setup a LibraryBox a year ago using a TP-Link TL-MR3040 wireless router & an old 16GB USB flash drive. B.t.w this one is a portable Wireless n router with a built-in battery that allows one to use the LibraryBox on the move without having to worry about a power source.
A couple of weeks back I was checking the LibraryBox site for new developments and found that there was an update available, one of the features that it promised was painless auto updates to LibraryBox in the future. Having bought a tiny USB adapter for MicroSDHC cards recently I wanted to move the LibraryBox setup from the old USB Flash drive to a new class 10 64GB Micro SDHC card. Also I wanted to upgrade my LibraryBox to the latest version (v2.1) as of this writing.
Embarking on this journey, one of the weekends, I started following the instructions to upgrade. In no time I hit a roadblock. I had forgotten the ssh password for my box. After trying to recollect the password & fiddling a bit, I put it aside for another-day that turned out to be today.
I wanted to capture this experience in a post with the belief that it would help me another day and for the benefit of all who might be in a similar situation.
So here are the three main tasks in front of me:
Upgrading the USB flash drive
Resetting the forgotten SSH password
Upgrading the LibraryBox to the latest version.
Upgrading the USB flash drive
I used the dd command on Linux to clone my 16GB Flash Drive. I cloned it to a file on my computer and then used it as a source to write to new MicroSDHC card.
execute fdisk -l as root to list the UBS devices
Assuming /dev/sdb is your USB flash drive execute dd if=/dev/sdb of=/path/to/destination/librarybox-image.dd conv=notrunc to create an image of the drive to a file (the device could as well be be /dev/sdc, /dev/sde etc.,)
execute dd if=/path/to/librarybox-image.dd of=/dev/sdb conv=notrunc to write the image to the new flash drive (again assuming /dev/sdb is the target drive)
This would take some time depending on the size of the drive/image
First Pitfall: I looked up the MR3040 manual, trying to reset the router to factory defaults. Tried many times to reset and access the settings page on 192.168.0.1. It wouldn't work because the firmware is already updated to LibraryBox and the behavior of the original firmware of MR3040 isn't applicable anymore. My second pitfall was missing the mount_root before trying to change the password using box_init_setup.sh
I did the following to reset the password,
Power off MR3040 router and select the WISP mode
Connect MR3040 to the computer via Ethernet
Change the IPv4 address of the computer to 192.168.1.2, net mask 24 or 255.255.255.0
Open a terminal and start a ping to MR3040 on the fail safe IP 192.168.1.1
Be ready with a Toothpick to press the reset button and power on the MR3040
Press the Reset button a few times during boot up and see that Ping is getting a response in the terminal
Execute mount_root at the prompt
Next execute box_init_setup.sh
Choose the option to change the password, change the password, exit and power off
Following the instructions on upgrade page is not too difficult, though patience to wait is expected during the upgrade process (it may take 45 minutes or more). The instructions listed below are from that page.
Plug the new flash drive that you are going to use for the LibraryBox to the computer
Download the firmware MR3040 - Version 2 firmware (this is for my device, could be different for yours) and copy the file to the flash drive.
Eject the drive from the computer and plug it to MR3040 when it is powered off
Connect the router to the computer via Ethernet and Power up the router
ssh [email protected] (if the password doesn't work, follow the steps to reset the SSH password)
Navigate to the /mt/usb directory cd /mnt/usb
ls should show you the firmware file that you copied on to the UBS drive
execute sysupgrade -n YOUR_FIRMWARE_NAME_HERE use tab key at the end of openwrt for auto completion of file name at the prompt
After the upgrade completes, the router will restart twice. Just be patient and let it blink for 10-15 minutes.
Once the lights on the routers are in a steady state, turn off the router and remove the USB flash drive and insert it into your computer.
Download the LibraryBox v2.1 Install folder (as zip file) MD5 Hash: 85BF5A80220B9C8204303C6099908A7D
Extract the install_librarybox.zip file and drag the “install” folder over to your USB flash drive (rename or mv the existing install folder before this)
Navigate to the USB drive and into the LibraryBox folder. Rename the Content and Config folders to Content_old and Config_old respectively. The v2.1 upgrade will generate new Content and Config directories...if you have customized anything in these folders, you will need to re-copy those customizations into the newly created folders.
Now SAFELY REMOVE your USB drive from your computer and plug the USB stick into your router.
Power the router on. That will trigger the installation of the new packages. Note: You should wait 15-20 minutes for the installation to complete (depending upon your USB flash drive, it may take up to 45 minutes - be patient!). Your device will reboot a couple of times during the installation.
Once the installation is complete, you can use telnet to connect to the device through telnet 192.168.1.1
Please feel free to suggest any changes through comments. Visit the LibraryBox Project Page for new installations and more info