How to recover a Cisco Switch from Boot Loader

Today I had to update a 3560x but when I consoled into the switch it was at Boot Loader prompt (switch:) and I wasn’t sure so I tried to boot and this is what happened.

switch: boot
Loading "flash:/c3560e-universalk9-mz.122-53.SE2/c3560e-universalk9-mz.122-53.SE2.bin"...flash:/c3560e-universalk9-mz.122-53.SE2/c3560e-universalk9-mz.122-53.SE2.bin: no such file or directory

Error loading "flash:/c3560e-universalk9-mz.122-53.SE2/c3560e-universalk9-mz.122-53.SE2.bin"

Interrupt within 5 seconds to abort boot process.
Boot process failed...

The system is unable to boot automatically.  The BOOT
environment variable needs to be set to a bootable
image.

I would like to show you how to recover a Cisco switch (ex. 3560x/3750x) from Boot Loader prompt (switch:) because from my experience the documentation I found on Cisco is incorrect or I am really stupid for not able to understand.

Here what I think is incorrect in the documentation and else where they copy pasted the instructions without verifying it.

 Step 8 Start the file transfer by using TFTP.

a. Specify the IP address of the TFTP server:

switch: set IP_ADDR ip_address/mask

The above statement “Specify the IP address of the TFTP server”  in the documentation is incorrect as I have repeatedly failed transferring the file and the reason is because it should have said “Specify the IP address of the Switch Managment Interface“.

So follow the steps below if you are also trying to recover the switch from boot load using TFTP to transfer file. If you like to use USB flash drive to transfer image to the flash click here.

Method 1: Transferring IOS image using TFTP

Step 1: Console into the Switch.

Step 2: Connect your Labtop (or TFTP Server) to the back port of the Switch (10/100TX, next to console/serial port) via Straight cable.

Note: I was using my Mac book and activated TFTP on it. You can do the same on your windows or mac laptop if you don’t have a separate TFTP Server.

Step 3: Initialize flash:

switch: flash_init

Step4: Initialize Management Interface

switch: mgmt_init

Step5: Assign IP address/Subnet Mask of the Management Interface (Not TFTP Server, which is mentioned in the Cisco documentation and is an error.) and default gateway. Make sure the variable are set in the same format below.

switch: set IP_ADDR ip_address/mask
switch: set DEFAULT_ROUTER ip_address

Example: 
switch: set IP_ADDR 10.1.100.2/255.255.255.0
switch: set DEFAULT_ROUTER 10.1.100.1

Note: After setting the variable you can check simply by typing “set“. If you make a mistake just type “unset” and the variable. (ex. unset IP_ADDR)

Step6: Once the correct image is transferred to your Laptop/TFTP server you can enter:

switch: copy tftp://TFTP_Server_IP_Add/IOS_image_filename.bin flash:IOS_image_filename.bin

Example: 
switch: copy tftp://10.1.100.3/c3560e-universalk9-mz.122-53.SE2 flash:c3560e-universalk9-mz.122-53.SE2

Note: After flash: you need to specify full file name or else it will not accept.

If your attempt failed you will get the following message after a long wait.

 connection timed out

If your attempt was successful you will see following.

..........................................................................................................................................

File "tftp://10.1.100.3/c3560e-universalk9-mz.122-53.SE2" successfully copied to "flash:c3560e-universalk9-mz.122-53.SE2"

 

Method 2: Transferring IOS image using USB Flash drive.

Before creating this post I didn’t know the Boot Loader (Rommon) mode supports USB flash drive, until a gentle man (Leo) on Cisco forum share this little secret that’s not mention in Cisco docs. The steps as as below. (Thanks to  Leo L. & Muhammad Y. for these instructions on Cisco Forum: Source, I haven’t tested this method yet so I am not 100% if this works.)

Step 1: Take a USB of any size, format it using FAT16.

Step 2: Copy a valid IOS to the USB drive.

Step 3: Insert USB to your Router/Switch.

Step 4: Reset you Router/Switch.

Step 5: Enter following comman

switch: dir usbflash0:

Step 6: Once you verify that it has detected the flash you can boot router/Switch using the following command

switch: boot usbflash0:IOS_name.bin

Note: In case it’s not accepting the USB drive, try formatting it to 256 MB. Also “boot usbflash0:” is not only hidden but you might need to upgrade the router’s Bootstrap before you can use the command.  Newer switches, like the 2960X/X, 3650 and 3850, and ISR G2s now support this command.

I hope I have covered every step here. Please leave a comment and let me know if there is anything you feel is incorrect and if this have helped you or not.

If the above didn’t resolve your issue. Please also look at this blog post.

