I think this is a bug but it's really hazy and next to impossible to reproduce unless you manage hundreds of routers, so I thought I would just put it out there. If anyone cares, they can look into it without further input from me.
I've worked on many OpenWrt routers over the years at various locations having diverse network environments. Different router brands, different OpenWrt core versions up to and including the latest stable. One thing that has cropped up, maybe on average a few times a year, is wifi which becomes disabled and stays disabled even after turning the router on and off.
What happens is that the wifi will just stop working. With a few exceptions, this has been easily fixed by going back into the Wireless menu and enabling the interface again manually.
Here's what I think is happening. Somewhere in the code, there's something like this:
-
OldWifiState = WifiState
-
WifiState = Off
-
(Do some critical stuff that needs wifi to be off)
-
WifiState = OldWifiState
Once in a great while, lightning strikes (perhaps literally) and the power gets lost during #3. However, the update in step #2 has actually flushed to permanent storage. Now you turn the router back on. But WifiState is still Off so the wifi doesn't power up. People who had someone else set up their router are now dumbfounded and make a support call.
The obvious solution is that #2 should never be allowed to be flushed to permanent storage.
As I mentioned, I've noticed a few exceptions. In those cases, there might be nested instances of this issue which compound to disable the wifi in a more permanent manner, necessitating a full firmware reset.
You would probably need an LLM to search the code for stuff like this (and maybe not only applying to wifi) on account of its abstract nature. Maybe it's not in the core code at all, but a hardware-specific deployment layer. I suspect the core, though, on account of the brand diversity.
Probably related:
https://forum.openwrt.org/t/wifi-disables-on-its-own
Maybe related:
https://forum.openwrt.org/t/persistent-wireless-network-failure
https://forum.openwrt.org/t/unifi-6-lr-disables-wifi-6-randomly
https://forum.openwrt.org/t/after-i-do-uci-set-wireless-wifi-device-0-disabled-0-my-wireless-routers-ssid-disappear
Possible workaround in the meanwhile:
Best of luck with this.