Sunday, September 23, 2012

Updating to PirateBox v0.5.1 on the MR3020

Updating an existing PirateBox to a newer version on the MR3020 is somewhat different than making a clean install. It is very similar, but one must pay attention to some details that can slow down the process.
The version 0.5.1 comes with the lighttpd web sever that allows an easy design of an user interface that is presented to users. The web pages ("UI" in this case) can be simply created using html and CSS and easily uploaded to the PirateBox whereas with previous versions there was only a limited area for changes.

What you will need

Known I guess from the previous installation process, but just for the sake of completeness:
  • MR3020 with previous PB installation (obviously...)
  • 1 x Ethernet cable
  • 1 x USB flash drive for the MR3020 (external HDD etc also fine)
  • Linux based computer
  • Home router with Internet access
Moreover you should know:
  • The IP address of your home router
  • The root password of your MR3020 (this was set when you installed PB for the first time, find it)
Also you will need some knowledge about the "vi" editor, if you have not used it too much before here is a quick guide with the functions you will need:
  • i - Enter edit mode
  • ESC - Exit current mode, e.g. exit edit mode
  • :q! - Quit without saving the changes
  • ZZ - Save changes & quit


OpenWRT is already installed so those first steps can be ignored here, only the PirateBox package needs to be removed and updated with a new one. Note that you will need Internet connection and hence direct access to your home router for this, off-line installation does not work! (The package downloaded later on is a script package that downloads other packages and configures them, hence Internet access is necessary)

Step 1.

Set a fixed IP address to you PC in the same subnet as your PirateBox, assuming it has the IP set your PC to
You can set a fixed IP by going to "Edit Connections/Wired/Edit", refer to the image below (I renamed my wired connection to "Cable", this is only personal preference).

 Step 2.

Connect your computer with the ethernet cable to your MR3020 and SSH into your PirateBox on the address (providing you didn't change this after the previous install). In Ubuntu you will need root access to ssh, so

     sudo ssh root@

After providing your root password and the root password to your router you should now be presented the OpenWRT screen:

 Step 3.

Now edit the network file and check that your settings are OK there. You have to make sure that your MR3020 is on the same subnet as your home router. Now at this point it is likely that your home router will be the dominant, hence check your home router. (Example: if your home router is then you will have to set the MR3020 to and reboot it for the changes to take effect. "Option gateway" is the home router)
Also an important aspect that if the last 2 DNS entries were removed from the bottom of the file (for most users it has caused redirect errors and hence was often removed) then these need to be put back for the duration of the update. These are necessary to connect to the Internet later on.

     vi /etc/config/network

And make it look similar:
Where is the IP address of the MR3020, is the address of the home router and is a google public DNS.

Step 4.

I assume that if the first time you managed to connect to the Internet and install a previous version of the PB your firewall settings are OK. Again just to make sure it is fine, refer to the image below

     vi /etc/config/firewall

Step 5.

If all these settings are OK disconnect you PC and connect your PB to your home router via ethernet cable. Connect to it through wi-fi and SSH into it just like before.
Firstly PirateBox needs to be stopped and the old image removed, type

     /etc/init.d/piratebox stop
     opkg remove piratebox

Step 6.

Now just to make sure you are connected to the Internet, ping

     ping -c 5

If you are getting a response it's OK. if not, then you are not reaching the Internet for some reason, in this case go back a few steps and make sure that your settings are OK. (primarily IP subnet and DNS entries in /etc/config/network)

Step 7.

The last step now is to install the new PirateBox image:

     cd /tmp
     opkg install piratebox *

"wget" will download the new PB package and opkg will install it (yes you need the * at the end of the command). Wait until it finishes, reboot when prompted and you are done.

No comments:

Post a Comment