Thursday, May 10, 2018

OpenWRT on a Ubiquiti EdgeRouterX - Part II

So in Part I, I built the source from scratch and generated an image that I could load onto a Ubiquiti EdgeRouterX device.

This worked - in the sense that I was able to boot that image and get a functional and working OpenWRT (LEDE) image.

The router handed me an IP address like it should have. The router was passing my packets out to the web and back, performing its SNAT functions like a good little router should.

The problems started when I tried to use the package manager.

The first problem I ran into using the package manager was the fact that the urls in the feeds.conf file were not resolving. They were all using openwrt.git.org. This may have been because the git sites for openwrt were down (temporarily). I fixed these urls by looking out on the web for the actual github urls, and commenting out the git.org sites and using the github sites instead.

Once I fixed this issue, I noticed that I kept getting an error from the opkg utility about having zero bytes in the overlay file system.

In looking, I did not have an /overlay file system. I had a directory off the root directory called /overlay.

In doing a google search on this issue I found a number of forum posts but when you clicked them, they links timed out.

Clearly, something went wrong when I built the image.

I typed the mount command, and saw a / mounted on a rootfs file system. I saw a tmpfs on /tmp. But no overlay. I didn't really understand the overlay file system anyway, so I was in trouble there. I knew enough to believe I might be able to manually mount this file system on a device, but I didn't see the device and things looked quite intimidating.

I began to realize that I was quite screwed. I had a router that I could not administratively update or manage because the file system was not "correct". I considered paper clipping (hard reset) the router, but I wasn't sure what that would do since I had replaced the original flash image from Ubiquiti with the one from OpenWRT. It seemed risky to do that.

I finally found a page that allowed me to take a more sensible risk. I found a page that had hardware / firmware images, and I decided to "upgrade" my router with the new image listed on this page. I wasn't sure if that would actually fix the file system layout on the flash or not, and I suspected it wouldn't, but I gave it a try nonetheless.

So after downloading the new flash image, I discovered another issue. This image I had built did not include the Luci GUI, so I needed to do anything and everything via command line. I found a way to upgrade the router via command line with this link:

https://openwrt.org/docs/guide-user/installation/sysupgrade.cli

Using ssh, I copied the downloaded image into a temporary directory and ran the command:
sysupgrade -v /tmp/*.bin
And - lo and behold - after rebooting, I got a new, much superior image and experience. I had the Luci GUI. The file system looked proper.


Now we have a /dev/root on /rom of type squashfs - something we did not see before.
Most importantly, we see the overlayfs mounted on the / folder in a directory called /overlay.
And some others we did not see before, either.

Things look better. We can launch a GUI and we can update our packages now. I installed OpenVPN, for example, which added itself to the "Services" menu.

No comments:

Fixing Clustering and Disk Issues on an N+1 Morpheus CMP Cluster

I had performed an upgrade on Morpheus which I thought was fairly successful. I had some issues doing this upgrade on CentOS 7 because it wa...