Recovering a Cisco Fixed Switch from the Boot Loader

Wait, that’s not right…

Let’s say you have Cisco fixed switch (2960, 3560, etc) and you copied over the tar file with an IOS upgrade, removed the old IOS, and rebooted the switch. Let’s say you forgot to install the new IOS and now you’re at the boot loader because the tar file isn’t bootable, it’s just a container for the IOS bin and the web based device manager. If you don’t grab the version with the web based device manager, you just have the IOS binary and you’re good to go, no install necessary. If you’re smart, you don’t remove the old IOS, but in my case this was for a fresh deployment so I didn’t see the need to hang on to the old IOS. Now you’re at the boot loader “switch:” prompt.

If you have an old switch/doorstop

You may have been to this movie before and been at the rommon of a newer router. The newer routers allow you to get the router onto the network and TFTP a new IOS in. So do the 3560X and 3750X, but I’ll get to that in a moment. If you have an older switch, you get to transfer the IOS image to your switch with xmodem.

There are two things that can be done to make this go a bit faster.

  • The big one is to change your serial console speed from 9600bps to 115200bps. For a 14MB IOS image, that takes your transfer time down from over 3 hours to around 30 minutes. At least, that’s what it would be without overhead.
  • Reduce your protocol overhead! Basic xmodem uses 128-byte packets. That gives you 40% overhead at 9600bps. Now you are well over 4 hours at 9600bps and closer to 45 minutes at 115000bps. Using xmodem-1k drops you to 19% overhead. That saves about 10 minutes at 115kbps and around 40 minutes at the snail’s pace of 9600bps.

To set your terminal speed to 115200, enter the command:

switch: set BAUD 115200

This takes effect immediately and your terminal will now give you garbage until you set it’s rate to 115200 as well.

Now you can start your xmodem transfer. Don’t forget to make sure your xmodem is using xmodem-1k. Also, make sure you copy over a .bin IOS image and not a .tar, or you’re wasting a lot of time.

switch: copy xmodem flash:c2960-lanbasek9-tar.122-55.SE1.bin

Once it’s done, you can either boot if you want run the .bin you copied over or you can reset if you want the system to do a hard reset (similar to a power cycle). Don’t forget to switch back to 9600bps…

If you have a 3560X/3750X

If you have a 3560X/3750X, you are in luck. TFTP is now available to you via the management FastEthernet interface. Set the IP_ADDR variable (the variable names may be case sensitive, depending on your platform) with your IP/netmask and DEFAULT_ROUTER with your default gateway. For example:

switch: set IP_ADDR 192.168.0.99/255.255.255.0
switch: set DEFAULT_ROUTER 192.168.0.1
switch: copy tftp://192.168.1.10/c3560e-universalk9-mz.122-55.SE1.bin flash:c3560e-universalk9-mz.122-55.SE1.bin

If things don’t work, it’ll sit there for a while and reward you with:

tftp://192.168.1.10/c3560e-universalk9-mz.122-55.SE1.bin: connection timed out

If things are working correctly, the screen will fill with periods and you’ll have to wait a couple minutes to be rewarded with something like this:

File "tftp://192.168.1.10/c3560e-universalk9-mz.122-55.SE1.bin" successfully copied to "flash:c3560e-universalk9-mz.122-55.SE1.bin"

switch:

Now you can either boot if you want to just fire up the .bin you copied over or you can reset if you want the system to do a hard reset (similar to a power cycle).

FIN

