Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: wpa_supplicant refusing to start (Read 2162 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

wpa_supplicant refusing to start

I'm trying to setup wpa_supplicant service in 66, but it seems that it currently doesn't pass configuration parameters correctly.

I concluded this based on the fact that I get the usage screen in the log, which happens when wpa_supplicant program is supplied wrong arguments: https://paste.artixlinux.org/view/442d3782 (tail-ed the last 25 lines)

Here's my 66-env -t default wpa_supplicant:
Code: [Select]
CONF_FILE=/etc/wpa_supplicant/wpa_setnet.conf
WPA_INTERFACE=wlan0
DRIVER=nl80211

I used the setnet program to generate /etc/wpa_supplicant/wpa_setnet.conf. Here it is:
Code: [Select]
ctrl_interface=/var/run/wpa_supplicant
update_config=1

network={
ssid="<redacted>"
psk="<redacted>"
disabled=0
}

This works when I start wpa_supplicant manually, like this:
Code: [Select]
# wpa_supplicant -i wlan0 -D nl80211 -c /etc/wpa_supplicant/wpa_setnet.conf
but not when I boot (by the wpa_supplicant service).

Re: wpa_supplicant refusing to start

Reply #1
Looking at the command from paste "wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf" the -c isn't separated like it should be but looking at the script it shows to be separated

Re: wpa_supplicant refusing to start

Reply #2
Looking at the command from paste "wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf" the -c isn't separated like it should be but looking at the script it shows to be separated
That's the form from the usage screen:
Code: [Select]
$ wpa_supplicant
Successfully initialized wpa_supplicant
wpa_supplicant v2.9
Copyright (c) 2003-2019, Jouni Malinen <[email protected]> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.

This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)

usage:
  wpa_supplicant [-BddhKLqqstuvW] [-P<pid file>] [-g<global ctrl>] \
        [-G<group>] \
        -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
        [-b<br_ifname>] [-e<entropy file>] [-f<debug file>] \
        [-o<override driver>] [-O<override ctrl>] \
        [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
        [-m<P2P Device config file>] \
        [-p<driver_param>] [-b<br_ifname>] [-I<config file>] ...]

drivers:
  nl80211 = Linux nl80211/cfg80211
  wext = Linux wireless extensions (generic)
  wired = Wired Ethernet driver
  macsec_linux = MACsec Ethernet driver for Linux
  none = no driver (RADIUS server/WPS ER)
options:
  -b = optional bridge interface name
  -B = run daemon in the background
  -c = Configuration file
  -C = ctrl_interface parameter (only used if -c is not)
  -d = increase debugging verbosity (-dd even more)
  -D = driver name (can be multiple drivers: nl80211,wext)
  -e = entropy file
  -f = log output to debug file instead of stdout
  -g = global ctrl_interface
  -G = global ctrl_interface group
  -h = show this help text
  -i = interface name
  -I = additional configuration file
  -K = include keys (passwords, etc.) in debug output
  -L = show license (BSD)
  -m = Configuration file for the P2P Device interface
  -N = start describing new interface
  -o = override driver parameter for new interfaces
  -O = override ctrl_interface parameter for new interfaces
  -p = driver parameters
  -P = PID file
  -q = decrease debugging verbosity (-qq even less)
  -s = log output to syslog instead of stdout
  -t = include timestamp in debug messages
  -T = record to Linux tracing in addition to logging
       (records all messages regardless of debug verbosity)
  -u = enable DBus control interface
  -v = show version
  -W = wait for a control interface monitor before starting
example:
  wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf
I tried both forms, and both seem to work:
Code: [Select]
# wpa_supplicant -i wlan0 -D nl80211 -c /etc/wpa_supplicant/wpa_setnet.conf
and
Code: [Select]
# wpa_supplicant -iwlan0 -Dnl80211 -c/etc/wpa_supplicant/wpa_setnet.conf

Re: wpa_supplicant refusing to start

Reply #3
I just pushed a new version to testing, I believe it was the “-M” that may be doing that

Re: wpa_supplicant refusing to start

Reply #4
Here's my current very simple wireless scripts, you see my wpa_supplicant.conf is a bit different, you aren't setting the ctrl_interface_group, don't know if that helps:
Code: [Select]
wlan1 on script:
#!/bin/bash
ip link set wlan1 up
wpa_supplicant -B -P /run/wpa_supplicant_wlan1.pid  -i wlan1 -D nl80211,wext \
-c /somewhere/my_wpa_supplicant.conf
sleep 1
#dhcpcd -4 -t 0 -K wlan1 # dhcpcd may not work if network manager is installed
#dhclient is a bit better at re-connections etc used in this simple way
dhclient -v -cf /somewhere/dhclient.conf wlan1


my_wpa_supplicant.conf:
ctrl_interface=/run/wpa_supplicant
ctrl_interface_group=wheel
network={
proto=RSN WPA
psk="xyz"
bssid=....
#( or ssid)
}
# you can use wpa_passphrase to encrypt the key if you want
#also this file should be root owned and unreadable by other users

dhclient.conf:
#an empty file

wlan1 off script:
#!/bin/bash
  dhclient -x wlan1
  wpa_cli -i wlan1 -p /run/wpa_supplicant terminate
  ip link set wlan1 down
  rm -f /run/wpa_supplicant/wlan1
