Wi-Fi radios failing to start with the retry_setup_failed flag set

I have recently noticed that in about 10% of the times I’m booting OpenWRT, the WiFi radios fail to start up with the retry_setup_failed flag set to true. Rebooting fixes the issue in most cases, but not always (I assume it’s just throwing the dice again). I have failed to find any information/documentation on what causes the retry_setup_failed flag to be set. Could someone enlighten me on what the flag signifies and maybe also how I might work around the problem other than continuously rebooting the device until the flag isn’t set?


Configuration

I’m using OpenWrt 19.07.2 r10947-65030d81f3 on the following devices:

  • D-Link Dir 825 C1
  • TP-Link Archer C5 v1.2
  • TP-Link Archer C7 v2
  • TP-Link Archer C7 v5
  • TP-Link TL-WDR4900

The issue is not specific to any specific device. There also doesn’t seem to be a pattern which radio fails to start up.

When the error occurs, `wifi status` outputs the following on a D-Link Dir 825 C1

<...> entries have been retracted.

{
    "radio0": {
        "up": false,
        "pending": false,
        "autostart": true,
        "disabled": false,
        "retry_setup_failed": true,
        "config": {
            "path": "pci0000:00/0000:00:00.0",
            "hwmode": "11a",
            "htmode": "HT40",
            "country": "DE"
        },
        "interfaces": [
            {
                "section": "wifi_5ghz",
                "config": {
                    "ifname": "wifi_5ghz",
                    "mode": "ap",
                    "ssid": "mywifi",
                    "encryption": "wpa2+ccmp",
                    "auth_server": "<...>",
                    "auth_secret": "<...>",
                    "network": [
                        "lan"
                    ],
                    "mode": "ap"
                }
            },
            {
                "section": "legacy_5ghz",
                "config": {
                    "ifname": "legacy_5ghz",
                    "mode": "ap",
                    "ssid": "mywifi_legacy",
                    "encryption": "psk2+ccmp",
                    "key": "<...>",
                    "macfilter": "allow",
                    "maclist": [
                        "<...>"
                    ],
                    "network": [
                        "lan"
                    ],
                    "mode": "ap"
                }
            }
        ]
    },
    "radio1": {
        "up": true,
        "pending": false,
        "autostart": true,
        "disabled": false,
        "retry_setup_failed": false,
        "config": {
            "path": "platform/ahb/18100000.wmac",
            "hwmode": "11g",
            "htmode": "HT20",
            "country": "DE"
        },
        "interfaces": [
            {
                "section": "wifi_24ghz",
                "ifname": "wifi_24ghz",
                "config": {
                    "ifname": "wifi_24ghz",
                    "mode": "ap",
                    "ssid": "mywifi",
                    "encryption": "wpa2+ccmp",
                    "auth_server": "<...>",
                    "auth_secret": "<...>",
                    "network": [
                        "lan"
                    ],
                    "mode": "ap"
                }
            },
            {
                "section": "legacy_24ghz",
                "ifname": "legacy_24ghz",
                "config": {
                    "ifname": "legacy_24ghz",
                    "mode": "ap",
                    "ssid": "mywifi_legacy",
                    "encryption": "psk2+ccmp",
                    "key": "<...>",
                    "macfilter": "allow",
                    "maclist": [
                        "<...>"
                    ],
                    "network": [
                        "lan"
                    ],
                    "mode": "ap"
                }
            }
        ]
    }
}
The Wi-Fi config of a D-Link Dir 825 C1 looks as follows (the other devices are analogous)
config wifi-device 'radio0'
    option type 'mac80211'
    option path 'pci0000:00/0000:00:00.0'
    option hwmode '11a'
    option htmode 'HT40'
    option country 'DE'

config wifi-iface 'wifi_5ghz'
    option ifname 'wifi_5ghz'
    option device 'radio0'
    option network 'lan'
    option mode 'ap'
    option ssid 'mywifi'
    option encryption 'wpa2+ccmp'
    option auth_server '<...>'
    option auth_secret '<...>'

config wifi-iface 'legacy_5ghz'
    option ifname 'legacy_5ghz'
    option device 'radio0'
    option network 'lan'
    option mode 'ap'
    option ssid 'mywifi_legacy'
    option encryption 'psk2+ccmp'
    option key '<...>'
    option macfilter 'allow'
    option maclist '<...>'

config wifi-device 'radio1'
    option type 'mac80211'
    option path 'platform/ahb/18100000.wmac'
    option hwmode '11g'
    option htmode 'HT20'
    option country 'DE'

config wifi-iface 'wifi_24ghz'
    option ifname 'wifi_24ghz'
    option device 'radio1'
    option network 'lan'
    option mode 'ap'
    option ssid 'mywifi'
    option encryption 'wpa2+ccmp'
    option auth_server '<...>'
    option auth_secret '<...>'

config wifi-iface 'legacy_24ghz'
    option ifname 'legacy_24ghz'
    option device 'radio1'
    option network 'lan'
    option mode 'ap'
    option ssid 'mywifi_legacy'
    option encryption 'psk2+ccmp'
    option key '<...>'
    option macfilter 'allow'
    option maclist '<...>'