Wpa_supplicant give "wlan1: mesh join error=-149" on boot

I have a very simple procd script for starting/stopping wpa_supplicant that works fine from the command line, but when I reboot I get this error in the syslog:
wlan1: mesh join error=-149

Here's the script:

#!/bin/sh /etc/rc.common
START=99   # Yes, I've enabled the service
STOP=50
start_service() {
  procd_open_instance
  procd_set_param command /usr/sbin/wpa_supplicant -i wlan1 -dd -t -s -c /etc/wpa_supplicant.conf
  procd_set_param respawn
  procd_close instance
}

After I reboot I have to run /etc/init.d/wpa_supplicant stop and then /etc/init.d/wpa_supplicant start and it works fine.

By the way, I've tried disabling the procd script and and starting wpa_supplicant in /etc/rc.local with the same results. I also put in a sleep to give the interfaces time to come up. I've obviously Googled this before posting, but I have yet to find anything that works.

Thanks for your help!

Is there a reason you’re not letting procd/netifd manage wpa_supplicant? Generally, that manages the orchestration of all the moving pieces quite well without any scripting.

Edit: My first guess is that the interface doesn’t exist when your script runs at boot.

I just started messing with OpenWrt a couple weeks ago and had never heard of netifd until you mentioned it here. All the examples I saw for setting up wpa_supplicant involved writing a procd script like the one I've included, which works fine except during a reboot. I'm not yet sure how to let netifd manage wpa_supplicant and there's next to no documentation out there, so I'm just pretty much winging it for now :slight_smile:.

I suspected the same thing about the interface not being up causing the failure, so when I moved the startup of wpa_supplicant to /etc/rc.local I put a sleep command in there to give the interfaces time to intialize and checked that they were there.

With "normal" configuration in /etc/config/wireless and /etc/config/network, no additional scripts should be required for virtually any situation. If you did need to do something "special" (like some unsupported, advanced networking protocol), use of "hotplug" scripts that listen to interface up/down events would probably be a much more robust path.

https://openwrt.org/docs/guide-user/network/wifi/basic

https://openwrt.org/docs/guide-user/base-system/basic-networking

https://openwrt.org/docs/guide-user/base-system/hotplug

No, I don't think we're doing anything "special". Just to clarify you're saying if I have /etc/config/wireless and /etc/config/network configured correctly I don't need the /etc/init.d/wpa_supplicant or a wpa_supplicant.conf at all? Assuming the wpa_supplicant-wlan1.conf gets generated based on my settings in /etc/config/network and /etc/config/wireless? I must have missed something because it's definitely not meshing up. I don't see a wpa_supplicant process either and of course no indication on the other mesh point that they connected. Guess I got a little more homework to do. Thanks!

Have you uninstalled wpad-* and installed wpad-mesh already?

Yes, with just proper config in wireless and network you should be able to bring up 802.11s mesh without any additional scripts.

See, as one example

Yes, if I enter opkg list-installed | grep wpad I get wpad-mesh-openssl as a result. Still not generating a wpa_supplicant conf file though when I enter /etc/init.d/wireless reload. According to logread the interface we have set up for the mesh point comes up, but that's where the log messages stop. Almost like it doesn't recognize mesh mode.

Would you post your (redacted) /etc/config/wireless and /etc/config/network? Perhaps there is something there that could use adjustment. The preformatted-text button </> will make it easier to read.

/etc/config/network:

config interface 'mesh'
   option ifname 'wlan1'
   option ipaddr '...'
   option netmask '255.255.255.0'
   option proto 'static'


/etc/config/wireless:

config wifi-device 'radio1'
   option type 'mac80211'
   option channel '11'
   option hwmode '11g'
   option path 'platform/qca955x_wmac'
   option htmode 'HT20'
   option disabled '0'
 
config wifi-iface 'mesh'
  option device 'radio1'
  option network 'mesh'
  option mode 'mesh'
  option mesh_id 'myId'
  option encryption 'SAE'
  option key 'password'
  option ieee80211w 1

Thanks again.

Try option encryption psk2+ccmp and also try removing option ieee80211w

For reference, /lib/netifd/netifd-wireless.sh is what sets up the wireless.