Arduino Uno not retaining sketch on power-off

I'm entirely new to the Arduino platform but have some limited experience with other chips. I have no problem uploading to my Uno via USB and running perfectly lovely sketches. However, when I unplug the power and plug in a battery instead, or even plug the USB back in, the Uno always reverts to the factory default blink behavior. Is there some protocol I need to follow in the software to get my sketch to stick? Thanks.

What happens if you upload a sketch, run it, then hit the reset button on the Uno?

If I upload a sketch, run it, then hit the reset button, I see a couple of startup blinks and then the sketch begins to run again properly.

The "startup blinks" are the bootloader saying hello. I believe the bootloader runs 2 seconds.

Yeah, I get that. The problem is that when I de- and re-power the board, the blinking just goes on forever, no matter what sketch was loaded before I powered down. I feel like I'm just missing a step somewhere due to inexperience.

I think this is believed to be an instance of this bootloader bug:
http://code.google.com/p/arduino/issues/detail?id=446

Is this an Uno SMD ? There have been reports that this is more likely to happen on those, though the explanation for that is not well understood. Some vendors are replacing Uno SMDs with ones containing a patched bootloader.

Yes, this is an UNO SMD. Thanks for pointing out this bug report! Is this something I can patch myself, or do I need to contact my vendor for a replacement?

Is this something I can patch myself

It seems to be something that requires actually replacing the bootloader. If you have the equipment to do that (possibly as little as a second arduino), you can do it yourself (the newer bootloader hex is downloadable from the google code repository, or you can compile it yourself.)

(It's not clear that all Arduino vendors will have stock of "fixed" Unos or the ability to fix their existing stock, though.)

Thanks, folks. Based on your info I found this thread on the SparkFun forums that matches my experience exactly:

http://forum.sparkfun.com/viewtopic.php?f=32&t=25611

I'll take it up with SparkFun from here. I guess I'm glad it wasn't anything I was doing wrong. Thanks again!

I burned my UNO with the Duemilanove bootloader because of problems with Optiboot. The IDE doesn't mind if I tell it its a Duemilanove.......