In an attempt to learn more about OpenWrt, I tried to install bash instead of ash on my MR3020 with piratebox on it. Except I did it the stupid way and edited some conf file (shell preferences maybe) to use bash directly, even though it didn't exist on the device. Well that was that. Couldn't really get off that.
So I bought another MR3020, and bungled the install of that one. I filled with it for many hours trying to fix it, but gave up and got a MR3040, then carefully followed the instructions for LibraryBox, a project based off Piratebox, and got that one to work.
You have to keep the switch on the side to WISP.
Problem is, the LibraryBox looks awful on a smartphone (I guess because the webserver it has doesn't react properly to mobile user agents.). So I decided to retry the install of the second MR3020.
Note: I had installed the OpenWRT firmware provided on either LibraryBox or Piratebox, so had to go back.
1. I tried to reinstall the default device firmware .bin file without taking off the bootloader bit, and got an error "failed to erase block".
2. On this page I learned that I should not reboot or shutdown the router as that might brick it. Instead, I served up the OpenWRT from Piratebox, renamed as generic.bin, via netcat.
On the serving machine, I used this in Command Line in the folder containing netcat on Windows 7.
nc.exe -l -p 3333 < generic.bin
On the receiving machine I used something like nc 192.168.x.x 3333 > /tmp/generic.bin (see here at the bottom for guidance).
Then I committed the generic.bin file with mtd write /tmp/generic.bin firmware (no -r for reboot).
Now I had the "base"-line OpenWRT image that is used in the installation guide on Piratebox.cc website, on the router.
Then, I followed Step 2 of this guide. It worked fine. I was able to ping DNS from my router.
Next, knowing that version 0.3-2 of piratebox was definitely old, I decided to use a command similar to the instructions but with a newer ipk version. I went to the website http://piratebox.aod-rpg.de which turned out to be yet another website hosting Piratebox scripts. Turns out the old ipk didn't exist there at all.
But I found the link: https://wiki.openwrt.org/doc/howto/piratebox.librarybox.openwrt.routers
And followed the guide located there, and discovered that the OpenWRT box didn't have enough space for the installation. Turns out that rewriting firmwares may not remove the old stuff, which still takes up space. Searching Google turned up suggestions to repackage the firmware myself, definitely not an evening's work.
(I suspect that the automatic installation process of the PirateBox, with the separate install folder on a USB key, gets around the insufficient space issue by loading an external storage device and then creating the filesystem, with the proper directory structure, on it directly.)
Then I considered removing the /tmp directory, but it has a bunch of files that do not get deleted between reboots, so they must be important. At my wits' end, I placed the router into failsafe mode and ran the mount_root command to clear everything, served the generic.bin file via netcat again, installed it, got access to the internet, tried to install just the piratebox package from here and found I was still out of memory.
Side Note about USBs: Piratebox can only use FAT32-formatted USB keys. I tried formatting these things using Windows formatting and Linux tools, and nothing seems to work right. Kingston DataTraveler USB keys, in the 64GB size that I prefer, come pre-formatted in FAT32. The key is not to format them again, but instead just delete files as needed. When upgrading the Piratebox, your USB key should not contain anything other than the "install" folder. Piratebox, during the automatic installation, will create the proper directory structure. 64GB is quite enough for enough movies to last you, and the people around you, a number of flights. Additionally, USB 2.0 is supposed to work better, even though the copy speeds are abysmal.
Then I used a pre-existing FAT32-formatted 64GB USB disk, put the install folder from the piratebox_install zip file, and followed the instructions on the Piratebox.cc DIY page, from the upgrade PirateBox section, waited 45 minutes, and voila the PirateBox worked again.
Another note. When I installed the generic.bin file I ran passwd, which in OpenWRT disables telnet and enables ssh, and set the root password. Now, after the Piratebox install completed successfully, this root password plus SSH was what I used to access the box. No need to disable telnet, it's already been done.
Now I will just leave OpenWRT on this little thing completely alone.
So I bought another MR3020, and bungled the install of that one. I filled with it for many hours trying to fix it, but gave up and got a MR3040, then carefully followed the instructions for LibraryBox, a project based off Piratebox, and got that one to work.
You have to keep the switch on the side to WISP.
Problem is, the LibraryBox looks awful on a smartphone (I guess because the webserver it has doesn't react properly to mobile user agents.). So I decided to retry the install of the second MR3020.
Note: I had installed the OpenWRT firmware provided on either LibraryBox or Piratebox, so had to go back.
1. I tried to reinstall the default device firmware .bin file without taking off the bootloader bit, and got an error "failed to erase block".
2. On this page I learned that I should not reboot or shutdown the router as that might brick it. Instead, I served up the OpenWRT from Piratebox, renamed as generic.bin, via netcat.
On the serving machine, I used this in Command Line in the folder containing netcat on Windows 7.
nc.exe -l -p 3333 < generic.bin
On the receiving machine I used something like nc 192.168.x.x 3333 > /tmp/generic.bin (see here at the bottom for guidance).
Then I committed the generic.bin file with mtd write /tmp/generic.bin firmware (no -r for reboot).
Now I had the "base"-line OpenWRT image that is used in the installation guide on Piratebox.cc website, on the router.
Then, I followed Step 2 of this guide. It worked fine. I was able to ping DNS from my router.
Next, knowing that version 0.3-2 of piratebox was definitely old, I decided to use a command similar to the instructions but with a newer ipk version. I went to the website http://piratebox.aod-rpg.de which turned out to be yet another website hosting Piratebox scripts. Turns out the old ipk didn't exist there at all.
But I found the link: https://wiki.openwrt.org/doc/howto/piratebox.librarybox.openwrt.routers
And followed the guide located there, and discovered that the OpenWRT box didn't have enough space for the installation. Turns out that rewriting firmwares may not remove the old stuff, which still takes up space. Searching Google turned up suggestions to repackage the firmware myself, definitely not an evening's work.
(I suspect that the automatic installation process of the PirateBox, with the separate install folder on a USB key, gets around the insufficient space issue by loading an external storage device and then creating the filesystem, with the proper directory structure, on it directly.)
Then I considered removing the /tmp directory, but it has a bunch of files that do not get deleted between reboots, so they must be important. At my wits' end, I placed the router into failsafe mode and ran the mount_root command to clear everything, served the generic.bin file via netcat again, installed it, got access to the internet, tried to install just the piratebox package from here and found I was still out of memory.
Side Note about USBs: Piratebox can only use FAT32-formatted USB keys. I tried formatting these things using Windows formatting and Linux tools, and nothing seems to work right. Kingston DataTraveler USB keys, in the 64GB size that I prefer, come pre-formatted in FAT32. The key is not to format them again, but instead just delete files as needed. When upgrading the Piratebox, your USB key should not contain anything other than the "install" folder. Piratebox, during the automatic installation, will create the proper directory structure. 64GB is quite enough for enough movies to last you, and the people around you, a number of flights. Additionally, USB 2.0 is supposed to work better, even though the copy speeds are abysmal.
Then I used a pre-existing FAT32-formatted 64GB USB disk, put the install folder from the piratebox_install zip file, and followed the instructions on the Piratebox.cc DIY page, from the upgrade PirateBox section, waited 45 minutes, and voila the PirateBox worked again.
Another note. When I installed the generic.bin file I ran passwd, which in OpenWRT disables telnet and enables ssh, and set the root password. Now, after the Piratebox install completed successfully, this root password plus SSH was what I used to access the box. No need to disable telnet, it's already been done.
Now I will just leave OpenWRT on this little thing completely alone.
No comments:
Post a Comment