Recover from a bad flash

From DD-WRT Wiki

Revision as of 00:50, 13 July 2009 by Demosthenes (Talk | contribs)
Jump to: navigation, search


So, you're afraid you've bricked your router. Don't worry, there are a number of things you can try to get your router working again before giving up and living with the fact that your router is now a paperweight.

It is also unfortunately possible to configure your router in ways which make it dead to the world. These techniques may be useful in these cases also.

Before you continue below, make sure you've first tried a hard reset to revive your router:

  1. Disconnect the router from UTP cables (not the power cable).
  2. Push reset button for 30 secs.
  3. Without releasing reset button, disconnect power cord.
  4. Hold the reset button for another 30 secs.
  5. Replug the power cord.
  6. Still hold the reset button for another 30 secs.
  7. Release the reset button and give the router about 10 secs to resettle.
  8. Disconnect power cord for another 10 secs and then reconnect.
  9. All should be in default settings now.


Contents


WRT54G/GL/GS

The LED display at the front of the router is the best way to determine what type of brick you have and its recovery method. You should at least check this to prevent unnecessarily opening the router.

When the web interface is no longer available, switch the router off first (remove the power jack) and remove all network cables from the equipment. After some seconds you restart the WRT54G. Now take note of the flashing LEDs.

  1. The power LED flashes very fast. If it keeps on flashing longer than 2 minutes, without having lit up the other LED's, then a defective bootloader is present. If you can ping 192.168.1.1 you can try the TFTP recovery, otherwise you may need to open the router and use the JTAG recovery method below.
  2. The power LED flashes very fast and after some seconds the DMZ LED lights up for approximately 5 seconds. In this case the Bootloader is intact and only the kernel (firmware) is defective. In this case you could possibly still recover with an ethernet cable if you reflash the firmware via TFTP (see TFTP below).
  3. The power LED flashes very fast and after about 20 seconds it lights permanently, but the DMZ LED did not light up. In this case Bootloader and Kernel (firmware) are intact, only a wrong configuration from locked up the router. This can happen if a wrong or corrupt value exists in the NVRAM. Here simply clearing the NVRAM should solve the problem.

The Linksys site mentions 'Management Mode' which makes it trivial to recover from bad flashing (answer id 3176). Here's how to do it:

  1. Unplug the power cord from the back of the router.
  2. Hold down the Reset button.
  3. While holding down the Reset button, plug back in the power cord to the router.
  4. Continue to hold the Reset button for five (5) seconds. After five (5) seconds, release the button.
  5. Wait for about one (1) minute. Then, on a computer connected to the router, launch a web browser (for example, Internet Explorer or Mozilla Firefox).
  6. Type in the router's IP address of http://192.168.1.1 into the Address field and press the [Enter] key.
  7. The Management Mode - Firmware Upgrade interface should appear.

Note This technique only officially applies to hardware version 5 of the router ( what version do I have?). However, some version of the DD-WRT seem to have this ability on other versions of the hardware, so you might find it works anyway.

Linksys Firmware

If you cannot find a Firmware Auto-Upgrade utility at the Linksys Download Page, use a Setup Wizard as an alternative from other Linksys router (make sure to use your router's firmware).

Another tftp program is called tftp2 and is available here (this will start the download): tftp2.exe

3CDaemon from 3Com is another useful tftp program. To use it, use the TFTP client portion, enable RFC1784 timeout with a 60 second value and set the transfer to Octet. 3CDDaemon

Recovering with TFTP

During startup, the router will pause to accept a temporary firmware upload via tftp. On the Linksys WRT54G routers, you need to flash an image that contains the "W54G" header (Linksys and mini_wrt54g images)

If pinging 192.168.1.1 does not work, check the IP Address of your computer and make sure it is assigned an IP address in the subnet of the router IP. For simplicity sake you can assume "192.168.1.x" is good. If you do not have a good IP, the DHCP Server might not be working. So set your IP manually to something like 192.168.1.77 with 192.168.1.1 as your gateway and then try pinging the router again.

Power the router on with a continuous ping running in a command window:

ping -t -w 2 192.168.1.1

The -w 2 parameter forces a lower timeout for the ping answer, this makes easier to get an answer from the bricked router.

You should see at least a few replies from 192.168.1.1. Do this several times to be sure. If it does you have good chance of simple recovery. If you still receive no response, the IP address may be something other than 192.168.1.1. You should attempt to obtain the IP address of the router. Especially if previous firmware set the boot_wait variable to on, the router pauses even longer than normal during bootup to accept a recovery flash. All you need to do is provide a firmware to it via TFTP during this window of time.

Prepare your PC, firmware file and TFTP software and play with the timing of powering it on and starting the TFTP session just after applying power (or as soon as you start to see ping replies). If you try it a number of times (at least 10) you will probably rescue the router with no fuss!

DrayTek Router Tools - OSX/Windows: This program will run all those pesky TFTP commands with a push of a button. Simply download and install DrayTek router tools from here and follow the instructions: http://www.draytek.com.au/downloads.php

1) Run 'Draytek Firmware Upgrade',

