Right - important to remember, the unfortunate USFS officer has been the only casualty to a bear of someone actually riding a bicycle. Creaky cranks and other trail noise presumably keep the bears out of the way..., most of the time. The trick, as well noted above, is to not smell like something good to eat while you're trying to sleep.
I've bombed a few downhills with fresh grizzly scat in the middle of the trail. I assume my whoops and shouts helped keep the trail free.
As regards the cannister/bag debate..., lots in other threads. I've always been a bag guy - well except Alaska where they have no trees.
That said, a lot of the US national parks have started to require cannisters, and a whole market has developed with certification by the Interagency Grizzly Bear Committee. (To be certified, a food-filled canister needs to last in a grizzly bear enclosure and sustain at least 60 minutes of bear contact without failing.)
https://grizzlybear.wpengine.com/wp-content/uploads/2021/11/211116_Certified_Products_List.pdfI saw an engineer last summer with a nice, lightweight cannister that fit well on his rack. See photo below. It takes the uncertainty out of where to store any food and toiletries in bear country. I looked into it further. Like everything else associated with our sport, I found a nice carbon fiber version I liked (at about 600 grams) for over $300....
By the time one get's south of Pinedale, Wyoming, the threat of big brown bears (grizzlies) gives way to the hassles of smaller brown bears (black bears) - and the bags don't need to be hung near as high (though the smaller bears do climb better). I've heard that javelina (native pigs) can wreck food-ridden camps in New Mexico, but I have never seen any sign of them. (But, I don't bait them, either.)
I'll note that, if staying in USFS campgrounds, the hosts often have bear-proof boxes for use by tenters - if boxes are not provided in the sites.
Have fun thinking about this, and realize that just by thinking about it, you've probably prevented any significant interaction with our
Ursus arctos horribilis.
Now, let's talk about mountain lions....