28 thoughts on “Recovering a Cisco Fixed Switch from the Boot Loader

  1. Thank you! For some reason my 3560 doesn’t like the TFTP option, but setting the baud rate higher has saved me much insanity :) I can now transfer over the smallest IOS I can find (about 6 megs) just to get the thing booted up so I can TFTP in the proper IOS.

    • If your 3560 has an USB-port that is a much faster option.
      Weird that this isn’t mentioned here.

      • The 3560 is an older switch that does not have USB, whereas the 3560X does. That said, USB would definitely be more convenient if it’s available. I haven’t tested recovery using a USB drive, so I’ll have to try that!

        • Jup I’ve tested it. USB is available in recovery mode!
          Probably wasn’t available 4 years ago when you wrote the article :) Great follow-up here!

          • We just went through this (recovery via USB) = it works but you may have to use a USB stick that has been previously formatted on a Cisco router/switch, for some reason there seems to be a FAT compatibility issue otherwise.

  2. Baud rate sped things up considerably.

    for my 2960, instead of

    switch: copy xmodem flash:c2960-lanbasek9-tar.122-55.SE1.bin

    I needed to add a colon after xmodem

    switch: xmodem: flash:c2960-lanbasek9-tar.122-55.SE1.bin

  3. One final step:

    switch: boot flash:c3750e-universalk9npe-mz.122-58.SE2.bin

    The switch needs to know what image to boot from.

    I excluded the above step and the switch returned to ‘rommon’ mode.

    Very informative and good post.

  4. Good guide *except I kept getting RETRY: NAK errors in minicom while using XMODEM… Tried using hyperterminal, and it was also erroring out with retrys. This was on a Cisco 3550. I had to switch the baud rate back to 9600 and then XMODEM transfer worked. It would not work on 115200.

  5. for 3750 use
    switch: copy xmodem c2960-lanbasek9-tar.122-55.SE1.bin
    flash:c2960-lanbasek9-tar.122-55.SE1.bin

  6. Does the Fa0 interface on a 3750X have to be configured prior to the recovery attempt? I don’t even see a link light on mine, and when I try the recovery I get “no such device”

    switch: set IP_ADDR 192.168.1.100/255.255.255.0
    switch: set DEFAULT_ROUTER 192.168.1.1
    switch: copy tftp://192.168.2.2/c3750e-universalk9-mz.122-55.SE7.bin flash:c3750e-universalk9-mz.122-55.SE7.bin
    tftp://192.168.2.2/c3750e-universalk9-mz.122-55.SE7.bin: no such device

    • One question about xmodem: Where does the bin file reside before you start to copy it over? I assume that is on the computer you have connected to the switch via the console cable. If so, where on the computer would you put the .bin file?

  7. am still having a problem with my cisco 3550. i have done all the necessary things tht is needed to be done and all seems not to work. the switch cant enter the system configuration mode neither can i enter the user mode but it boots quite well. i will need ur assistance.

  8. Hello guys,

    We are accessible Cisco Switch 2960g via console now its working fine but I facing some issue language change also mention below, please help me???

    XøüXøXüXøüXøXøXøXø üXøXøüXø(üü8üXüXüü üXøXø8üXü8ü8üüXøXø(ü(üXü(üXøXø8üXø8üXø(üüXü üXøXøXøXøXüXø(üXøüXø8üXüXøXø(ü8üXø8üXü8üXøXü(üXøXüXø8üüü8üXøü8ü8üü(üXü8üXø üXüü üXø(üXüXøXøXüü8üXüXøXøXø(ü8üXüXüüXüXøXø8üXüXø üXøü8üXüXø8üXøXø(üü(ü(üXüXøXüXøXøXøXøXø8ü8ü(ü8üüXøXø(üü(üXüXøXø üXüXøXøXøüXø8üüXøXüXøXø üXøXøXüXø8üXøüXøXø8üXø8üXüXøXøXøXøXüXø üXøXüXø ü8ü(ü8üXøXøXøXü(üXø8üX

  9. Hello. If there is an inquiry I will leave the statement.
    cisco nexus 3548 you have the equipment , during the initialization process
    Enter the command write erase boot,
    ios seems is gone .

    When current become loaded, see the loader>, and based on the current state You should take advantage of any way to return to the state where there is ios?
    Verification please . Thanks you.

  10. i have a problem with my switches Cisco 3750 in stack.
    I made a mistake and deleted flash. :( Now, I haven’t a startup config.
    Switches is active and I and I’m afraid to go turn off
    I did write memory !!!
    I have a backup … how to flash back
    Help

Leave a Reply