Possible duplicates:

I have a Sony Ericcson Mini Pro (Codename “Mango” at CyanogenMod) with CyanogenMod 9.1.0-mango. This is Android 4.0.4.

The problem

When trying to connect to a wireless network, it will be stuck in an “Optaining IP Address” loop for a while, until it shows “Bad Connection”. This is what it looks like in the wireless network system settings:

My tablet with CyanogenMod 10.2, Android 4.3, can connect to that wireless network without any problems, so can my Kubuntu 13.10 laptop with an Intel wireless card.

Tried so far

While looking for the cause and a fix for the problem, I found numerous posts that suggest to use a static IP address. This is a legitamate workaround, and I might resort to that, but I would like to fix this in general.

  1. The first thing I tried was to change permissions of /system/etc/dhcpcd/dhcpcd-run-hooks to 555. This did not have any effect, though.

  2. Then I downloaded the WiFix app and ran it in automatic mode. Did not do anything either.

  3. Last thing I tried was deleting /data/misc/dhcp/*. No effect at all.

  4. Update 2014-02-21: As you can see in the screenshot, the signal strength is really weak, although the phone is one meter apart from the router with a desk in between. Now it connected while being on the table. The signal strength is full now. I read in a different question that the issue might be caused by a weak signal. Could that the be underlying issue?

    My router does not have an external antenna, therefore, it might be a little unpredictable where the signal is strongest. I set the phone onto the router, and it still had the problem. So signal strength should not be the issue.

  5. Update 2014-03-04: I installed the latest nightly build of Cyanogen Mod on the device using their instructions. This installed Android 4.1.3, which had a severe problem with the wireless. It was turned off when I started the device, and it got stuck at activating wifi. So I reverted to the latest stable version which still has this endless loop.

  6. Update 2014-03-04: For my home network, I set up a static IP address, although I really do not like it. However, the internet connection works now.

  7. Update 2014-03-06: Checked for /system/bin/sh -> mksh, and it is present. This does not seem to cause the issue.

How could I fix this apparent DHCP issue?

  • I remember having a similar problem a while ago (exactly the same thing), but I cannot remember anymore how I solved it. Hints which didn't work for me included e.g. switching to airplane mode, wait a few secs, switching back. Didn't help. In most cases it solved itself "within an hour". // Another ROM might solve it, if a newer radio-image is available, that might help as well. No guarantees, however.
    – Izzy
    Feb 21, 2014 at 14:33
  • Newer ROM (nightly Cyanogen Mod) did not help, it only made things worse. I updated the question accordingly. Mar 4, 2014 at 21:26

5 Answers 5


This exact symptom can be fixed by changing permissions on


to execute on all accounts: user group and others

As mentioned here

You need rooted device and root browser.

Hope this helps


As you described that on static IP, the connection works, this leads to the problem with the setting to your router of yours.

For that, you need to login to as admin when you are connected to the router. (Please use a laptop to get all functions of the router since many routers have desktop UI settings only.)

Go to settings and search for advance setting which has DHCP setting. Now, check for the range of DHCP WiFi IP addresses. You may need to increase the range.

  • This also does not work on networks I do not administrate. I would suppose that the admins at my university have enough IP addresses for everybody. Dec 30, 2015 at 15:24
  • Every router has its own capacity to provide number of connection. If you are in range of a router, of which capacity to provide connection is already full. Then, how can it provide IP to you. For more research on no of connection you can use some network tools. Eg.. FING is good to find every connection on that router with every device name.
    – Vivek Ji
    Dec 30, 2015 at 17:54

I had the same symptoms while cooking a ROM when the symlink of /system/bin/sh to mksh was missing.

  • I checked, both /system/bin/mksh and /system/bin/sh are present, the latter being a symlink to the former. So this does not seem to be the issue. Mar 6, 2014 at 21:01

On the router, set static IP addresses. If that doesn't fix it, go to Setting > Wifi > Select your network and go to Advanced settings. There, select (input) an IP address that is not taken, such as That should fix the problem.

  • That does not work on networks like Eduroam where I must use DHCP. Dec 30, 2015 at 15:23

Try changing the WiFi channel in your router settings. This fixed the issue for me.

  • I do not see how this should help for other wireless networks. Mar 25, 2015 at 11:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .