Edgerouter X – Firmware upgrade fails

IMPORTANT! Read this BEFORE you attempt to upgrade the FW of your edgerouter.

There seems to be a faily common issue now that the firmware upgrade fails when done through the webgui and many recommend doing it only through CLI (Command Line Interface).

I had to return a brand new edgerouter with fw 1.7.0 after the upgrade failed using the webgui.

Root cause
There is not enough free diskspace on the root filesystem for the existing, plus new compressed and uncompressed firmware. The disk will go full during the upgrade and if you are as lucky as me it will BRICK YOUR DEVICE.
I tried all the factory resets and TFTP recovery, it was dead.

Trying to upgrade will most likely result in something like this:

ubnt@erx:~$ add system image ER-e50.v1.10.11.5274269.tar
Checking upgrade image…Done
Preparing to upgrade…Done
Copying upgrade image…Not enough disk space for root file system

ubnt@erx:~$ df -h
Filesystem Size Used Available Use% Mounted on
ubi0_0 214.9M 137.5M 72.7M 65% /root.dev
aufs 214.9M 137.5M 72.7M 65% /

Solution

1. Download the newest firmware from the ubiquiti website:
https://www.ui.com/download/edgemax/edgerouter-x

2. Copy the firmware from your Linux computer over to the router (replace versions/IPs/etc as needed):
scp ER-e50.v1.10.11.5274269.tar ubnt@192.168.1.1:.
(or if you are on Windows; pull your hair, smash the keyboard a bit and then download Filezilla)

3. Login to your edgerouter through ssh like:
ssh ubnt@192.168.1.1
or if you are still using Windows, pull out the rest of your hair, scream out “Schpielen!!!” and smash the rest of your keyboard before downloading PuTTY

4. Here is the clue. Now you move the firmware to the /tmp directory as it resides on a different partition than your root filesystem:
ubnt@erx:~$ mv -i ER* /tmp

5. Now you may start the firmware upgrade with a command that may look something like this:
ubnt@erx:~$ add system image /tmp/ER-e50.v1.10.11.5274269.tar
Checking upgrade image…Done
Preparing to upgrade…Done
Copying upgrade image…Done
Removing old image…Done
Checking upgrade image…Done
Copying config data…Done
Finishing upgrade…Done
Upgrade completed
ubnt@erx:~$

tl;dr root partition goes full during upgrade so move firmware.tar to /tmp before upgrading.

Hope this helps some other smuck from having to return a dead router to the shop and if nothing else it will serve me as a guide the next time I do an upgrade on one of these myself.