sandshock
Posts: 2
Joined: Mon Jul 22, 2013 4:41 am

Wifi won't reconnect

Thu Jul 25, 2013 1:28 am

I have the raspberry pi b model running the most recent rasbian, and with an edimax ew-7811Un wifi dongle. My problem is that I can get the pi to connect to my wifi just fine using either the command prompt or the wpa_gui. However, whenever my pi restarts or shuts down, upon the next startup it refuses to connect to the wifi. If I go into the wpa_gui, it reads as "status: Disconnected". If I click connect, then it connects and works just fine, however, is there any way to make it do this automatically? I want to run this headless, but then if I ever have to restart it, then, at the moment I have to go back and plug it in to a mouse and monitor to click this button and get the wifi connected again.

User avatar
Davespice
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 1624
Joined: Fri Oct 14, 2011 8:06 pm
Location: London, United Kingdom
Contact: Website Twitter

Re: Wifi won't reconnect

Thu Jul 25, 2013 10:08 am

Have you also got an ethernet cable plugged in? If so then you may have to remove a package called ifplugd which is designed to provide that laptop like behaviour where the Internet connection should defer to the wired connection if in use. You can remove it using the command;

Code: Select all

sudo apt-get remove ifplugd
You may also find putting auto wlan0 in /etc/network/interfaces might help.

Gustavo_Murta
Posts: 24
Joined: Thu Dec 20, 2012 10:04 am
Location: Brasil

Re: Wifi won't reconnect

Thu Jul 25, 2013 12:11 pm

Good references for solve problems with WIFI connection :

http://wiki.debian.org/WiFi/HowToUse

http://www.debian.org/doc/manuals/debia ... 05.en.html

Command Line

Scan for available networks and get network details:

Code: Select all

pi@raspberrypi ~ $ sudo iwlist scan
Now edit /etc/network/interfaces. The required configuration is much dependent on your particular setup. See the following example to get an idea of how it works:

Code: Select all

pi@raspberrypi ~ $ sudo nano /etc/network/interfaces
WPA-PSK and WPA2-PSK

Code: Select all

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid mynetworkname
    wpa-psk mysecretpassphrase 
WEP example

Code: Select all

auto wlan0
iface wlan0 inet dhcp
     wireless-essid Home
     wireless-key1 0123-4567-89ab-cdef
     wireless-key2 12345678
     wireless-key3 s:password
     wireless-defaultkey 2
     wireless-keymode open
For further information on available configuration options, see man interfaces, man wireless and /usr/share/doc/wireless-tools/README.Debian.

You can now bring your interface up and down with the usual ifup and ifdown commands. If you added auto wlan0 as in the example above, the interface should be brought up automatically during boot up.
Use -v (verbose) parameter to undestand what is happens.

Code: Select all

pi@raspberrypi ~ $ sudo ifdown wlan0 -v

pi@raspberrypi ~ $ sudo ifup wlan0 -v
For monitoring the interfaces :

Code: Select all

pi@raspberrypi ~ $ ifconfig -a

pi@raspberrypi ~ $ iwconfig

sandshock
Posts: 2
Joined: Mon Jul 22, 2013 4:41 am

Re: Wifi won't reconnect

Fri Jul 26, 2013 2:58 am

Thanks for your quick and helpful replies! I went into etc/network/interfaces and removed several lines that I had added following some instructions elsewhere that I had tried out. After returning everything to normal, I added the lines that you guys mentioned, and on the next restart, it automatically found my network and connected. Once again, thanks a lot for your help!

muzammilpeer987
Posts: 1
Joined: Sat Mar 22, 2014 11:24 am

Re: Wifi won't reconnect

Sat Mar 22, 2014 11:28 am

Hi i have tried all possible way to connect my wifi dongle at boot but none of them works for me.
I have TP link 8188eu usb dongle it connect when i used wired connection. But when i disconnect the LAN it got disconnected and go to sleep while i have off the powermanagment of wifi dongle.
and startup it got the DHCP lease from the router once and when the startup screen completed its tasks it just go to sleep and i m unable to connect via wifi ...then i have to reconnect my lan connection to use it. Please any body can.

TightByte
Posts: 1
Joined: Thu Apr 10, 2014 6:46 am

Re: Wifi won't reconnect

Thu Apr 10, 2014 7:22 am

I just wanted to chime in that I'm surprised to find I have this problem consistently as well; it does not seem like intended functionality? Using a fresh install of Raspbian and the Wi-Pi dongle I am seeing exactly the behaviour described by the original poster: Setting up the wireless configuration is successful once, but any subsequent boot up of Raspian sees wpa_supplicant trying exactly once to connect to the AP and, after failing, forever giving up. (I can only assume it's forever, it's certainly for days at a time) Opening up the wpa_gui shows "Status: Disconnected" as noted by the original poster. I can then manually click "connect" whereupon the Pi successfully connects and remains online.

Since my experiences matches those of the original psoter, it would seem that a default Raspbian installation out of the box cannot automatically reconnect to a previously configured AP, thus requiring a monitor/keyboard hookup to enable a manual connect command, thus, frankly, being quite and utterly useless in "embedded, remote admin" scenarios.

EDIT: I applied both the advice from Davespice (removing ifplugd -- it was indeed installed, and at some point I had an ethernet cable plugged in) and the advice given by Gustavo_Murta (explicitly writing the AP SSID and WPA2 key in /etc/network/interfaces) and the Pi had no problem reconnecting upon reboot. I had observed its ability to do so earlier when using "RasPlex", so I knew it should be possible. I conclude that the Raspbian vanilla settings are not conducive to a non-interactive WiFi setup, and suggest that more sensible defaults be adopted.

Return to “Beginners”

Who is online

Users browsing this forum: HawaiianPi and 34 guests