2

Yesterday I have set up wifi connection on my BananaPro with bananian, a linux distribution based on debian 7. The connection was set up with 'wpa-passphrase' and then I have typed those information into, ssid and psk, into the /etc/network/interfaces. Yesterday it worked perfectly, but today it stopped working. All other devices in home have no problems with connecting to this wifi, I tried repeating all those steps from yesterday, but it still doesn't work.

Edit: I have tried the method with creating the config file with wpa_passphrase and connecting manually with wpa_supplicant, suggested by rexroni and it worked perfectly. Here is me /etc/network/interfaces file: http://pastebin.com/08GDc5Pj When I boot up BananaPro with this file the output of ifconfig, iwconfig and dmesg: http://pastebin.com/CQxh74h5 (one link, cause I cannot paste more)

Edit: I have set up another sd card with another debian installation and I'm having this same issue. It's been working when I have set it up, but when I restarted the computer it just didn't connect anymore. When I come back home I can deliver dmesg after ifup wlan0 and ifdown wlan0, but I don't quite have any idea what might be wrong. Any other things I could do? Except for using ethernet to connect to internet.

fulaphex
  • 213
  • 4
  • 12
  • Without more informations (what's in the logs?) you have the same options like a windows user: reboot and hope that it cures the problem or reinstall Debian and hope it cures the problem. – ott-- Aug 15 '15 at 19:33
  • I wouldn't like to reinstall Debian, cause I have already spent some time to set everything up. What kind of logs should I append? – fulaphex Aug 15 '15 at 19:37

1 Answers1

2

First, you can double-check your /etc/network/interfaces file against mine:

auto lo 
iface lo inet loopback

auto wlan2
iface wlan2 inet dhcp
        wpa-ssid <my essid>
        wpa-psk <my passphrase>

auto eth0
iface eth0 inet static
        address <my static ip>
        network <my local network>
        netmask <my netmask>

(My ESSID and passphrase don't have spaces in them, so I don't know if you need quotes for such entries or not)

I think order of the interfaces matters. If you want to primarily use wifi, I think you need that first. Read more in man interfaces.

If that looks good, you can run some in-depth troubleshooting:

You need three basic things for wifi networking: a connection, an IP address, and appropriate routing.

You can troubleshoot by running some command line operations to see if you can connect at all (independent of the /etc/network/interfaces).

First reset everything

sudo killall wpa_supplicant
sudo ip link set <interface> down
sudo dhclient -r <interface>

Then start the process of making a connection:

# turn on the interface without auto-configuring:
sudo ip link set <interface> up

Make sure you can see the network in question:

# display wifi beacons being broadcast by nearby access points
sudo iwconfig <interface> scan

Configure and run wpa_supplicant:

# create a config file for wpa, use quotes if there's a space:
wpa_passphrase "<your ESSID>" "<your passphrase>" > ~/wpa.conf
# run wpa_supplicant on that config file, in the foreground
sudo wpa_supplicant -D wext -i <interface> -c ~/wpa.conf

The output of wpa_supplicant will help you troubleshoot the wifi connection. If it says it connects, you can either run the following commands in a new command prompt, or send wpa_supplicant to the background by pressing ctrl-z then running

# after pressing ctrl-z to pause the wpa_supplicant, run it in background
bg "%sudo"

Now run sudo iwconfig to verify your connection, the parts like "ESSID:" and "Access Point:" should have values.

Your next step is to get an IP address from your router's DHCP server:

sudo dhclient <interface>

If you are connected to the network, this really shouldn't fail. If it does... maybe reset your router? Test if it worked properly by running sudo ifconfig. Assuming you are using IPv4 addresses, you should see an IPv4 "inet addr:" that matches your router, likely a 10...* or a 192.168.1.* address.

dhclient should also set your routing appropriately, so (in the absence of other network connections to the internet) sudo ip route or sudo route should have a "default" option that points to your wifi router on the <interface>.

After that, you can test the connection to your local router:

ping <router's ip address>

Test if can connect to a remote ip address

ping 8.8.8.8 # google's dns server

Test if your DNS settings work:

ping google.com

If that works, you should be solid. If not, then you can change your /etc/resov.conf file to read

nameserver 8.8.8.8
nameserver 8.8.4.4

Now, if you've verified that you can connect to the network with these steps, you may be able to use some of the same tools to troubleshoot the /etc/network/interfaces approach.

I can help more if you share the output of sudo ifconfig, sudo iwconfig, sudo route or sudo ip route (sometimes when your connection is messed up, one or the other will hang), the relevant section of sudo iwlist <interface> scan, the /etc/network/interfaces file, and any relevant details from sudo dmesg.

rexroni
  • 1,398
  • 2
  • 13
  • 21
  • Nice Post. The OP sounds like he wants to run the device stationary, probably always powered on, and connected to the same network. So configuring it via /etc/network/interfaces -like the author requested- is still pretty useful. Author won't have to do all the commands again. If I can, I will upvote you again, if you add instructions for that too. And then it will also be the answer @Fulaphex probably wants. – Alex Stragies Aug 15 '15 at 22:30
  • Very true. It sounded like the OP already had that working before, which would rule-out problems like a totally broken config file or misspelled ESSID or something. But I added that file to the list of outputs the OP can post to help the troubleshooting. – rexroni Aug 15 '15 at 22:39
  • Yeah, actually I'm trying to set up my home nas + backup server. The device will be connected always to the same wifi, that is why I went for the way with modifying /etc/netwotk/interfaces file. It indeed has been working yesterday. I will check Your method in a minute and will let You know about the results :) thank You very much :) – fulaphex Aug 15 '15 at 23:14
  • This is my /etc/network/interfaces file: http://pastebin.com/08GDc5Pj. I tried both static and dhcp versions, static worked yesterday correctly. I have tried doing it Your way, with wpa_supplicant and dhclient and it worked perfectly fine. But still I cannot get this working with my interfaces file, hope that You spot what is wrong with it. – fulaphex Aug 16 '15 at 03:31
  • Ok, it looks pretty solid to me the way it is right now. I've found that when you can use DHCP it's a lot easier. Now when you do a reboot with that config file, what do you get from the ifconfig, iwconfig, ip route, and dmesg? Also, do you have any spaces or special characters in your passphrase or essid? If so, you might read this post: (http://unix.stackexchange.com/questions/102530/escape-characters-in-etc-network-interfaces) – rexroni Aug 16 '15 at 04:04
  • Here are the outputs of ifconfig: http://pastebin.com/CQxh74h5, iwconfig: http://pastebin.com/pc235WEU and dmesg: http://pastebin.com/wJGciddT. ip route doesn't show anything. My essid and passphrase are just numbers and latin alphabet letters, no spaces. – fulaphex Aug 16 '15 at 14:33
  • Now I am having this information showing up on the screen https://drive.google.com/file/d/0B3Tga83KcMEDMGd3N1BNNVlCbWc/view?usp=sharing – fulaphex Aug 16 '15 at 14:58
  • Ok. Would you mind editing your original post to include the outputs of `ifconfig`, `iwconfig`, mention that `ip route` is blank, include your `/etc/network/interfaces` file (without all the commented lines), and one more test: can you run `sudo dmesg -xc`, then run `sudo ifconfig wlan0 up`, then post the output of `sudo dmesg -xc`? The reason I say to edit the first post is so that when other people are searching for help it will be easier for them. I would be glad to up-vote your question at that point. – rexroni Aug 16 '15 at 15:21
  • With regards to the mmcblk0 issue, that is a strange hard-drive (well, probably sdcard) error I have not seen before. Did you set the "lock" slider on the sdcard or something? If not, you'll have to post that error as a separate question, I'm sure it's not wifi related. – rexroni Aug 16 '15 at 15:24
  • Yeah, that second error doesn't seem to be wifi related. I didn't do anything with the card and it is microsd, so no switch there. In addition, it doesn't show up right after bootup of the banana, it show randomly after some time. Maybe some regions of the card are corrupted? I will edit the main post in a second. – fulaphex Aug 16 '15 at 15:43
  • Thanks for adding it to the OP. Would you mind posting an additional dmesg output? First run `sudo dmesg -xc`, where the -c option clears the buffer after printing it to the output. Then run `sudo ifconfig wlan0 up`, which should bring up the interface, but unlike `sudo ip link set wlan0 up`, the `ifconfig wlan up` command will attempt to format wlan0 according to the `/etc/network/interfaces` file. Then, run `sudo dmesg -xc`, to capture only the kernel messages from the `ifconfig wlan0 up` command. Sorry, I should have made that clearer. – rexroni Aug 17 '15 at 06:43
  • Also, does your real `wpa-ssid` line in your actual file have literal quotes in it? Like if your essid was `linksys`, does your file read `wpa-ssid "linksys"` or just `wpa-ssid linksys`? I think that might be a problem, if that's the case – rexroni Aug 17 '15 at 06:45
  • My line says `wpa-ssid "UPC1348838"` – fulaphex Aug 19 '15 at 16:20
  • Does it work if you have `wpa-ssid UPC1348838` ? According to the post I referenced earlier (http://unix.stackexchange.com/questions/102530/escape-characters-in-etc-network-interfaces) I think that the quotes would be interpreted literally, but your SSID probably doesn't have literal quotes in it. – rexroni Aug 19 '15 at 16:43
  • I have just tried both versions, unfortunately neither `wpa-ssid "UPC1348838"` nor `wpa-ssid UPC1348838` work. – fulaphex Aug 19 '15 at 20:36
  • Hm. Could you run `sudo ifconfig wlan0 down`, then post the dmesg output for just trying to run `ifconfig wlan0 up` as I described a couple of posts ago? Please allow for a few seconds after the `ifconfig wlan0 up` before the second `dmesg -xc` command, so that you can catch the relevant kernel messages. Other than that, I'm kind of out of ideas. I suppose you could put the commands I listed earlier in a script that runs at boot time, but that's kind of an ugly solution. – rexroni Aug 19 '15 at 23:32
  • 1
    Output from `ifconfig wlan0 down && ifconfig wlan0 up` http://pastebin.com/Tfg0Vh4z – fulaphex Aug 20 '15 at 18:01
  • I don't see any dissociation errors or anything. Do you have any small usb wifi adapters? You might buy one just to check if you have some sort of weird hardware issue. They're not bad to have around anyways. Also, if you haven't yet, you should reboot your router and/or log on to your router to see what your router says about your banana pro's mac address... in case it somehow got blocked or something. One time, I actually had two wifi adapters with the same mac address, which was causing havoc. – rexroni Aug 20 '15 at 21:36
  • Also, do you have another linux computer? If so, you could `sudo apt-get install aircrack-ng`, then run `sudo ip link set wlan0`, `sudo iwconfig wlan0 mode monitor`, `sudo ip link set wlan0 up`, `sudo airodump-ng wlan0`. If you run that, you will set your wireless (I've assumed wlan0) to montior, then ran to program to montior wifi packets. You should see your banana pro's mac address. – rexroni Aug 20 '15 at 21:38
  • You can also run `sudo apt-get install wireshark` so you have a gui for viewing the captured wifi information, then run `sudo airodump-ng wlan0 -w scandata --output-format pcap`, which will save a capture, then after you end the capture, run `wireshark scandata-01.cap`. You can look through probe packets originating from your banana pro (they should be to essid `UPC1348838` or to "broadcast"), and look through beacons from your router's mac address, and check for probe responses from your router to your banana pro. You might see something awry there. It might take some patience. – rexroni Aug 20 '15 at 21:48