1

we are facing a weird issue. Basically, wpa_supplicant tries to connect to wifi network, and apparently succeeds, but it can get no IP address.

We are using a Raspberry Pi Zero W to generate an hotspot, then connect to it using an app to set up the wifi credentials, so the Pi can connect to a wifi network. Everything works fine, but sometimes if fails and remains in a state where the connection is up, but with no IP. Often, but not every time, it happens after we "reset" the wifi connection and get back to AP mode, using a GPIO value (we are still simulating it via command line, but it should be replaced by a button). When the looping script reads "1" on a certain GPIO for more than 5 seconds, it resets the connection status and reverts back to AP mode.

The "reset" part of the script is the following:

wpa_cli terminate  >> $logfile 2>&1
ip addr flush "$wifidev" >> $logfile 2>&1
ip link set dev "$wifidev" down >> $logfile 2>&1
rm -r /var/run/wpa_supplicant >> $logfile 2>&1
ip link set dev "$wifidev" up >> $logfile 2>&1

Then it proceeds to set up the hotspot like this:

ip link set dev "$wifidev" down
ip a add 10.0.0.5/24 brd + dev "$wifidev"
ip link set dev "$wifidev" up
systemctl start dnsmasq
systemctl start hostapd

Where $wifidev is "wlan0".

To connect to the desired network we use the following command:

wpa_supplicant -d -f /tmp/wlanlog -B -i "$wifidev" -c /etc/wpa_supplicant/wpa_supplicant.conf >/dev/null 2>&1

We are not posting the full log of this command because it is too big, but the last part is this, maybe it contains something useful:

wlan0: State: SCANNING -> ASSOCIATING
nl80211: Set wlan0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=2 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
Limit connection to BSSID 1c:b7:2c:82:8b:a8 freq=2462 MHz based on scan results (bssid_set=0)
wlan0: set_disable_max_amsdu: -1
wlan0: set_ampdu_factor: -1
wlan0: set_ampdu_density: -1
wlan0: set_disable_ht40: 0
wlan0: set_disable_sgi: 0
wlan0: set_disable_ldpc: 0
wlan0: Determining shared radio frequencies (max len 1)
wlan0: Shared frequencies (len=0): completed iteration
nl80211: Set mode ifindex 2 iftype 2 (STATION)
nl80211: Unsubscribe mgmt frames handle 0x88fe7ea9 (mode change)
nl80211: Subscribe to mgmt frames with non-AP handle 0x76f620
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=040a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=040b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=040c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=040d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=090a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=090b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=090c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=090d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=0409506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=7f506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=0801
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=040e
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=0a07
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=0a11
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=1101
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=1102
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x76f620 match=0505
nl80211: Key management set PSK
nl80211: Connect (ifindex=2)
  * bssid=1c:b7:2c:82:8b:a8
  * bssid_hint=1c:b7:2c:82:8b:a8
  * freq=2462
  * freq_hint=2462
  * SSID - hexdump_ascii(len=9):
     72 65 74 65 2d 77 69 66 69                        rete-wifi
  * IEs - hexdump(len=28): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00 7f 04 00 00 0a 02
  * WPA Versions 0x2
  * pairwise=0xfac04
  * group=0xfac04
  * akm=0xfac02
  * htcaps - hexdump(len=26): 63 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  * htcaps_mask - hexdump(len=26): 63 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  * vhtcaps - hexdump(len=12): 00 00 00 00 00 00 00 00 00 00 00 00
  * vhtcaps_mask - hexdump(len=12): 00 00 00 00 00 00 00 00 00 00 00 00
  * Auth Type 0