Currently I have a few variants for different interfaces and AP's but it would be quite easy to add some command line options to deal with that too. Occasionally I install some proper "manager" if I might need to quickly connect to someone else's unknown network though.

Re: wpa_supplicant refusing to start

Reply #5
Here's my current very simple wireless scripts, you see my wpa_supplicant.conf is a bit different, you aren't setting the ctrl_interface_group, don't know if that helps:
Well, like I said, wpa_supplicant works for me when run manually from CLI, but not automatically from the "default" tree on boot.

I'm waiting for the update to propagate so I can try it.

Update: Just realised I need to enable "gremlins" repo and install the package from there. Did that and rebooted and there's no change - wpa_supplicant still refuses to start on boot and gives usage information in its log.

Re: wpa_supplicant refusing to start

Reply #6
I will work on it and figure out the issue and push new update once I find the issue.

Update: I've pushed a new script to testing, one that is much simpler, just need to change the env flags to match what you need, like conf, interface, and driver. I am not using wireless, as I dont have a wireless card to test, but I did end up with a new error as I was expecting since I don't.

Re: wpa_supplicant refusing to start

Reply #7
No, sorry, it may just be the "sleep" you see in my "on" script, I had the exact same problem, I kept running the same commands manually but it never worked in a script until I added the sleep line. Also I get the same thing connecting to a static ethernet network with a simple script that also prints if it worked:
Code: [Select]
#!/bin/bash
# running for real you need some real numbers,
# write resolv.conf to /etc not /tmp
# and uncomment the 3 lines below the EOF
cat << EOF > /tmp/resolv.conf
domain foo
search foo bar
nameserver 2.3.4.5
EOF
#ip link set eth0 up
#ip addr add 1.2.3.104/26 dev eth0
#ip route add default via 1.2.3.123 dev eth0
ip route show
sleep 2 # 1 probably works too
#without sleep first ping fails even though it's the default gateway!
echo "pinging gateway:"
ping -c1 1.2.3.123
echo "pinging other device:"
ping -c1 1.2.3.4
The CPU is faster than the network - that was what I was saying in the other thread about testing rather than sleep. 1 second might be far too long or on some occasions could be too slow and everything fails, although it's fine for what I wanted.
(Actually testing this now it works without the sleep with both dhclient and dhcpcd but didn't used to, and the ethernet one is a recent thing so ymmv, who knows...)

Re: wpa_supplicant refusing to start

Reply #8
Just installed and tried the wpa_supplicant-suite66-20210829-2 version, and I'm getting this in the log:
Code: [Select]
2021-08-30 13:10:03.867187047  Successfully initialized wpa_supplicant
2021-08-30 13:10:03.884467927  Could not read interface ${INTERFACE} flags: No such device
2021-08-30 13:10:03.884528021  nl80211: Driver does not support authentication/association or connect commands
2021-08-30 13:10:03.884536041  nl80211: deinit ifname=${INTERFACE} disabled_11b_rates=0
2021-08-30 13:10:03.888492458  Could not read interface ${INTERFACE} flags: No such device
2021-08-30 13:10:03.888565080  ${INTERFACE}: Failed to initialize driver interface

The CPU is faster than the network - that was what I was saying in the other thread about testing rather than sleep. 1 second might be far too long or on some occasions could be too slow and everything fails, although it's fine for what I wanted.
(Actually testing this now it works without the sleep with both dhclient and dhcpcd but didn't used to, and the ethernet one is a recent thing so ymmv, who knows...)
Sleep as means of synchronization is a bad idea. There are other, better ways to achieve that.

Re: wpa_supplicant refusing to start

Reply #9
Can you paste your script after editing the variables?

Re: wpa_supplicant refusing to start

Reply #10
Code: [Select]
2021-08-30 06:47:04.521059677  Successfully initialized wpa_supplicant
2021-08-30 06:47:04.532405722  wlan0: Unsupported driver 'n180211'
2021-08-30 06:47:05.523116205  Successfully initialized wpa_supplicant
2021-08-30 06:47:05.525756675  wlan0: Unsupported driver 'n180211'
2021-08-30 06:47:06.524606372  Successfully initialized wpa_supplicant
2021-08-30 06:47:06.527195079  wlan0: Unsupported driver 'n180211'

This is what I get, which I expect



Re: wpa_supplicant refusing to start

Reply #13
Did you use ! in the variables?
Example:
INTERFACE=!n108211
Not initially. Just tried to add that, and I'm getting the same mesages in the log:
Code: [Select]
2021-08-30 14:02:33.266436548  Successfully initialized wpa_supplicant
2021-08-30 14:02:33.283778357  Could not read interface ${INTERFACE} flags: No such device
2021-08-30 14:02:33.283819294  nl80211: Driver does not support authentication/association or connect commands
2021-08-30 14:02:33.283825023  nl80211: deinit ifname=${INTERFACE} disabled_11b_rates=0
2021-08-30 14:02:33.287095944  Could not read interface ${INTERFACE} flags: No such device
2021-08-30 14:02:33.287131543  ${INTERFACE}: Failed to initialize driver interface

Re: wpa_supplicant refusing to start

Reply #14
What is the output of 66-env -L wpa_supplicant