As the title states my RaspberryPi's WiFi adapter (Edimax EW-7811UN (8192CU)) is in most cases (approx 70% of the time) not ready when it tries to get an IP using DHCP on boot. It happens often that the link becomes ready after the DHCP client tried to get an IP Address. In most cases it becomes ready when I'm at the login prompt. I've already deactivated the powersaver by creating the following file with the following contents:


options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

I've already checked on Realtek's site and it looks like my version of the driver installed (came with latest raspbian image) is the latest: v4.0.2_9000

I need this to work on boot as I have something that gets mounted via fstab and then is used by a daemon.

Is there anything else I can do to make sure the device is ready when the DHCP client tries to get an IP?

2 Answers 2


I think this answer on the superuser site will do what you need, either use the hack of setting a delay time which is crude or use the more robust and elegant

" The right way to do it is to make your startup script run after the stuff it depends on. How you do this differs between distros.


edit: this will only complete when wlan0 is assigned

while [ -z "$(/sbin/ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2 )" ]; do

  sleep 5


  echo "dhcp ip assigned do something";
  • Unfortunately where not talking about a startup script that I've written. Its the standard boot sequence that comes with raspbian. Even if I could find where to alter those (most likely very complicated) scripts, what would I have to add there? Whats the variable or function to check if the link is ready?
    – MemphiZ
    Oct 17, 2014 at 0:56
  • Unfortunately thats also not what I need. Your function checks if the device has got an IP address. But before it can get an IP address the link has to "become ready". Which is what I have to check for...
    – MemphiZ
    Oct 18, 2014 at 18:59
  • I think it would help if you told us what this "link" is, so far something called the link is set before the ip so fails, then you cannot use a mounted device remotely, do you mean a vpn connection when you say "link", I think you need to take the link out of startup and put it into a cron that is only run after boot up if finished, the bash script would have to check the link/service is alive every 1 min/ 10 mins and if dead then restart the process. I have experienced latency when uploading small files using wifi, what about a wired network connection instead
    – Conor
    Oct 18, 2014 at 20:01
  • On boot, right after "Configuring network interfaces" there is a message saying "IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready". Then sometimes after that there comes another message: "IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready". Only if that second messages is displayed before trying to get an IP the DHCP client is able to get an IP for wlan0. In most cases though that message is displayed after the DHCP client broadcasted the IP address request.
    – MemphiZ
    Oct 19, 2014 at 0:56
  • what driver version are you using, this page [ openelec.tv/forum/124-raspberry-pi/59781-2-99-1-and-edimax-wifi ] describes exact problem your having, page doesn't state which edimax wifi usb model, solution is use driver version " Problem / issue fixed with RC 2.99.2 =) "
    – Conor
    Oct 19, 2014 at 10:35

As Raspbian Jessie uses systemd, it's better to use its capability to restart services, instead of throwing a sleep 5 spanner into the engine. I've successfully using this for both hostapd.service and isc-dhcp-server: edit their service unit files and add:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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