This is the long version of a short, avoidable mistake. The router worked. I reflashed it anyway. It stopped working. I spent an evening getting it back. If you've ever stared at a dark router wondering whether you've just turned £40 of hardware into a paperweight, this one's for you, and there is a happy ending, mostly.
The device was a small consumer router that had been running its stock firmware faultlessly for a couple of years. It wasn't slow, it wasn't insecure in any way I'd noticed, it wasn't doing anything wrong. But it was on the OpenWrt supported-devices list, and I'd been meaning to consolidate my home network onto a single firmware I actually understand. So on a quiet Friday I decided today was the day. This is the part of the story where a wiser person stops.
the flash that went fine, and the boot that didn't
Flashing went exactly to plan. Stock firmware has a perfectly good web upload, OpenWrt publishes a factory image specifically for the first flash from stock, and the upload completed without complaint. The router rebooted, came up on 192.168.1.1, and there was the LuMI interface looking smug. Wonderful, I thought. Done before dinner.
I made one change in the web UI, a configuration tweak I no longer think was even the cause, and rebooted to be sure it stuck. And on that second boot, nothing. No DHCP lease on my laptop. No reply to a ping on the default address. The power light was on. One other light blinked in a pattern that meant nothing to me. Everything else was dark.
I tried the obvious things first, because you always do and occasionally it works. Power-cycle. Different cable. Different port. A static IP on my laptop in case DHCP was the only casualty. Nothing answered. Then the OpenWrt failsafe dance, which on many devices is "hold reset during early boot to drop into a recovery mode on a known address". I held the button until my finger ached. Either this board doesn't expose failsafe the way I expected, or whatever I'd broken happened before failsafe gets a chance to run. No recovery mode appeared.
At that point I had a router that booted far enough to turn a light on and no further, and no network path to it whatsoever. Which left the option I'd been quietly hoping to avoid.
serial is the answer, it's almost always serial
Nearly every device like this has a serial console on the board, even when the manufacturer doesn't advertise it. It's how the firmware engineers debugged it in the first place, and they rarely bother to remove the header. Find that, and you can watch the boot, talk to the bootloader, and recover a device that has no working network at all.
I opened the case. Four screws under the rubber feet, a bit of plastic-clip persuasion, and the board was out. There, near the edge, was the usual giveaway: four unpopulated through-holes in a neat row. Ground, transmit, receive, and one for 3.3V that you leave well alone. Working out which pad is which is the only fiddly bit.
Ground is the easy one: continuity test against a known ground, the shield of a port works nicely, and it beeps. For the rest I powered the board, set my multimeter to volts, and watched the pads. Transmit sits high at idle, around 3.3V, and twitches when the device boots as it spews boot messages. Receive sits near zero and doesn't move on its own. That's usually enough to label them without guessing. I soldered three thin wires to ground, TX and RX, and left the voltage pad empty, because the board powers itself and feeding it a second 3.3V source is how you make a brick permanent.
The adapter is a cheap USB-to-serial dongle, the kind everyone has in a drawer, set to 3.3V logic, not 5V. Get that wrong and you can damage the very pins you're trying to talk to. TX on the board goes to RX on the adapter and vice versa, which is the rule everyone gets backwards at least once, including me, ten minutes earlier this very evening.
picocom -b 115200 /dev/ttyUSB0
115200 baud is the near-universal default for these. I plugged in the router and was rewarded with a wall of boot text scrolling past, which after an evening of silent darkness was genuinely a lovely sight. The bootloader was alive and well. Whatever I'd broken was the main firmware, not the thing that loads it, and that distinction is the whole difference between "annoying" and "dead".
the bootloader had a recovery mode all along
The boot log told me the bootloader was U-Boot, and it offered the usual prompt: hit a key in the first couple of seconds to interrupt the autoboot. I did, and got a shell. From there, U-Boot on most of these devices can pull a firmware image over the network by TFTP and write it to flash, entirely independent of the broken firmware sitting in the way.
The dance is roughly: set the device's IP and the IP of the TFTP server, point a laptop with a static address and a running TFTP daemon at it, and tell U-Boot to fetch and flash the recovery image. The exact commands vary by board, and the boot log helpfully printed the environment variables it expected, so I wasn't guessing. I dropped the OpenWrt sysupgrade image into the TFTP root, ran the load, watched it transfer, watched it write, and held my breath through the part where you absolutely must not lose power.
It rebooted. The light pattern changed to something cheerful. My laptop got a DHCP lease. LuMI came up. The router was back from the dead, over three wires I'd soldered onto pads the manufacturer pretended weren't there.
what I actually learned
The recovery wasn't hard. It was just slow, and it was entirely self-inflicted. A few things worth keeping:
- The bootloader is your safety net, and it's almost never what you break. If it survives, the device is recoverable, full stop. Knowing that turns panic into procedure.
- Solder the serial header on before you flash anything, not after the thing is already bricked and you're working tired and annoyed. Future-you will be in a much better mood.
- 3.3V logic, and never feed power into the voltage pad on a self-powered board. Two of the easiest ways to turn a recoverable brick into a real one.
- TX to RX, RX to TX. Write it on a sticky note and put it on the desk.
And the largest lesson, the one I keep failing to internalise: the router was fine. It owed me nothing. I reflashed a working device out of a vague desire for consistency, and the consistency I got was the consistency of an evening spent soldering instead of relaxing. OpenWrt is genuinely nicer to live with, and I'm glad it's on there now. But if you'd asked me at 22:40, multimeter in one hand and a half-bricked board in the other, whether it was worth it, you'd have got a shorter and ruder answer than this post.
If it isn't broken, leave it alone. If you can't leave it alone, at least solder the header first.