Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Intermittently, when I try to connect to a WiFi network, I get the following error message as a toast message:

Failed to connect to network

The message pops up immediately upon attempting to connect, so clearly it isn't trying and failing. I haven't found any mention of an error in the logs. The affected networks are ones that I've previously connected to with no change in settings.

How can I figure out what the problem is?

I've got a rooted Galaxy Nexus running Android 4.1.1 and the stock ROM. This question is related to another question that I posted earlier, but this one is more about how to find the source of a particular error message, so its focus is different.

Additional Details

Here are some more details based on the comments:

  • I've observed this on my home and work networks. One is identified as WPA2 PSK and the other is identified as WPA/WPA2 PSK.

  • I haven't powered off the phone as described in the troubleshooting guide mentioned in the comments. However, I have rebooted to no avail (using the reboot command that's available on rooted phones).

  • Forgetting the network and re-adding it has no effect. In fact, if I forget the network I can no longer successfully re-add it.

  • The wireless password hasn't changed.

  • There's no proxy configured when I'm on wireless. However, I run Onavo Extend when I'm on a data connection. Disabling it has no effect.

  • I've switched from DHCP to static IP addresses. Doing so reduced the frequency of problems and seems to have eliminated my earlier issue where wifi would be randomly dropped.

  • Wifi sleep is set to "Only when plugged in." I don't think it's relevant because my issue is establishing a connection in the first place (such as when I arrive at home or at work), not maintaining one.

Note that despite all these troubleshooting steps,my initial goal is to find an actual error message or log entry that gives useful information about the problem.

share|improve this question
    
What kind of wireless network? WPA? WPA2? WEP? Go through this guide just in case: techrepublic.com/blog/smartphones/… –  Enigma Sep 27 '12 at 15:23
    
@Enigma: Thanks for the suggestion. I've updated my question. –  Scott Severance Sep 27 '12 at 16:01
    
Try disabling sleep entirely and downloading a third-party wifi connection tool from the app store. There is likely one that provides a nice output log as well. What other application services do you have running besides the stock ones? –  Enigma Sep 27 '12 at 16:08
1  
As it was not mentioned here explicitly: Has one of you two tried to capture a logcat when the problem appeared? That might turn something up. Up to ICS (4.0) you can use one of the logcat apps from Google Play; however, as with JB they no longer can access anything but their own log entries, you might need to use adb logcat then (or root your device). –  Izzy Jun 15 '13 at 16:48
1  
I tried but got nothing relevant. By the way, for rooted phones it's possible to convert alogcat to a system app. Then it works as advertised under Jelly Bean. –  Scott Severance Jun 17 '13 at 8:43
show 5 more comments

6 Answers

Do you have custom recovery installed? I have had this problem twice on a Galaxy S2, and what fixed it for me every time was running a permissions fix from recovery mode.

If that doesn't work, try deleting your WiFi config file. Not sure what it is on the Nexus, but I'm guessing it'll be something along the lines of /data/misc/wifi/wpa_supplicant.conf or /data/misc/wifi/wpa.conf. Obviously you should make backups before deleting anything. Note that you'll lose all your WiFi settings if you do this.

share|improve this answer
    
The guy with the nexus isn't the one who posted the bounty, I bumped for attention. I've got an LG Optimus 4X HD. Not wildly different and I don't think its platform specific. Currently don't have recovery installed, although have been investigating that as part of a solution to this issue (move to CyanoGen 10.1). I can't see /data/misc/* at all, although I realise my fw update has dropped root access. Would that block access? I've go ta whole weekend set aside to get something going. I'll update when I know more. Thanks. –  Patrick Jun 14 '13 at 10:46
1  
@Patrick - I would be surprised if you can see anything in /data at all without root access. On every phone I've tested, an app can only see its own user data in /data/data/app.name and nothing else. If you do get root access, also check for a directory named /data/wifi. Some phones use that instead of /data/misc/wifi. –  aggregate1166877 Jun 14 '13 at 11:15
    
Sure. thanks for confirming, looks like I'm stuck in front of a computer all weekend then. Lets hope the sun goes away eh? –  Patrick Jun 14 '13 at 11:38
    
Haha yeah, enjoy the weekend. Let me know if your problem gets resolved. –  aggregate1166877 Jun 14 '13 at 12:25
    
