1. Is your switch in Layer 3 mode? (using router image, instead of switch)
Make sure that the image it is booting to has a letter R in it.
2. If not, do the below:
Usually, the secondary image on switches is the Router image. To make it boot to secondary permanently do this:
boot system flash secondary
Happy routing 🙂