DHCP failure on Android WiFi (stuck on obtaining IP address) – How I solved it

This evening my phone wouldn’t connect to my WiFi network anymore after a SIM change + reboot (maybe unrelated?).

Anyway, it seems that many people are affected by this issue, but it took me a while to find a workaround, because I found a lot of incomplete and fragmented information. I’ll try to put everything in this post so people with the same problem can hopefully spend less time to solve it.

My configuration: Sony Ericsson Live with Cyanogen mod 9 (Android 4.0.4).

Problem description

Wireless card will not connect to WiFi network when using DHCP (in my case the AP is a CISCO router flashed with DD-WRT and secured with WPA2). In the Android WiFi settings, you will see the connection status looping between the same states over and over (the most noticeable is “obtaining an IP address” as that string remains on the screen longer).

To investigate a bit on the cause of the issue, I had a look at the ERROR logs, that revealed the failure of DHCP:

E/DhcpStateMachine( 218): DHCP failed on wlan0: DHCP result was failed
E/WifiStateMachine( 218): IP configuration failed
E/LanLinkProvider( 471): Sending udp identity package failed
E/LanLinkProvider( 471): Sending udp identity package failed
E/LanLinkProvider( 471): Sending udp identity package failed
E/LanLinkProvider( 471): Sending udp identity package failed
E/DhcpStateMachine( 218): DHCP failed on wlan0: DHCP result was failed
E/WifiStateMachine( 218): IP configuration failed
E/LanLinkProvider( 471): Sending udp identity package failed
E/LanLinkProvider( 471): Sending udp identity package failed
E/DhcpStateMachine( 218): DHCP failed on wlan0: DHCP result was failed
E/WifiStateMachine( 218): IP configuration failed
E/LanLinkProvider( 471): Sending udp identity package failed
E/LanLinkProvider( 471): Sending udp identity package failed
E/DhcpStateMachine( 218): DHCP failed on wlan0: DHCP result was failed
E/WifiStateMachine( 218): IP configuration failed
E/LanLinkProvider( 471): Sending udp identity package failed
E/LanLinkProvider( 471): Sending udp identity package failed

Solution

What worked for me (and hopefully for someone else too), was to delete every files in

/data/misc/dhcp

In my case, I had the following two files:

dhcpcd-wlan0.lease
dhcpcd-wlan0.pid

So, if you can access the adb shell, you can try the following (please, see which files you have there with “ls”, so you will correctly remove what you need):

$ adb shell
# cd /data/misc/dhcp
# rm dhcpcd-wlan0.lease dhcpcd-wlan0.pid

Or, if you cannot use the adb shell, try to remove those files with a file explorer directly from the device.

After this, I had to reboot before I could get my WiFi connection work properly with DHCP.

Credits go to this page: http://forum.xda-developers.com/showthread.php?t=2112161.

Advertisements