Adventures installing OpenWRT
I recently got my MikroTik RB2011U, and I wanted to install OpenWRT on it.
The MikroTik RouterBOARD has a "Netinstall" mode, in which it connects to `eth1` and receives a kernel to boot from using TFTP (the Trivial File Transfer Protocol). I ended up with this small script, based on something from the OpenWRT documentation:
Once the router attempted to connect to the DHCP server with the hostname `OpenWrt`, I killed the TFTP server.
This worked - the router was now running OpenWRT from RAM.
Then, I disconnected my laptop from `eth1` and plugged it into `eth2`. The OpenWRT initramfs is configured to act as a DHCP server on `eth2` through `eth10`.
At this point, I `ssh`ed into the router:
(In the future, commands starting with `$` are on the host computer, and commands starting with `#` are on the router.)
I now had a root shell on the router! So far so good.
I then `scp`ed the OpenWRT sysupgrade onto the router:
and proceeded to `sysupgrade` the router:
At this point, the router closed the SSH connection and entered a boot loop.
I tried repeating the previous steps, replacing stable (18.06.4) OpenWRT with the snapshot. (The RB2011U v2 is listed as only supported by OpenWRT snapshot.)
In vain, I tried pinging the router as it boot looped. It never responded.
This meant that it was crashing and burning *before* networking was initialized. (This also meant that OpenWRT failsafe mode wouldn't help.)
So, I tried to read the kernel logs from flash memory:
Maybe I need to specify the filesystem type? JFFS2 seems likely:
That last case was interesting, so I pulled up another SSH connection and:
It appears that there's no JFFS2 filesystem on /dev/mtdblock6. That makes sense, given:
It would appear that `mtd6` has UBIFS on it, but:
At this point, I decided to dump `/dev/mtd6` to my laptop, and do some forensics:
Wait! UBI is `ubi`, not `ubifs`:
By this point, I've installed `ubi_reader` on my laptop and I go back there to do some diagnostics:
Interesting. It appeared that OpenWRT did not successfully flash, but it failed consistently. (By this time, I had re-flashed OpenWRT quite a few times.)
At this point, it was 5:00 in the morning, so I decided to go to sleep.
Update: I returned that router and bought another one. Same problem. I decided to give up.
: OpenWRT has a `sysupgrade` command which takes a firmware image and installs it. The install procedure for MikroTik RouterBOARDs is to run OpenWRT from RAM using TFTS, then use `sysupgrade` to flash a firmware upgrade.
Back to the home page