nl80211: Connect request send successfully
wlan0: Setting authentication timeout: 10 sec 0 usec
EAPOL: External notification - EAP success=0
EAPOL: External notification - EAP fail=0
EAPOL: External notification - portControl=Auto
EAPOL: disable timer tick
RTM_NEWLINK: ifi_index=2 ifname=wlan0 operstate=5 linkmode=1 ifi_family=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK: ifi_index=2 ifname=wlan0 wext ifi_family=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK: ifi_index=2 ifname=wlan0 wext ifi_family=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK: ifi_index=2 ifname=wlan0 wext ifi_family=0 ifi_flags=0x11003 ([UP][LOWER_UP])
nl80211: Ignored event (cmd=46) for foreign interface (ifindex 2 wdev 0x0)
nl80211: Drv Event 46 (NL80211_CMD_CONNECT) received for wlan0
nl80211: Connect event (status=0 ignore_next_local_disconnect=0)
nl80211: Associated on 2462 MHz
nl80211: Associated with 1c:b7:2c:82:8b:a8
nl80211: Operating frequency for the associated BSS from scan results: 2462 MHz
wlan0: Event ASSOC (0) received
wlan0: Association info event
req_ies - hexdump(len=100): 00 09 72 65 74 65 2d 77 69 66 69 01 08 82 84 8b 96 24 30 48 6c 32 04 0c 12 18 60 21 02 05 17 24 02 01 0d 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00 2d 1a 21 00 1f ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 09 00 10 18 02 00 10 00 00 00 6c 00 00 00
resp_ies - hexdump(len=169): 01 08 82 84 8b 96 12 24 48 6c 32 04 0c 18 30 60 2d 1a ee 11 17 ff ff 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3d 16 0b 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 1e 00 90 4c 33 ee 11 17 ff ff 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 dd 1a 00 90 4c 34 0b 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4a 0e 14 00 0a 00 2c 01 c8 00 14 00 05 00 19 00 7f 08 00 00 00 01 00 00 00 00 dd 07 00 0c 43 03 00 00 00 00 03 01 00 00 00
WPA: Unrecognized EAPOL-Key Key Data IE - hexdump(len=24): 3d 16 0b 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
WPA: Unrecognized EAPOL-Key Key Data IE - hexdump(len=16): 4a 0e 14 00 0a 00 2c 01 c8 00 14 00 05 00 19 00
WPA: Unrecognized EAPOL-Key Key Data IE - hexdump(len=5): 00 03 01 00 00
wlan0: freq=2462 MHz
WPA: set own WPA/RSN IE - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
FT: Stored MDIE and FTIE from (Re)Association Response - hexdump(len=0):
wlan0: State: ASSOCIATING -> ASSOCIATED
nl80211: Set wlan0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=2 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
wlan0: Associated to a new BSS: BSSID=1c:b7:2c:82:8b:a8
wlan0: Associated with 1c:b7:2c:82:8b:a8
wlan0: WPA: Association event - clear replay counter
wlan0: WPA: Clear old PTK
TDLS: Remove peers on association
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
EAPOL: External notification - EAP success=0
EAPOL: External notification - portEnabled=1
EAPOL: SUPP_PAE entering state CONNECTING
EAPOL: enable timer tick
EAPOL: SUPP_BE entering state IDLE
wlan0: Setting authentication timeout: 10 sec 0 usec
wlan0: Cancelling scan request
WMM AC: Missing U-APSD configuration
nl80211: Drv Event 36 (NL80211_CMD_REG_CHANGE) received for p2p-dev-wlan0
nl80211: Regulatory domain change
 * initiator=3
 * type=0
 * alpha2=DE
