Zdravím, měl bych dotaz. Chtěl bych docílit aby se raspberry pi 3B+ (dále jen rpi) samo po startu připojilo k wifi pokud je dostupná.
Na většině distribucí co jsem používal stačilo informace o síti zapsat do /etc/wpa_supplicant/wpa_supplicant.conf a povolit supplicnat po startu, zde to ale nefunguje. Zkoušeno na čistém aktualizovaném Archlinuxu pro architekturu armv7.
V případě že v systemd povolím wpa_supplicant.service tak poté mi to po restartu do logu vypíše
úno 25 22:29:58 alarmpi systemd[1]: Starting WPA supplicant...
úno 25 22:29:58 alarmpi wpa_supplicant[272]: Successfully initialized wpa_supplicant
úno 25 22:29:58 alarmpi systemd[1]: Started WPA supplicant.
Ale rozhraní je pořád down.
Pokud se pokusím připojit pomocí příkazu: wpa_supplicant -B -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -d
tak se připojím a po zavolání dhcpcd dostanu i IP adresu.
V logu dostanu toto
wpa_supplicant v2.6
Successfully initialized wpa_supplicant
Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'nl80211' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface='/var/run/wpa_supplicant'
ctrl_interface_group='wheel'
update_config=1
country='CZ'
ap_scan=1
Priority group 0
id=0 ssid='SiliconHill'
nl80211: Using driver-based roaming
nl80211: TDLS supported
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:6
nl80211: Using driver-based off-channel TX
nl80211: Supported vendor command: vendor_id=0x1018 subcmd=1
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: use P2P_DEVICE support
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Subscribe to mgmt frames with non-AP handle 0x120e220
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=0104
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=040a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=040b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=040c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=040d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=090a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=090b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=090c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=090d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=0409506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=7f506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=0801
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=040e
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=0a07
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=0a11
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=0a1a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=1101
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=1102
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=0505
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x120e220 match=0500
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
netlink: Operstate: ifindex=3 linkmode=1 (userspace-control), operstate=5 (IF_OPER_DORMANT)
Add interface wlan0 to a new radio phy0
nl80211: Regulatory information - country=00
nl80211: 2402-2472 @ 40 MHz 20 mBm
nl80211: 2457-2482 @ 20 MHz 20 mBm (no IR)
nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR)
nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR)
nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS) (no IR)
nl80211: 5490-5730 @ 160 MHz 20 mBm (DFS) (no IR)
nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR)
nl80211: 57240-63720 @ 2160 MHz 0 mBm
nl80211: Added 802.11b mode based on 802.11g information
wlan0: Own MAC address: b8:27:eb:f4:1b:e7
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=4 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=5 set_tx=0 seq_len=0 key_len=0
wlan0: RSN: flushing PMKID list in the driver
nl80211: Flush PMKIDs
TDLS: TDLS operation supported by driver
TDLS: Driver uses internal link setup
TDLS: Driver does not support TDLS channel switching
wlan0: WPS: UUID based on MAC address: 171a15bc-4c1a-5f14-b9df-d3cab72bdf4c
ENGINE: Loading dynamic engine
ENGINE: Loading dynamic engine
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
nl80211: Skip set_supp_port(unauthorized) while not associated
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
ctrl_interface_group=998 (from group name 'wheel')
wlan0: Added interface wlan0
wlan0: State: DISCONNECTED -> DISCONNECTED
nl80211: Set wlan0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=3 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
nl80211: Create interface iftype 10 (P2P_DEVICE)
nl80211: New P2P Device interface p2p-dev-wlan0 (0x2) created
Initializing interface 'p2p-dev-wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'nl80211' ctrl_interface '/var/run/wpa_supplicant' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface='/var/run/wpa_supplicant'
ctrl_interface_group='wheel'
update_config=1
country='CZ'
ap_scan=1
Priority group 0
id=0 ssid='SiliconHill'
nl80211: Using driver-based roaming
nl80211: TDLS supported
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:6
nl80211: Using driver-based off-channel TX
nl80211: Supported vendor command: vendor_id=0x1018 subcmd=1
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: use P2P_DEVICE support
nl80211: interface p2p-dev-wlan0 in phy phy0
nl80211: Set mode ifindex 0 iftype 10 (P2P_DEVICE)
nl80211: Failed to set interface 0 to mode 10: -22 (Invalid argument)
nl80211: Subscribe to mgmt frames with non-AP handle 0x1223620
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=0104
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=040a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=040b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=040c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=040d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=090a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=090b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=090c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=090d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=0409506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=7f506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=0801
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=040e
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=0a07
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=0a11
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=0a1a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=1101
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=1102
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=0505
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1223620 match=0500
nl80211: Use (wlan0) to initialize P2P Device rfkill
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
nl80211: Start P2P Device p2p-dev-wlan0 (0x2): Success
Add interface p2p-dev-wlan0 to existing radio phy0
nl80211: Regulatory information - country=CZ (DFS-ETSI)
nl80211: 2400-2483 @ 40 MHz 20 mBm
nl80211: 5150-5250 @ 80 MHz 23 mBm (no outdoor)
nl80211: 5250-5350 @ 80 MHz 20 mBm (no outdoor) (DFS)
nl80211: 5470-5725 @ 160 MHz 26 mBm (DFS)
nl80211: 57000-66000 @ 2160 MHz 40 mBm
nl80211: Added 802.11b mode based on 802.11g information
p2p-dev-wlan0: Own MAC address: 56:f8:91:8c:c9:4f
p2p-dev-wlan0: RSN: flushing PMKID list in the driver
nl80211: Flush PMKIDs
p2p-dev-wlan0: State: DISCONNECTED -> INACTIVE
p2p-dev-wlan0: WPS: UUID from the first interface: 171a15bc-4c1a-5f14-b9df-d3cab72bdf4c
ENGINE: Loading dynamic engine
ENGINE: Loading dynamic engine
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
nl80211: Skip set_supp_port(unauthorized) while not associated
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
Using existing control interface directory.
ctrl_interface_group=998 (from group name 'wheel')
P2P: Add operating class 81
P2P: Channels - hexdump(len=13): 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d
P2P: Add operating class 115
P2P: Channels - hexdump(len=4): 24 28 2c 30
P2P: Add operating class 116
P2P: Channels - hexdump(len=2): 24 2c
P2P: Add operating class 117
P2P: Channels - hexdump(len=2): 28 30
P2P: Add operating class 128
P2P: Channels - hexdump(len=4): 24 28 2c 30
P2P: Add operating class 130
P2P: Channels - hexdump(len=4): 24 28 2c 30
P2P: Own listen channel: 81:1
P2P: Random operating channel: 81:6
P2P: initialized
P2P: channels: 81:1,2,3,4,5,6,7,8,9,10,11,12,13 115:36,40,44,48 116:36,44 117:40,48 128:36,40,44,48 130:36,40,44,48
P2P: cli_channels:
p2p-dev-wlan0: Added interface p2p-dev-wlan0
p2p-dev-wlan0: State: INACTIVE -> DISCONNECTED
nl80211: Set p2p-dev-wlan0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=0 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
p2p-dev-wlan0: Determining shared radio frequencies (max len 2)
p2p-dev-wlan0: Shared frequencies (len=0): completed iteration
P2P: Add operating class 81
P2P: Channels - hexdump(len=13): 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d
P2P: Add operating class 115
P2P: Channels - hexdump(len=4): 24 28 2c 30
P2P: Add operating class 116
P2P: Channels - hexdump(len=2): 24 2c
P2P: Add operating class 117
P2P: Channels - hexdump(len=2): 28 30
P2P: Add operating class 128
P2P: Channels - hexdump(len=4): 24 28 2c 30
P2P: Add operating class 130
P2P: Channels - hexdump(len=4): 24 28 2c 30
P2P: Update channel list
P2P: channels: 81:1,2,3,4,5,6,7,8,9,10,11,12,13 115:36,40,44,48 116:36,44 117:40,48 128:36,40,44,48 130:36,40,44,48
P2P: cli_channels:
Daemonize..
Pokud ale upravím wpa_supplicant.service tak že ExecStart=/usr/bin/wpa_supplicant -B -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -d
tak poté se wifi nepřipojí a v logu mám:
úno 25 22:24:53 alarmpi systemd[1]: Starting WPA supplicant...
úno 25 22:24:53 alarmpi wpa_supplicant[270]: wpa_supplicant v2.6
úno 25 22:24:53 alarmpi wpa_supplicant[270]: Successfully initialized wpa_supplicant
úno 25 22:24:53 alarmpi wpa_supplicant[270]: Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'nl80211' ctrl_interface 'N/A' bridge>
úno 25 22:24:53 alarmpi wpa_supplicant[270]: Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
úno 25 22:24:53 alarmpi wpa_supplicant[270]: Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
úno 25 22:24:53 alarmpi wpa_supplicant[270]: ctrl_interface='/var/run/wpa_supplicant'
úno 25 22:24:53 alarmpi wpa_supplicant[270]: ctrl_interface_group='wheel'
úno 25 22:24:53 alarmpi wpa_supplicant[270]: update_config=1
úno 25 22:24:53 alarmpi wpa_supplicant[270]: country='CZ'
úno 25 22:24:53 alarmpi wpa_supplicant[270]: ap_scan=1
úno 25 22:24:53 alarmpi wpa_supplicant[270]: Priority group 0
úno 25 22:24:53 alarmpi wpa_supplicant[270]: id=0 ssid='SiliconHill'
úno 25 22:24:53 alarmpi wpa_supplicant[270]: Could not read interface wlan0 flags: No such device
úno 25 22:24:53 alarmpi wpa_supplicant[270]: nl80211: Driver does not support authentication/association or connect commands
úno 25 22:24:53 alarmpi wpa_supplicant[270]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
úno 25 22:24:53 alarmpi wpa_supplicant[270]: nl80211: Remove monitor interface: refcount=0
úno 25 22:24:53 alarmpi wpa_supplicant[270]: netlink: Operstate: ifindex=0 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
úno 25 22:24:53 alarmpi wpa_supplicant[270]: Could not read interface wlan0 flags: No such device
úno 25 22:24:53 alarmpi wpa_supplicant[270]: nl80211: Set mode ifindex 0 iftype 2 (STATION)
úno 25 22:24:53 alarmpi wpa_supplicant[270]: nl80211: Failed to set interface 0 to mode 2: -19 (No such device)
úno 25 22:24:53 alarmpi wpa_supplicant[270]: wlan0: Failed to initialize driver interface
úno 25 22:24:53 alarmpi wpa_supplicant[270]: Failed to add interface wlan0
úno 25 22:24:53 alarmpi wpa_supplicant[270]: wlan0: Cancelling scan request
úno 25 22:24:53 alarmpi wpa_supplicant[270]: wlan0: Cancelling authentication timeout
úno 25 22:24:53 alarmpi wpa_supplicant[270]: Off-channel: Clear pending Action frame TX (pending_action_tx=(nil)
úno 25 22:24:53 alarmpi systemd[1]: wpa_supplicant.service: Main process exited, code=exited, status=255/EXCEPTION
úno 25 22:24:53 alarmpi systemd[1]: wpa_supplicant.service: Failed with result 'exit-code'.
úno 25 22:24:53 alarmpi systemd[1]: Failed to start WPA supplicant.
Z mého laického pohledu to vypadá jako kdyby se wpa_supplicant pokoušel připojit k wifi ještě dříve než kernel najde síťovou kartu. Ale je to jen laický odhad. Vím že si můžu udělat vlastní skript co se mi pustí po naběhnutí systemu a připojí se k wifi protože poté už wpa_supplicant funguje, ale já hledám nějaké čistější řešení.
Za každou radu díky
Informace co by se mohli hodit:
/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
update_config=1
country=CZ
ap_scan=1
network={
ssid="SiliconHill"
scan_ssid=1
key_mgmt=WPA-EAP
identity="jmeno"
password="heslo"
eap=PEAP
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
}
uname -a
Linux alarmpi 4.19.23-2-ARCH #1 SMP PREEMPT Sat Feb 23 19:03:59 UTC 2019 armv7l GNU/Linux
lsmod
Module Size Used by
btsdio 16384 0
bluetooth 364544 2 btsdio
ecdh_generic 28672 1 bluetooth
brcmfmac 212992 0
brcmutil 16384 1 brcmfmac
bcm2835_codec 36864 0
bcm2835_v4l2 45056 0
cfg80211 643072 1 brcmfmac
v4l2_mem2mem 24576 1 bcm2835_codec
bcm2835_mmal_vchiq 28672 2 bcm2835_codec,bcm2835_v4l2
v4l2_common 16384 1 bcm2835_v4l2
videobuf2_vmalloc 16384 1 bcm2835_v4l2
videobuf2_dma_contig 20480 1 bcm2835_codec
videobuf2_memops 16384 2 videobuf2_dma_contig,videobuf2_vmalloc
videobuf2_v4l2 24576 3 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem
raspberrypi_hwmon 16384 0
videobuf2_common 45056 4 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
hwmon 16384 1 raspberrypi_hwmon
videodev 180224 6 bcm2835_codec,v4l2_common,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
media 32768 2 videodev,v4l2_mem2mem
vc_sm_cma 20480 1 bcm2835_mmal_vchiq
bcm2835_rng 16384 0
rng_core 16384 1 bcm2835_rng
uio_pdrv_genirq 16384 0
fixed 16384 0
uio 20480 1 uio_pdrv_genirq
sch_fq_codel 20480 2
snd_bcm2835 32768 0
snd_pcm 90112 1 snd_bcm2835
snd_timer 32768 1 snd_pcm
snd 65536 3 snd_timer,snd_bcm2835,snd_pcm
ip_tables 24576 0
x_tables 32768 1 ip_tables
ipv6 446464 42