20 thoughts on “How to recover a Cisco Switch from Boot Loader

  • By adam - Reply

    Thanks for sharing this.

  • By flash drive rescue - Reply

    Superb blog! Do you have any tips for aspiring writers?
    I’m planning to start my own website soon but I’m a little lost on everything.
    Would you recommend starting with a free platform like
    Wordpress or go for a paid option? There are so many options out there that I’m totally
    overwhelmed .. Any recommendations? Many thanks!

  • By hareesh - Reply

    Thanks man,..

    its working good..

  • By tech - Reply

    Awesome! You’re a lifesaver!

  • By Alheeshi - Reply

    many thanks it’s working very will

  • By Abiadha Massawe - Reply

    switch: set IP_ADDR 192.168.10.1/255.255.255.0

    switch: set DEFAULT_ROUTER 192.168.10.4

    switch: copy tftp://192.168.10.4/c2960-lanbasek9-mz.122-50.SE5 flash:c2960-lanbasek9-mz.122-50.SE5
    tftp://192.168.10.4/c2960-lanbasek9-mz.122-50.SE5: no such device

    I use the same command but am steel having problem “NO such device”
    my laptop / tftp server 192.168.10.4 255.255.255.255.0 with flash file-c2960-lanbasek9-mz.122-50.SE5
    gateway is my laptop IP address Am trying to use 192.168.10.1
    Please need your help…

    • By Marius Rotundu - Reply

      This i wrote after i recovered a ws-3750G-12s that “suffered” a “format flash” command which erased everything.

      Follow this procedure, using transfer on console port.

      Xmodem Recovery:

      1.Speed Up Xmodem Recovery – “switch: set BAUD 115200” (with 9600 was estimated 3hrs, with 115200 was only about 30 min for a 7.7MB file)
      (restart the console program with new settings chosen)

      2.Start Xmodem IOS file Tranfer – “switch: copy xmodem: flash:c3750-advipservicesk9-mz.122-25.fz.bin”

      3.If you use HyperTerminal, on top of the window, choose Transfer > Send File then browse to the file and select it (i assume you have this, otherwise google it and download the bin file – NOT tar- for your device) , also on protocol (in the browse window) choose “xmodem” then “send”. Transfer will start, but is going to take a lot of time.

      4.Issue the show version command in order to verify the file, if is OK, proceed to next step otherwise retry transfer

      5.Boot the new image that you just copied by issuing the “boot flash:filename” command

      6.After the Xmodem recovery, set the BAUD rate back to 9600. If the set BAUD 9600 command does not bring the baud rate to 9600, issue the unset BAUD command in order to bring the baud rate to a default value of 9600 bps.

  • By s - Reply

    have a problem with my switches Cisco 3750 in stack.
    I made a mistake and deleted flash. ( del /force /recursive flash:c3750-ipbase-mz.122-25.SEE2.bin )
    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

  • By Anonymous - Reply

    mgmt._init is an unknown command.

  • By andrew - Reply

    God bless you man, I accidentally hosed my companies 2960 switch while on loan. Tried everything under the sun. This was the only method that worked for me. Thabks again.

  • By Nick - Reply

    How long does it take to load the file from a USB?

  • Pingback: How to recover a Cisco Switch from Boot Loader | Pramod The Network Guy

  • By Pratik - Reply

    Hi,

    By mistake I have erased the flash from erase flash on cisco catalyat 3560.

    After that I tried many timess to load the image in flash from zmodem through hyper terminal but found I/O error every time.

    I tried with tftp also but could not load image .

    Please help me to load the image as I want full step to recover it as I new in this domain

    Regards
    Pratik

  • By DImitri - Reply

    Hi,
    I have tried all the method recommanded in this chapter ”
    “Recover from a 3850 Series Switch Boot Failure” from here :
    http://www.cisco.com/c/en/us/support/docs/switches/catalyst-3850-series-switches/117552-technote-cat3850-00.html#anc19
    Still not possible to get the install mode. Have you any other idea or a procedure to format all the File System ?
    I have a file with my commands and log results. Let me know of to upload it…
    Thanks for attention and your help

  • By Ak - Reply

    Excellent Document.. appreciate for this wonderful effort ..

  • By Ecio - Reply

    Appreciating the time and effort you put into your website and detailed information you present.
    It’s good to come across a blog every once in a while that isn’t the same unwanted rehashed
    information. Fantastic read! I’ve saved your site and I’m including your RSS
    feeds to my Google account.

  • By Raj - Reply

    Hi could you please help me out here
    switch: flash_init
    Initializing Flash…
    …The flash is already initialized.
    Setting console baud rate to 9600…

    switch: mgmt_init
    Unknown cmd: mgmt_init

    switch: set IP_ADDR 10.32.238.70/255.255.252.0

    switch: set DEFAULT_SWITCH 10.32.238.72

    switch: copy tftp://10.32.238.71/c3750-ipbasek9-mz.122-55.SE11.bin flash:c3750-ipbasek9-mz.122-55.SE11.bin
    tftp://10.32.238.71/c3750-ipbasek9-mz.122-55.SE11.bin: no such device

  • By Headset Adapter Co. - Reply

    Nice list. One more thing to “expand” the options… Some newer routers and switches may have an additional slot for CF card. So, boot image may be copied to empty compact flash on another router, then inserted into the failing router, and booted from another filesystem.

    Another option – sometimes it may be faster to disassemble router (especially modular switches or ASA), re-format and copy working image on another device, and then re-install it.

  • By RyanWolcotth - Reply

    I see your blog needs some unique content. Writing manually is
    time consuming, but there is solution for this hard task.
    Just search for – Miftolo’s tools rewriter

  • By server bootrom - Reply

    What you composed was very reasonable. However, consider this, what if
    you added a little content? I ain’t saying your content isn’t good, but what if you added a headline that makes
    people desire more? I mean How to recover
    a Cisco Switch from Boot Loader | Unolution | Blog is a little plain. You should peek at Yahoo’s front page and note how they create
    news headlines to grab viewers to click. You might
    add a video or a picture or two to grab people interested about everything’ve
    got to say. In my opinion, it would bring your blog a little bit more interesting.

Leave a Reply

Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>