p2p-dev-wlan0: Event CHANNEL_LIST_CHANGED (28) received
p2p-dev-wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=DE
nl80211: Regulatory information - country=DE (DFS-ETSI)
nl80211: 2400-2483 @ 40 MHz 20 mBm
nl80211: 5150-5250 @ 80 MHz 20 mBm (no outdoor)
nl80211: 5250-5350 @ 80 MHz 20 mBm (no outdoor) (DFS)
nl80211: 5470-5725 @ 160 MHz 26 mBm (DFS)
nl80211: 5725-5875 @ 80 MHz 13 mBm
nl80211: 57000-66000 @ 2160 MHz 40 mBm
nl80211: Added 802.11b mode based on 802.11g information
P2P: Add operating class 81
P2P: Channels - hexdump(len=13): 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d
P2P: Update channel list
P2P: channels: 81:1,2,3,4,5,6,7,8,9,10,11,12,13
P2P: cli_channels:
wlan0: Updating hw mode
nl80211: Regulatory information - country=DE (DFS-ETSI)
nl80211: 2400-2483 @ 40 MHz 20 mBm
nl80211: 5150-5250 @ 80 MHz 20 mBm (no outdoor)
nl80211: 5250-5350 @ 80 MHz 20 mBm (no outdoor) (DFS)
nl80211: 5470-5725 @ 160 MHz 26 mBm (DFS)
nl80211: 5725-5875 @ 80 MHz 13 mBm
nl80211: 57000-66000 @ 2160 MHz 40 mBm
nl80211: Added 802.11b mode based on 802.11g information
EAPOL: disable timer tick
l2_packet_receive: src=1c:b7:2c:82:8b:a8 len=99
wlan0: RX EAPOL from 1c:b7:2c:82:8b:a8
wlan0: Setting authentication timeout: 10 sec 0 usec
wlan0: IEEE 802.1X RX: version=1 type=3 length=95
wlan0:   EAPOL-Key type=2
wlan0:   key_info 0x8a (ver=2 keyidx=0 rsvd=0 Pairwise Ack)
wlan0:   key_length=16 key_data_length=0
  replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 01
  key_nonce - hexdump(len=32): 1d 74 c3 e8 c3 85 30 55 4f 3c 2d 42 b5 c5 69 31 c5 59 98 fe 6b 6e 3a a4 15 6a 3e e6 51 3b f7 ff
  key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  key_rsc - hexdump(len=8): 00 00 00 00 00 00 00 00
  key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00
  key_mic - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
wlan0: State: ASSOCIATED -> 4WAY_HANDSHAKE
wlan0: WPA: RX message 1 of 4-Way Handshake from 1c:b7:2c:82:8b:a8 (ver=2)
RSN: msg 1/4 key data - hexdump(len=0):
WPA: Renewed SNonce - hexdump(len=32): ca a8 bf 5e 6e 4c 40 0e a8 96 30 5d 2a e9 7f a8 e3 a8 84 b3 bd 2f 9e 57 1d 56 37 b3 47 61 86 81
WPA: PTK derivation - A1=b8:27:eb:bc:71:cd A2=1c:b7:2c:82:8b:a8
WPA: Nonce1 - hexdump(len=32): ca a8 bf 5e 6e 4c 40 0e a8 96 30 5d 2a e9 7f a8 e3 a8 84 b3 bd 2f 9e 57 1d 56 37 b3 47 61 86 81
WPA: Nonce2 - hexdump(len=32): 1d 74 c3 e8 c3 85 30 55 4f 3c 2d 42 b5 c5 69 31 c5 59 98 fe 6b 6e 3a a4 15 6a 3e e6 51 3b f7 ff
WPA: PMK - hexdump(len=32): [REMOVED]
WPA: PTK - hexdump(len=48): [REMOVED]
WPA: KCK - hexdump(len=16): [REMOVED]
WPA: KEK - hexdump(len=16): [REMOVED]
WPA: TK - hexdump(len=16): [REMOVED]
WPA: WPA IE for msg 2/4 - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
WPA: Replay Counter - hexdump(len=8): 00 00 00 00 00 00 00 01
wlan0: WPA: Sending EAPOL-Key 2/4
WPA: KCK - hexdump(len=16): [REMOVED]
WPA: Derived Key MIC - hexdump(len=16): fa 98 eb eb 8a 88 d5 59 c8 52 86 5b 8e 8f a3 8a
l2_packet_receive: src=1c:b7:2c:82:8b:a8 len=155
wlan0: RX EAPOL from 1c:b7:2c:82:8b:a8
wlan0: IEEE 802.1X RX: version=1 type=3 length=151
wlan0:   EAPOL-Key type=2
wlan0:   key_info 0x13ca (ver=2 keyidx=0 rsvd=0 Pairwise Install Ack MIC Secure Encr)
wlan0:   key_length=16 key_data_length=56
  replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 02
  key_nonce - hexdump(len=32): 1d 74 c3 e8 c3 85 30 55 4f 3c 2d 42 b5 c5 69 31 c5 59 98 fe 6b 6e 3a a4 15 6a 3e e6 51 3b f7 ff
  key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  key_rsc - hexdump(len=8): 5c c0 00 00 00 00 00 00
  key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00
  key_mic - hexdump(len=16): d6 37 5c 54 44 b3 7a 75 f9 02 f8 bb 81 69 d8 b1