2) Specify your *.bin file.

3) Plug in your router and hit send, if you get a "can't send" message, hit ok and try sending again. As long as you have a manual IP address on the same subnet as your router, and your router is pingable, it should eventually go through (reboot the router if you can't send for more than a minute).

4) When the send is successful, you should see a progress bar as the file is sent.

5) Wait approximately two minutes, and your router should become accessible.

Windows: Microsoft Windows contains a TFTP client. Windows Vista will require that you enable it in Programs and Features. With TFTP, all of the information about the transfer is specified during the initial setup; there is little client/server interaction as compared with standard FTP. To flash a router using Microsoft Windows, open a command prompt, change to the directory containing the original Linksys firmware to use for this boot (this example assumes the firmware file name is code.bin), and then enter the following command (assuming your router IP 192.168.1.1):

tftp -i 192.168.1.1 PUT code.bin

Linux: Most Linux distros either include a tftp client or have one available in their packages. This example uses atftp.

atftp --option "mode octet" --verbose -p -l code.bin 192.168.1.1

edit quaa - 12-30-08
For OS X and Linux users i suggest opening a terminal window and entering the following commands.

tftp 192.168.1.1
binary
rexmt 1
timeout 60
trace

after all that type (but do not hit enter just yet)

put firmwarefile.bin

plug in router and immediately hit enter


Now apply power to your router. The tftp client will continuously retry uploading the firmware until the router responds. Hopefully, the router will briefly awaken, allowing the firmware upgrade to be sent. About two minutes later, the router will reset and become operational with the new firmware. After the PUT is complete the router will stop pinging for 2 or 3 minutes while the firmware is flashed.. Don't panic, this is normal. Once you start receiving pings again, the firmware has been flashed and you should be able to access the router again. You should reset to defaults before configuring the router again.

Linksys WRT54 GL:

Linksys wrt54 GL users please note that if flashing with tftp using dd-wrt firmware gives no results, original Linksys firmware from www.linksys.com is worth trying. If that works, do a hard reset and you can continue to flash with dd-wrt. In order to use the Standard firmware version, a MINI version MUST be used first.

Notes:

a) The -i specifies binary transfer mode. The transfer will fail if you don't specify this.

b) Start the command and then power up the router. There is no indication of any transfer until it is complete.

c) The uploading via this command is pretty slow ~5.7kB/s if you are using 10Mbps half duplex mode so it will take about 10 minutes to upload ~3MB image. When you're using 100Mbps full duplex mode, it will go much faster. After the transfer is complete, wait 2-3 minutes for the image to be written to flash.

d) If TFTP does not work, try changing your network adapter to 10 Mbps half duplex.

e) Provided you have followed these steps correctly you should notice that the router will eventually reboot, in some cases it will require a power cycle (however if you power cycle wait at least 10 minutes to be sure the flash writing has occurred before you pull the plug).

f) Enjoy the fact that you did not waste $60 and that your router is now functioning again.

Recovery by JTAG cable

