Last week the EdgeRouter I use for my office did not come back after a reboot or perhaps I was too impatient, so I tried to reset it and that is when things went wrong.
Long story short, somehow I got the router into a state where it would not boot up anymore and the only way into it was the console port, for which I did not have a cable. Then I managed to find an old article which messed up my the routers USB drive so things took a turn for the worst. But fear not, it all worked out in the end, even though the only help I got from UBNT support was absolute zilch.
Here I outline some useful links for anyone else that may run into this issue, but mostly so I have it documented for next time ;). Before I get started here, the credit on everything here goes to others who documented this well on various locations.
Connecting to the console
In order to connect to the console, you will need a USB to RJ45 cable. I bought one off of Amazon which worked great right out of the box for me.
In order to connect (on a Mac), all you need to do is run:
> ls -ltr /dev/*usb*
crw-rw-rw- 1 root wheel 21, 3 Jul 17 15:48 /dev/cu.usbserial-AI038TPF
crw-rw-rw- 1 root wheel 21, 2 Jul 17 08:56 /dev/tty.usbserial-AI038TPF
> screen /dev/tty.usbserial-AI038TPF 115200
Useful links
There are a few links that were helpful here and I have them listed here, but I am going to outline what I had to do ultimately since I followed the first one and it messed me up more.
(ARCHIVED) EdgeRouter – Last Resort Recovery – DO NOT USE, Only as reference.
Recovering an unresponsive Ubiquiti EdgeRouter Lite router – DO NOT USE, Only as reference
EdgeRouter – Manual TFTP Recovery – Try this link first.
mkeosfs – easily generate USB image for EdgeRouter
The third link above is perhaps the first thing you should try if you have not messed up your router bad enough, but I had to use the 4th and 5th links.
The EdgeRouter’s USB Drive
I kept reading about this, and could not believe that there was a usb drive in the edge router, but I guess ultimately that was a good design for when it goes bad and these routers used to have a history of the drives going bad.
There are three screws on the back of the router that you can open and the router comes apart (Note: you may void your warranty by doing this). Then the flash drive is right in your face.
Recovering the file system
Once the USB drive is unplugged, connect it to your PC/Mac and run the commands to recreate the drive. I found the easiest way was to use the mkeosdrive script provided in the last link above.
I ran the commands below, but if you read the GitHub site properly, there is a way to recreate the drive and include your backup in there as well.
# Get the path to the USB drive
> sudo disk -l
# Then run the command to create the drive
> sudo ./mkeosdrive /dev/sdb ER-e100.v2.0.4.5199165.tar
Rebooting the router
Once the USB drive is ready, plug it back into your router, close things up. Then just wire it up and wait for it to boot. It should be back to normal.
I also found other links where folks talk about creating a backup of the USB drive in case something like this happens again, but what are the chances of that……right? 😉