RSN: encrypted key data - hexdump(len=56): c9 f7 31 9a 1a c7 a0 2e db 70 32 b0 3a 58 8a 40 ae 36 5b c8 f6 c8 af 97 1a 87 ca 1d 65 3c 08 1c d5 1e 00 75 08 82 32 de 4a 87 bd 21 57 9b 7b 83 a1 09 b5 4e 8a f1 3d 75
WPA: decrypted EAPOL-Key key data - hexdump(len=48): [REMOVED]
wlan0: State: 4WAY_HANDSHAKE -> 4WAY_HANDSHAKE
wlan0: WPA: RX message 3 of 4-Way Handshake from 1c:b7:2c:82:8b:a8 (ver=2)
WPA: IE KeyData - hexdump(len=48): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00 dd 16 00 0f ac 01 02 00 ba c1 9b d0 3b df 16 16 7e ad e3 a7 84 d3 40 84 dd 00
WPA: RSN IE in EAPOL-Key - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
WPA: GTK in EAPOL-Key - hexdump(len=24): [REMOVED]
wlan0: WPA: Sending EAPOL-Key 4/4
WPA: KCK - hexdump(len=16): [REMOVED]
WPA: Derived Key MIC - hexdump(len=16): 54 71 58 ef b2 7c 5c 17 b9 c7 7e a7 67 35 33 05
wlan0: WPA: Installing PTK to the driver
wpa_driver_nl80211_set_key: ifindex=2 (wlan0) alg=3 addr=0x76fd8c key_idx=0 set_tx=1 seq_len=6 key_len=16
nl80211: KEY_DATA - hexdump(len=16): [REMOVED]
nl80211: KEY_SEQ - hexdump(len=6): 00 00 00 00 00 00
   addr=1c:b7:2c:82:8b:a8
EAPOL: External notification - portValid=1
wlan0: State: 4WAY_HANDSHAKE -> GROUP_HANDSHAKE
RSN: received GTK in pairwise handshake - hexdump(len=18): [REMOVED]
WPA: Group Key - hexdump(len=16): [REMOVED]
wlan0: WPA: Installing GTK to the driver (keyidx=2 tx=0 len=16)
WPA: RSC - hexdump(len=6): 5c c0 00 00 00 00
wpa_driver_nl80211_set_key: ifindex=2 (wlan0) alg=3 addr=0x14a510 key_idx=2 set_tx=0 seq_len=6 key_len=16
nl80211: KEY_DATA - hexdump(len=16): [REMOVED]
nl80211: KEY_SEQ - hexdump(len=6): 5c c0 00 00 00 00
   broadcast key