If the router isn't pingable anymore, there is little else you can do, but using a JTAG cable. For a pin-out see OpenWRT wiki. Then download the HairyDairyMaid Debrick Utility. Or...try the updated TJTAG program which includes the Newer Router Models.

  1. solder the JTAG cable following the above linked pin-out.
  2. solder a 12 pin header on the PCB of the router.
  3. to install the giveio.sys copy giveio.sys and loaddrv.exe into {windows}\system32\drivers (*usually C:\windows\system32\drivers*)
  4. double click loaddrv.exe in the system32 dir. This is important.
  5. append the filename giveio.sys onto the path in the utility
  6. press the load button and the start button, they should both confirm success. If this does not happen go no further, go back and fix this.
  7. from the command prompt cd to your Hairy Dairy directory and run wrt54g.exe to get a list of options
  8. to check your cable, plugin and power up the router and do wrt54g -probeonly
  9. it will then detect the CPU type. If not then check your cable.
  10. finally to erase your NVRAM (the usual cause of the problem) wrt54g -erase:nvram
  11. if that didn't work, erase the kernel (firmware): wrt54g -erase:kernel Now reflash the kernel via TFTP.
  12. if you still have no luck, you need to erase your CFE, but make sure you have a working cfe.bin for your router model! wrt54g -erase:cfe After that you have to reflash your CFE: wrt54g -flash:cfe

A partial list can be found here CFE collection project

Flashing the KERNEL or WHOLEFLASH will take a very long time using JTAG via this utility. You are better off flashing the CFE & NVRAM files & then using the normal TFTP method to flash the KERNEL via ethernet.

NOTE: If your JTAG writing program is hanging during the flash erase step, check your power supply. The act of writing flash consumes more power than reads, so a marginal power supply may support probes and reads, but will fail at writes. In one case, I had a 32V AC ripple on a 14V DC supply. I presume the marginal power supply called the original flash failure.

If you do not have a CFE.BIN file, you can find a repository of them here. These all have MAC addresses that DO NOT MATCH your hardware. Use the CFE editing tool "IMGTOOL_NVRAM" available from The Bitsum Wiki to set the et0macaddr and il0macaddr before uploading the CFE. et0macaddr is the address printed on the outside; il0macaddr is that same address, plus one. Example: If the printger address is 00:90:4d:83:00:01, then et0macaddr is 00:90:4d:83:00:01 and il0macaddr is 00:90:4d:83:00:02.


Problems with WRT54G v.1.0 and Allnet ALL0277

If you generate the CFE.BIN you may have to choose v.1.1 and PMON v1.5 even if you are absolutely sure, that you have a v.1.0 model laying in front of you. Even a backup CFE.BIN from the same router is not able to be flashed back, only the 1.1 version is flawlessy flashable.

Despite that, you should use the options /nobreak /noreset

Source

If That Doesn't Work

WARNING - This method can cause permanent damage. Success rate is only about 20%. The other 80% is permanent damage to the flash chip rendering the router permanently inoperable. Use at your own risk. You've been warned.

If the above methods do not work for you, the [WRT54G Revival Guide] includes a second technique that involves snapping open the plastic case of the router and using a small metal tool (or paper-clip) to "short" two particular "pins" on the circuit board. It is quite clear that this carries risk of permanently damaging your flash via static discharge, and should be a measure of EXTREME last resort, not the first thing to try. You can very likely recover from a bad flash WITHOUT opening the router if you have some patience with the TFTP technique.

The solution described in the Revival Guide works NOT for WRT54GL v1.1 with MX 29L320CTB flash chip. Here you have to short pins 16 & 17 instead.

If you do have to use the EXTREME measure #4 from the revival guide as I did here is a additional tip uncovered from this forum. Voidman forum

I used the "earthing" technique to get the WRT54g v3.1 to respond to pings. Whenever I tried to tftp the dd-wrt firmware, it would cause the router to stop responding to pings ans just give a "timeout" error.

The solution was to first tftp an official LINKSYS firmware (WRT54G_4.30.5_US_code.bin which I renamed to "code.bin"). The router accepted it and rebooted properly. I was then able to upgrade to the latest dd-wrt v.23 SP2 through the WebGUI. This was discovered on GS v.4 which responded to unofficial firmware with "incorrect code pattern." Apparently this happens when tftp'ing to an empty flash chip.

There's also a collection of pointers and tips on how to recover from a bad flash at the external link location, but most of the information in that forum seems to have been collected into the WRT54G Revival Guide. So far this is just a starter wiki. If someone could move the important parts into this wiki, that'd be great. Probably organize it by recovery methods and list variations of each method below the method, or something.

