I'm trying to find the breaker to switch off a light fixture to install ceiling fan. I've tried all but the ones dedicated to ac, furnace, dryer etc. I decided to switch off the main and encountered this. Is this safe? Can I switch the main safely? Thanks!
Yes, that screw needs to be there. No, it won't mess up switching off the main.
Your electrical panel uses a backfed main breaker configuration. This works fine, considering the main breaker is always going to be a regular breaker and thus rated for backfeed (GFCIs and AFCIs have LINE and LOAD terminals as they are not backfeedable). However, this invokes NEC 408.36(D) in order to keep the main breaker from coming out and exposing someone to live mains when they pull the deadfront off:
(D) Back-Fed Devices. Plug-in-type overcurrent protection devices or plug-in type main lug assemblies that are backfed and used to terminate field-installed ungrounded supply conductors shall be secured in place by an additional fastener that requires other than a pull to release the device from the mounting means on the panel.
The screw you see is that "additional fastener" the Code requires. It won't mess up switching off the main breaker, either, as the handle OFF position is a mirror image of the handle ON position, roughly.
For a backfed breaker set, yes. This keeps it secured in the panel. The reason is because the mains are running to the breaker.
So imagine you pulled the cover off the box to add a line, and the breaker was not screwed in place, it could come off - quite the hazard. This allows you to work inside the box, and know the main's will stay put.