How does router determine which IOS to boot?

Unanswered Question
Mar 18th, 2009
User Badges:
  • Purple, 4500 points or more

All,


I had a situation this morning. I had two IOS images in flash. In the running config, I told it which IOS to boot, but either it lost the config or I forgot to write it (probably the latter), and it booted the other image. The images were:


c2800nm-ipbase-xxxxx.bin

c2800nm-entservices-xxxxx.bin


When there are two images, is there a certain boot order that these things take when multiple images exist? I just deleted the ipbase image to fix this issue, but I was curious how the router picked this image over the other.


Thanks,

John

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (2 ratings)
Loading.
Mohamad Qayoom Wed, 03/18/2009 - 09:04
User Badges:
  • Bronze, 100 points or more

What is the vlaue of your config register?

lamav Wed, 03/18/2009 - 09:06
User Badges:
  • Blue, 1500 points or more

John, it goes down the list. If the bootloader file (bootstrap) in ROM determines that the device should be booted in the "normal" way (confreg 0x2102), it will load that portion of the startup config that has the boot statements. It will then execute those statements one at a time, from the top to bottom. So the first IOS you have in the list is the one it will try to boot first. If unsuccessful, it goes down the list.


If no bootable image is found, in can load to RxBoot if the device supports it, or throw you into ROMMON.


HTH


Victor

John Blakley Wed, 03/18/2009 - 09:08
User Badges:
  • Purple, 4500 points or more

Victor,


The config register is 0x2102, and when doing a dir, the ipbase shows first in the list. Is there a way to move these around in the folder though? If I want a certain one to boot first without using the "boot system" line in the running config?


John

Mohamad Qayoom Wed, 03/18/2009 - 09:12
User Badges:
  • Bronze, 100 points or more

John,

Maybe you can delete the other image(ipbase). Or you can also delete one image(ipbase) and upload the deleted image(ipbase) to change the boot order. Is there any specific reason for not wanting to use the boot statement?

Thanks,

Mohamad

John Blakley Wed, 03/18/2009 - 09:14
User Badges:
  • Purple, 4500 points or more

Yes. If I lose my config, it'll boot from the wrong image. I had it happen this morning. I've already deleted the image, and it won't be an issue in the future because it won't have but the one image to boot from. :)

Mohamad Qayoom Wed, 03/18/2009 - 09:17
User Badges:
  • Bronze, 100 points or more

Did you not have the correct boot statement?

lamav Wed, 03/18/2009 - 09:25
User Badges:
  • Blue, 1500 points or more

John, I never met anyone with your requirement, but the way it works is that if there is no boot staatement in the config file, the bootstrap program will look for the first usable IOS in Flash.


Now, I have never experimented with this, but it seems feasible that if you delte the image from Flash that you want to use as a secondary image and then reload it, the router may place it in that order of existence - unless the Flash file system uses a different criterion for the order in which it places IOS images. Try it in a lab and see what you get.


Question:


If the router's blown the config anyway, its dead in the water, so who cares what IOS image it loads?

John Blakley Wed, 03/18/2009 - 09:32
User Badges:
  • Purple, 4500 points or more

"I never met anyone with your requirement"


Okay, here's the deal. From my OP, I stated that I had forgotten to write the config. My fault, I know.


Second. I shipped the router to the location that had TWO images: ipbase and entservices.


Problem is that because I forgot to write the config, my routes didn't come up because BGP isn't supported under ipbase. Because it didn't have a "boot system" statement, it loaded the first image in flash being ipbase. The router didn't support bgp under this image.


Now the problem lies in the fact that I configured the router using enterprise services with bgp and dlsw support, wrote my changes, but I forgot to put my boot line in the config. Because of this, it booted the config with the wrong image and thus wiped out my bgp configuration, hence my original question.


It's not that I have a "requirement", I was just curious as to why the router chose to boot ipbase instead of entservices considering the timestamp of entservices was later than ipbase because I uploaded it last.

lamav Wed, 03/18/2009 - 09:34
User Badges:
  • Blue, 1500 points or more

If the IPBASE image is worthless because it doesnt support BGP and DLSW, why have it? Get rid of it and be done with it. No?


Mohamad Qayoom Wed, 03/18/2009 - 09:36
User Badges:
  • Bronze, 100 points or more

I think he already deleted it. We all sometimes forget to type "wr." So, I wouldn't make John feel guilty about this.

Mohamad

lamav Wed, 03/18/2009 - 09:38
User Badges:
  • Blue, 1500 points or more

No ones making John feel guilty about anything at all. Not sure I know what youre talking about.


He forgot to save the config so the boot statements were gone. Got it. No biggie.


Get rid of the image you dont want and cant use and you wont have to worry about this again.


If one is asking out of curiosity for the purpose of understanding whwt happened and how maybe to avoid something this in the future, then I gave my suggestion already on what to do.

Joseph W. Doherty Wed, 03/18/2009 - 12:46
User Badges:
  • Super Bronze, 10000 points or more

Yes, there is a default boot sequence. Usually first valid (for the device) image found. Devices that support multiple flashes, also have a default flash device search sequence.


PS:

With regard to some later questions, I haven't found a way to reorder the image sequence without deleting an image and reloading onto the same flash device. (Of course, using a boot statement takes less time.) With multiple flash devices of the same type, can swap flash to slot and obtain a different boot sequence. With different flash devices, you can pull the earlier in sequence flash device.


Something that can be done, I've noted the boot statement allows you to override the default flash device search sequence without the need to specify a specific image.


With the problem of losing your initial BGP configuration with an image that doesn't support it. Only the running image lost it. The BGP config should have been in startup until overridden.

Actions

This Discussion