Ramblings of an aging IT geek
← Ramblings of an aging IT geek
hardware

the router worked fine until i decided to improve it

A perfectly good router, a bored evening, a serial console, and the precise moment I learned what an unpopulated UART header is for.

A soldering iron and electronics on a bench

The router was working perfectly. That's the important part. It had been routing packets without complaint for two years, doing exactly the unglamorous job a router is supposed to do, and on a Tuesday evening with nothing better to occupy me I decided it could be doing that job slightly better on OpenWrt. It could not, as it turned out, do that job at all for the next four hours.

The plan was simple and the plan was wrong in the way plans usually are: flash the new firmware through the stock web interface, reboot, enjoy. The image was the right model. The image was the right version. The web interface accepted it, showed me a progress bar, and then showed me nothing ever again. No lights doing anything sensible, no DHCP, no ping, no web UI. A brick, in the technical sense, sitting smugly on the desk.

A close-up of a circuit board

Here is where the evening turned from "annoying" into "actually quite educational." Most of these little routers have an unpopulated UART header on the board, three or four through-holes near the SoC marked, if you're lucky, with something like TX, RX, GND. That header is a serial console straight into the bootloader, and the bootloader is the bit that usually survives a botched firmware flash precisely because you didn't overwrite it. The main image was gone. U-Boot was still there, sulking but alive.

So out came the soldering iron, a USB-to-serial adapter at 3.3V logic (not 5V, unless you enjoy releasing the magic smoke), and a steadier hand than I felt I had. Solder onto TX, RX and GND, leave the supply pin well alone, cross the wires the right way round which I of course did not do on the first attempt, and 115200 baud later a glorious wall of boot text appeared in the terminal. The board wasn't dead. It just had nothing to boot.

From the U-Boot prompt the recovery was almost anticlimactic: set up the network parameters, point it at a TFTP server on my laptop holding a known-good image, and let the bootloader pull the firmware straight into flash without ever trusting the web UI again. A few minutes later it came up clean, on OpenWrt, doing the job it had already been doing perfectly well two years and one ego-driven decision earlier.

The lesson isn't "don't flash routers." Flash all the routers you like. The lesson is that the serial console is the difference between a four-hour recovery and a trip to the bin, and the time to find that header is before you brick the thing, not after. Now I check for the UART pads first, every time, and I keep a TFTP image and a soldered-up adapter ready. The router that works fine is, of course, still the one you should leave alone. I will absolutely not be doing that.