Linksys WRT310N

Firstly, please read and reread the peacock thread. Then reread it again. There has been a number of techniques that has been successfully used by a number of people as documented in the forums. I would suggest that you try the method tried by dvs first. dvs's method allows the firmware to 'stick' much more easily than other methods that I've tried. Note that tftp2.exe will often say that the firmware was successfully uploaded but with many of the other methods documented in the forums, it simply isn't true (It's very hard to get the timing absolutely right. That is why there's countless of people posting their frustration that their router is still bricked even after tftp2.exe says it's sucessful!) but with dvs' method, it's really simple and the firmware really sticks. The only thing that I had to do differently is ping-ing the router with a timeout of 5 instead of 10

ping -t 192.168.1.1 -w 5

in order to see the successful ping replies. You can use something as low as 2 or even 1 if you still can't catch the successful ping replies with a timeout of 5. Please remember to do the 30/30/30 Hard Reset after tftp-ing the firmware otherwise you will not be able to log in! Note that the above method is only applicable if your router is still ping-able with TTL=100 (read the peacock thread).

Belkin 75D7230-4

The Belkin F5D7230-4 can NOT be bricked unless you do "mtd -r erase pmon".

Case 1: You uploaded a firmware file and unplugged the router in the process of the upgrade. The power button now blinks at a steady pace and the WLAN light does not come on.

Fix: Somehow the IP address is now 192.168.2.1. Just TFTP to it on boot or use the Linksys tool as stated above. Assign your computer a static IP address of 192.168.2.101 and plug your network cable in. Unplug the power from the router, start TFTP or the Linksys tool, and then plug the power back into the router. It should flash. Wait 3 minutes for it to finish flashing, then power cycle it and do a 30/30/30 hard reset. Be sure to use DD-WRT build 10068 or later.

Buffalo WHR-HP-G54 soft repair