wlan0: WPA: Key negotiation completed with 1c:b7:2c:82:8b:a8 [PTK=CCMP GTK=CCMP]
wlan0: Cancelling authentication timeout
wlan0: State: GROUP_HANDSHAKE -> COMPLETED
wlan0: Radio work 'connect'@0x784470 done in 0.386009 seconds
wlan0: CTRL-EVENT-CONNECTED - Connection to 1c:b7:2c:82:8b:a8 completed [id=0 id_str=]
nl80211: Set wlan0 operstate 0->1 (UP)
netlink: Operstate: ifindex=2 linkmode=-1 (no change), operstate=6 (IF_OPER_UP)
EAPOL: External notification - portValid=1
EAPOL: External notification - EAP success=1
EAPOL: SUPP_PAE entering state AUTHENTICATING
EAPOL: SUPP_BE entering state SUCCESS
EAP: EAP entering state DISABLED
EAPOL: SUPP_PAE entering state AUTHENTICATED
EAPOL: Supplicant port status: Authorized
nl80211: Set supplicant port authorized for 1c:b7:2c:82:8b:a8
EAPOL: SUPP_BE entering state IDLE
EAPOL authentication completed - result=SUCCESS
nl80211: Set rekey offload
nl80211: Driver does not support rekey offload
RTM_NEWLINK: ifi_index=2 ifname=wlan0 operstate=6 linkmode=1 ifi_family=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
EAPOL: startWhen --> 0
EAPOL: disable timer tick
wlan0: Control interface command 'STATUS'
EAPOL: EAP Session-Id not available
wlan0: Control interface command 'STATUS'
EAPOL: EAP Session-Id not available
wlan0: Control interface command 'STATUS'
EAPOL: EAP Session-Id not available

When this situation happens, we can revert the Pi to AP mode, which works fine, but every attempt to connect to a wifi network generates the same result - connected, but no IP address.

Moreover, when this happens, if we reboot the Pi leaving the wifi config inside /etc/wpa_supplicant/wpa_supplicant.con, it connects fine and everything works - reset included! And it suddenly stops giving the problem, even reverting to AP and reconnecting multiple times in a row.

This is the output of wpa_cli -i wlan0 status when the Pi is correctly connected to the Wifi network:

bssid=1c:b7:2c:82:8b:a8
freq=2462
ssid=rete-wifi
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=192.168.1.7
p2p_device_address=ba:27:eb:bc:71:cd
address=b8:27:eb:bc:71:cd
uuid=c557c4b6-f4ea-53fc-a3c4-95bd1563665e

This is the output of the same command when the "no-IP" situation verifies:

bssid=1c:b7:2c:82:8b:a8
freq=2462
ssid=rete-wifi
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
p2p_device_address=ba:27:eb:bc:71:cd
address=b8:27:eb:bc:71:cd
uuid=c557c4b6-f4ea-53fc-a3c4-95bd1563665e

/etc/network/interfaces:

# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

/etc/dhcpcd.conf

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

/etc/wpa_supplicant/wpa_supplicant.conf (the lines between the commented lines are script-generated):

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
#===AUTOCONFIG===
network={
        ssid="someSsidName"
        psk="somePassword"
}
#===AUTOCONFIG===

We tried connecting to both a broadband router and an hotspot generated using an iPhone, but nothing changed so i would exclude network issues like dhcp not working.

Any idea about some log/line/file/config we could check to avoid this behaviour?

Thanks.

  • You are barking up the wrong tree wpa_supplicant does NOT get the IP address (this is normally done by dhcpcd). If you are trying to change modes you need to restart! – Milliways Apr 10 '18 at 0:20
  • You're correct, but the wifi connection is necessary to get an address from the DHCP server. – Seamus Apr 10 '18 at 2:33
  • 1
    What does the log from your dhcp server says? Do you see DHCP_REQUESTS and DHCP_OFFER? Maybe there are simply no more free ip addresses? – Ingo Apr 10 '18 at 9:18
0

Just a hunch, but try adding the following as the 3rd line in your network{} spec:

scan_ssid=1
0

thanks for the help. We resolved this issue, thanks the Inigo hint in the comments. It turned out that sometimes the dhcpd service just died when swapping mode, probably due to turning off/on the interface suddenly. We put control in the script that restarts the dhcpd service if it gets no ip address after 5 seconds of connection.

Thanks again to everyone, hope this will be of help to somebody!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.