/etc/network/if-up.d/wpasupplicant throws error in invocation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
wpasupplicant (Ubuntu) |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: wpasupplicant
The error is about unknown mode:
$ sudo ./wpasupplicant
wpa_supplicant: unknown mode: ""
$ sudo sh -x /etc/network/
+ [ -n ]
+ [ = lo ]
+ [ -n ]
+ WPA_IFACE=
+ [ -f /etc/wpa_
+ . /etc/wpa_
+ WPA_SUP_
+ WPA_SUP_
+ WPA_SUP_
+ WPA_CLI_
+ WPA_CLI_
+ WPA_CLI_
+ WPA_CLI_
+ WPA_CLI_
+ WPA_CLI_
+ [ -d /lib/init/
+ WPA_SUP_
+ WPA_CLI_
+ [ -z ]
+ WPA_CTRL_
+ [ -n ]
+ [ = 1 ]
+ TO_NULL=/dev/null
+ DAEMON_
+ [ ! -x /sbin/wpa_
+ [ ! -x /sbin/wpa_cli ]
+ wpa_msg stderr unknown mode: ""
+ [ -n ]
+ shift
+ echo wpa_supplicant: unknown mode: ""
wpa_supplicant: unknown mode: ""
+ exit 1
It seems the wpasupplicant script must be called with an environment variable of MODE, stating either start or stop. For the script there also seems to the PHASE variable to be of importance. These don't seem to be set when calling from if-up or if-down.
When /etc/network/ if-up.d/ wpasupplicant is called from ifupdown, the MODE and PHASE variables are set, see man interfaces(5). You can for instance add
logger "wpasupplicant: $IFACE $ADDRFAM $MODE $PHASE"
to the script and check the result in /var/log/syslog.
However I have discovered that PHASE is "up" (probably because the script is in the if-up.d directory) but the script checks for "post-up" so I wonder if init_wpa_cli is ever called.