RandomQuestion
Posts: 21
Joined: Sat Sep 28, 2013 6:08 pm

Wifi won't start at boot / restart

Sun Nov 10, 2013 8:02 pm

Hi there,

Can anyone please advise me on how to get my wifi to start up at boot? I am running the latest version of Raspbian and set up my wifi using this guide:

http://kerneldriver.wordpress.com/2012/ ... pberry-pi/

My network interfaces file:

Code: Select all

auto lo

iface lo inet loopback
iface eth0 inet static

address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

#auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
    address 192.168.1.254
    netmask 255.255.255.0
    network 192.168.1.0
    gateway 192.168.1.1

My wpa_supplicant.conf file:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="XXX"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk="XXX"
}

Adapter: Ralink Technology, Corp. RT5370 Wireless Adapter

Every time I start up I have to ifdown and then ifup to get the wireless working. Any help would be appreciated.

User avatar
DougieLawson
Posts: 35597
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Wifi won't start at boot / restart

Sun Nov 10, 2013 8:13 pm

RandomQuestion wrote:

Code: Select all

auto lo

iface lo inet loopback
iface eth0 inet static

address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

#auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
    address 192.168.1.254
    netmask 255.255.255.0
    network 192.168.1.0
    gateway 192.168.1.1

Are you connecting both eth0 and wlan0 simultaneously?
If you are you'll need to assign different static addresses to each interface 192.168.1.254 to eth0, 192.168.1.253 to wlan0.

Also uncomment that #auto wlan0 line.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

RandomQuestion
Posts: 21
Joined: Sat Sep 28, 2013 6:08 pm

Re: Wifi won't start at boot / restart

Sun Nov 10, 2013 8:22 pm

Are you connecting both eth0 and wlan0 simultaneously?
Thank you for the help. I don't have a monitor so the pi is plugged into the router. Trying to set up Wifi over SSH so I can move it. As soon as that is set up I won't need eth0 any more.

Changed as you advised:

Code: Select all

auto lo

iface lo inet loopback
iface eth0 inet static

address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
    address 192.168.1.253
    netmask 255.255.255.0
    network 192.168.1.0
    gateway 192.168.1.1
Still no joy. On boot up iwconfig shows this:

Code: Select all

wlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          
lo        no wireless extensions.

eth0      no wireless extensions.

I still have to manually ifdown wlan0 and ifup wlan0 to get the Wifi to work. Any ideas?

RandomQuestion
Posts: 21
Joined: Sat Sep 28, 2013 6:08 pm

Re: Wifi won't start at boot / restart

Sun Nov 10, 2013 9:23 pm

Also I don't know if it has any relevance but I used ifup wlan0 and iwconfig and got this:

Code: Select all

wlan0     IEEE 802.11bgn  ESSID:"Home"  
          Mode:Managed  Frequency:2.412 GHz  Access Point: 40:CB:A8:5D:3F:A0   
          Bit Rate=6.5 Mb/s   Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=70/70  Signal level=-37 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:1   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless extensions.
I then turned off eth0 and lost my SSH connection. I would have thought that the Wifi would have provided a back up link. (Complete novice so hopefully this isn't completely wrong)

Edit: Obviously not as it is now on a different IP. Still stuck as to how to get wlan0 to start at boot!

RandomQuestion
Posts: 21
Joined: Sat Sep 28, 2013 6:08 pm

Re: Wifi won't start at boot / restart

Sun Nov 10, 2013 10:07 pm

I have found a temporary fix for anyone who is having similar problems:
http://unix.stackexchange.com/questions ... ter-reboot

I added the following to /etc/rc.local

Code: Select all

ifdown wlan0 
ifup wlan0 
Its a pretty messy fix so if anyone can suggest anything better please let me know!

pjc123
Posts: 913
Joined: Thu Mar 29, 2012 3:37 pm
Contact: Website

Re: Wifi won't start at boot / restart

Sun Nov 10, 2013 10:21 pm

It may not help your problem, but the first thing I would do is turn off power management as it can cause disconnect problems.

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1

wireless-power off

With regards to not working at boot, I had to resort to adding a script for my wifi dongle in order for it to work after bootup of the pi without having to do a manual ifdown followed by an ifup. I suspect that the bootup process does not give the wifi dongle enough time to start up properly. What is nice about the script is that it will work for all kinds of disconnects that don't automatically get reconnected, as it is always running (router turned off, router out of range, etc.):

See my script with installation instructions here:

http://www.raspberrypi.org/phpBB3/viewt ... 4&start=25
My Raspberry Pi Project Page:
https://www.flaminghellmet.com/launch/

User avatar
DougieLawson
Posts: 35597
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Wifi won't start at boot / restart

Sun Nov 10, 2013 10:31 pm

RandomQuestion wrote: I added the following to /etc/rc.local

Code: Select all

ifdown wlan0 
ifup wlan0 
Its a pretty messy fix so if anyone can suggest anything better please let me know!
It's not messy if it works!

I wonder if the scripts run during boot (/etc/init.d/networking /etc/init.d/network-manager /etc/init.d/networking-route) are starting too early, before your device has the driver loaded and is available for use. That would explain why /etc/rc.local works (as it's the last thing in the boot sequence).

We might get some clues from /var/log/syslog (a crowded place full of noise from various things).

One ugly way to get a clean log is:
sudo rm /var/log/syslog
sudo reboot (or sudo shutdown -r now)

Then as soon as you've got a good connection use sudo cp /var/log/syslog /tmp/syslog.10112013
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

danger89
Posts: 6
Joined: Sat Jun 21, 2014 10:27 pm

Re: Wifi won't start at boot / restart

Sun Jun 29, 2014 8:26 am

In my case I added: 'auto wlan0'. Which solved my problem, thanks!

Return to “Troubleshooting”