spehe
Posts: 8
Joined: Wed Jan 06, 2016 5:24 pm

Cannot get Wi-Fi to work

Wed Jan 06, 2016 7:47 pm

Hello,
I am a beginner since two days and do not really know much about this yet, but I am willing to learn. I have successfully managed to set up my RaspberryPi 2 with Raspian Noob, and I have also managed to configure headless access to it from my Win10 PC. It is for the moment using eth0 for network, but I would like it to use Wi-Fi instead.

Having tried a number of tutorials, I have still not managed to get it to work. My Wi-Fi dongle (D-Link DWA-121) is suppose to work right out of the box, according to the store where I bought everything.....

Now I have exhausted myself and could do with a little help. Any suggestions would be deeply appreciated.

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Cannot get Wi-Fi to work

Wed Jan 06, 2016 9:30 pm

spehe wrote:Hello,
I am a beginner since two days and do not really know much about this yet, but I am willing to learn. I have successfully managed to set up my RaspberryPi 2 with Raspian Noob, and I have also managed to configure headless access to it from my Win10 PC. It is for the moment using eth0 for network, but I would like it to use Wi-Fi instead.

Having tried a number of tutorials, I have still not managed to get it to work. My Wi-Fi dongle (D-Link DWA-121) is suppose to work right out of the box, according to the store where I bought everything.....

Now I have exhausted myself and could do with a little help. Any suggestions would be deeply appreciated.
First do not edit file /etc/network/interfaces. If you have put it back to it's original state. Probably something like this

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
You should then be able to get your wifi working by editing file /etc/wpa_supplicant/wpa_supplicant.conf

Open the file to edit using command

Code: Select all

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
and edit it so it looks like

Code: Select all

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

network={
        ssid="your-network-name"
        psk="your-network-password"
substituting your own network name and password. Terminate the editor using keys cntl-x, y, enter.

This should be sufficient to get you wifi connected. Reboot to bring up the wifi.



MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

spehe
Posts: 8
Joined: Wed Jan 06, 2016 5:24 pm

Re: Cannot get Wi-Fi to work

Thu Jan 07, 2016 6:28 pm

Thank you for your interest in tis. I have now followed your suggestions but I still do not get any wi-fi. Raspian recognizes my wi-fi dongle Image and I can see my SSID when i scan, but it still says 'not associated' for wlan0.

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Cannot get Wi-Fi to work

Thu Jan 07, 2016 9:28 pm

When doing a scan did you use command

Code: Select all

sudo iwlist wlan0 scan
or was it without sudo? There is a difference in the operation of the scan between the two. The command without sudo appears to use stored data where as the command using sudo does a completely new scan so I suppose could be classified as rather more accurate.

Wifi can sometimes be a bit of a pain getting a first connection. You could try and get a connection using commands

Code: Select all

sudo ifdown wlan0
sudo ifup wlan0
and maybe repeating them a couple of times if necessary if it doesn't get an address immediately. An alternative is to remove the wifi adapter while the Pi is powered on, wait a short time, and then plug the wifi back in. And a third option is to shut down the Pi and turn off the power, wait a few seconds and then turn the power back on, boot the Pi and see if you then get a connection.

Couple of other things that could be an issue. Some will say the wifi will not get a connection if the wired network is connected as well. Personally I've never seen this myself and often have Pi's with wired and wifi both connected at the same time. And one other item I've come across quite a few times raised by people not being able to get a wifi connection - making sure both the ssid and password are correct as they are both case sensitive.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

spehe
Posts: 8
Joined: Wed Jan 06, 2016 5:24 pm

Re: Cannot get Wi-Fi to work

Fri Jan 08, 2016 10:25 am

When I scanned the network I did it both with 'sudo' and without. When I used 'sudo', three networks came up, mine being the third. Without 'sudo', only my network showed up.

When I do a 'sudo ifdown wlan0', I get the message 'interface wlan0 not configured'

When I do a 'sudo ifup wlan0', I get the message 'wpa_supplicant: /sbin/wpa_supplicant daemon failed to start.
Run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Failed to bring up wlan0'

I have also tried your other suggestions without success, in fact at the moment I cannot connect to the Pi at all. I am now thinking about re-installing Raspian altogether, to make a fresh start.

spehe
Posts: 8
Joined: Wed Jan 06, 2016 5:24 pm

Re: Cannot get Wi-Fi to work

Fri Jan 08, 2016 10:53 am

Don't know what happened. I retyped everything in wpa_supplicant.conf, and after a reboot, the wi-fi kicked in! Thank you for your patience and all your help!

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Cannot get Wi-Fi to work

Fri Jan 08, 2016 12:03 pm

spehe wrote:Don't know what happened. I retyped everything in wpa_supplicant.conf, and after a reboot, the wi-fi kicked in! Thank you for your patience and all your help!
No problem. Good to hear you've made some progress.

The error in your previous post
spehe wrote:When I do a 'sudo ifup wlan0', I get the message 'wpa_supplicant: /sbin/wpa_supplicant daemon failed to start.
Run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Failed to bring up wlan0'
is often due to an error in the wpa_supplicant.conf file, such as extra spaces where there should not be, so retyping it you must have fixed the problem. As an example ssid ="network-name" has a space between ssid and "=" and will cause the error you had. It should be ssid="network-name" with no space between ssid and "=". Other unnecessary characters can also cause the same error.



MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

Return to “Beginners”