Unable to get root. Seems I have issues getting to my phone via ADB. I'm still very much a noob at this stuff :( although I did find an app that helped... –  Patrick Jun 17 '13 at 15:40
show 3 more comments

I think this part of your question is key:

I've switched from DHCP to static IP addresses. Doing so reduced the frequency of problems and seems to have eliminated my earlier issue where wifi would be randomly dropped.

IP addressing issues could certainly cause you troubles like this. Static addressing is only treating the symptoms, though, not curing the disease. Assuming the APs you're connecting to haven't had their DHCP settings changed, focus on investigating how your phone is acting as a DHCP client. I found a bug report in which several users report the same trouble you're having (the author actually references one of your previous questions). One of the commenters found log entries related to DHCP; you mentioned in a comment that you didn't find any relevant log entries but did you see any that look like this commenter's?

Apr 1 05:26:12 unknown daemon.info dnsmasq-dhcp[522]: DHCPREQUEST(br0) 192.168.200.225 a0:0b:ba:83:65:32

Apr 1 05:26:12 unknown daemon.info dnsmasq-dhcp[522]: DHCPNAK(br0) 192.168.200.225 a0:0b:ba:83:65:32 wrong address

Additionally, a later commenter found that the DHCP client service dhcpcd was not running on his device. He explains:

I started researching a bit, using good old Linux console and "ps" command. I noticed that:

  • every time I could not connect, dhcpcd was not running.
  • at least several times, Kingsoft Office process was running when the problem appeared.

So, what I did was:

  • uninstalled Kingsoft Office,
  • switch to static IP on all networks I use often (home, work, friends, family). I also disabled WiFi power management (read somewhere that it could help).

After these, problem disappeared. It's been gone for 2 weeks now!

He found that the DHCP client service's absence was correlated with one of his apps. Reconfigure your device to use DHCP, try to connect to one of the problem APs, then use Terminal Emulator (or similar) to run the same investigation he did by typing the command ps | grep dhcp. The output should look something like the following:

dhcp 4858 1 924 552 ffffffff 00000000 S /system/bin/dhcpcd

This means that the dhcpcd process is running. If dhcpcd is not running, you'll simply be returned nothing. If that's the case, type ps again to get a list of all current processes. Do you notice any correlations between an app you've installed and the problems you're having? As a temporary work-around, trying starting the service again by typing sudo dhcpcd, then try again to connect.

share|improve this answer
add comment

I managed to work round, if not resolve, the issue at hand.

In short I installed Wifi Ruler - Free, which overrides the stock wifi connection manager.

This allows me to click and connect to any AP that I come across with no issue.

It does loads of other stuff, finally I can prevent my phone from connecting to my neighbours incredibly strong open wifi.

Hope this helps.

share|improve this answer
add comment

Check to see if you have set mobile data limit. I know it's weird on my samsung Google nexus maguro I removed the limit and wifi returned back to normal.

However I had the same issue on Nexus 7 grouper, I tried various apps and tricks on the net. But finally I had to reflash the Cyanogenmod to get wifi working on it.

share|improve this answer
add comment

I gave this answer to a disconnection query earlier but there is some resonance here.

I think I can guess what is happening. When I first started using free hotspots I was connecting with no problem and often they will have a logon screen to insert the locale password. Some places however like hotels seem to give free access for a limited time or for first use without logging in and then later they will expect you to register.

When I have returned to these places a second time I find that the phone finds the network and claims to be connected but every use returns a network error or appears to connect and get cut off. In fact I am getting rerouted to their logon page, only it seems to often only open in background in gingerbread so you don't know it is happening.

After fiddling around you can sometimes get the logon page to show and then register. Often I can only do this by attempting a google search. Google somehow seems to know to route via the logon pages whereas other apps play ignorant."

share|improve this answer
1  
Thanks for the answer. However, as I stated in my question, I'm experiencing these issues at home and work. Your issue with free Wi-Fi hotspots is, I presume, completely unrelated since you're experiencing issues getting outside despite having a connection to the hotspot. –  Scott Severance Mar 22 '13 at 6:37
add comment

Try to reboot your phone, you will find it again after rebooting.

share|improve this answer
2  
Yes, "try rebooting" is a tried and true troubleshooting technique for all kinds of computer issues, but isn't really a long-term strategy nor does it identify the actual issue. –  Al E. Jan 9 at 13:32
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. –  Francisco Alvarado Jan 9 at 22:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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