I discovered that my bricked Buffalo WHR-HP-G54 router during the startup phase (with the reset buttom activated for 5 sec. during a power-on sequence) always responded positive with 3-5 pings on IP: 192.168.11.1, (no matter what IP address I've set it to) before the ping again timed out. So you might try this before you open the router:

  1. Set your computers ethernet cable interface to static IP address: 192.168.11.2, Network Mask: 255.255.255.0 and Gateway IP: 192.168.11.1
  2. Connect the network cable to the bricked routers LAN port 4
  3. In Windows cmd interface start a "ping -t -w 10 192.168.11.1", continuous ping every 10 milliseconds
  4. Push the reset button (located in the buttom of the router), and keep it activated
  5. Unplug the routers 5v power cable, count slowly to 5 and reconnect the power cable.
  6. Count once again slowly to 5 and release the reset buttom

If you are lucky you will see 3-5 ping answers from your router on IP: 192.168.11.1 before the ping command again start responding with the timeout message.

If you get a positive ping response then you can succesfully use the TFTP script "Another way is to use a (script) cmd file under Windows" from this page:

to flash your router with new software. You just have to modify the procedure and hold the reset buttom while you unplug the 5v power cable, keep the reset buttom activated, restore power after 5 seconds and release the reset buttom after another 5 seconds.

The TFTP flash procedure will update your bricked router with your new software. Wait for about 2 minutes, change the computers ethernet cable interface from static IP settings back to DHCP, wait a few seconds for the network interface restart and access your repaired router on IP: 192.168.1.1

Open Buffalo WHR-G54S and Buffalo WHR-HP-G54

If you have already tried pinging the Buffalo continuously through hard and soft resets, unplugging, plugging and any combination thereof, then you can open up the device in order to revive it.

In addition to the minimal tools to open the router, you will need:

  1. A sewing needle
  2. A 10cm length of wire from within an ethernet cable, or equivalent.
  3. Read this entire section first, to get an idea, then round up your tools and go!
  1. Follow the guide: How_to_open_my_router
  2. With the router unplugged, plug a patch cable into one of the 4 LAN ports on your router and plug the other end into your computer, or switch connected to your computer.
  3. Configure your network card on your computer with a static IP address: IP: 192.168.11.2, Network Mask: 255.255.255.0, no gateway. This is important: 192.168.11.2, not 192.168.1.2, as other guides for other routers may show. Buffalo uses x.11.x range for recovery / TFTP flash mode.
  4. Run the ping command in a terminal or command prompt:
    1. In Linux: "ping 192.168.11.1".
    2. In Windows "ping -t -w 10 192.168.11.1", continuous ping every 10 milliseconds.
  5. Locate pin 12 on the flash memory chip MX 29LV320ABTC-90 G, show here: image:BuffaloWHR-HP-G54_FlashChip.jpg. . . . . . . . . It is the 12th pin counter-clockwise from the dimple in the surface of the chip. See the specs for this chip here. This is the Reset pin.
  6. Strip both ends of your wire by about 2cm. Thread one end through the eye of the needle, and bend the tip of the wire and wrap to secure to the needle. Wrap the opposite end of the wire around a suitable ground point, such as the antenna block connector.
  7. Tricky: While holding the pointy end of the needle against pin 12, carefully plug in the power, and begin watching your computer screen for ping replies. When you see ping replies, remove the needle tip and put it safely away from the board. The router will now always wait about 10 or 15 seconds for a flash image when it is powered up.
  8. The pings may continue for a short while, then stop. Unplug the router. Leave the ping window running.
  9. Now you can power up the router, and when the ping replies begin from 192.168.11.1, use a second window to tftp in the firmware image of your choice. WAIT. The router is flashing the new image automatically. It continues to flash the DIAG LED (red in the middle-front), and then reboots, all on it's own. Do not interfere with this process. When it is finished, the power light is on (green, top-front), and the Wireless light is blinking (green, next to the power light). For more information, see the DD-WRT Wiki article: Installation#TFTP_Flashing_Buffalo_Routers_under_Windows on how specifically to upload a new firmware image to the router, now the router is accepting firmware images again!

Buffalo WHR-G125

I did the same as above with my whr-g125. It seemed bricked (not pingable), but connecting wires to pin 12 of the Samsung flash ram chip (the big one) restarted the router, which where pingable in 5-10 seconds afterwards. So i used the .bat script found elsewhere in the wiki to tftp the .bin after using this restarting method. And it worked!

Buffalo WHR-HP-G54 JTAG

Lets say the instant you switch on your buffalo it displays all GREEN LEDs, the switch is all green, the green power light is on but no other colours and nothing is blinking. Nothing changes and nothing you do has any effect, you can't ping 192.168.1.1 nore 192.168.11.1 and you have tried shorting pin 12 as above. This is the time for JTAG and the Hairy Dairy Maid utility! If you have heard of this then I expect you have been dieing to use it. JTAG is a 12 pin header on the board for which you will need to connect control 4 wires to your computers printer port (parallel) and 2 gound wires. JTAG allows the 'manual' operation of the boards circuits even if the CPU is well and trully crashed. A bit like brain surgery with the top of someones head removed. I did this on Windows 2000, it (and XP) does not like you messing with the parallel port so you need a special driver to allow this; giveio.sys. Without this nothing happens. You can get the program and instructions from here: Hairy Dairy Maid Now read those instructions and then read what I specifically had to do to get it working on our one.

  1. solder the 25 way D on your JTAG cable follow the standard pinout.
  2. solder the PCB end onto the JTAG header directly to the solder pads, evens are ground; 2+4+6+8=20+25, odds are signals; 3=2,5=13,7=4,9=3.
  3. this is standard JTAG, nothing special, forget the resistors the PCB already has them.
  4. to install the giveio.sys copy this file and loaddrv.exe into {windows}\system32\drivers
  5. double click loaddrv.exe in the system32 dir. This is important.
  6. append the filename giveio.sys onto the path in the utility
  7. press the load button and the start button, they should both confirm success. If this does not happen go no further, go back and fix this.
  8. from the command prompt cd to your Hairy Dairy directory and run wrt54g.exe to get a list of option
  9. to check your cable, plugin and power up the buffalo and do wrt54g -backup:nvram /noemw /fc:29
  10. it will detect the CPU type and you should see your data as FFFFFF and CFD1AFC nonsense whizz past. If not then check your cable.
  11. finnaly to erase your NVRAM (the usual cause of the problem) wrt54g -erase:nvram /noemw /fc:29

External Links