12

I believe my question is different from the suggested duplicate in that the other questioner never had access to the internet over Wifi, whereas I had access to Wifi without any problems for one week but no longer do. Along with a fix, I am asking to debug it to see what happened. KDMs answer also permitted me to reactivate the WiFi without restarting; whereas the other answer required a firmware update and a restart.

I hooked up my new Raspberry Pi 3 and the Wifi was very easy to set up. However, about 1 week after this I could not SSH into the pi. My router's UI didn't show the RPI3 registered any more over Wifi.

I plugged in an Ethernet cable and my Pi immediately registered with my router. I SSH'd into it and attached to my session of screen and saw that my application was still running. This means the Pi never turned off or restarted -- only the Wifi stopped working. It has been about one more week and the Wifi has never come back online by itself. My RPi2, cellphone, laptop, etc. still have access to WiFi.

Aside from doing a restart, how do I fix this? How do I debug this?


Solution

Update: @KDM's solution, which use used on RP1/RP2 for wifi dongle problems, also worked for me (I believe this proves that this question is not a duplicate):

sudo ifdown wlan0
sudo ifup wlan0

However, I am concerned that the WiFi stopped working in the first place. I don't want to have to plug in an ethernet cable and issue these two commands every week. I have two RPI 1s with two different WiFi dongles. One of them never had any issues at all, while the other one needed to be restarted every so often. I'm worried that there could be something wrong with the RPI3's in built WiFi.


I have the latest version of Raspbian Lite, version March 2016.

Issuing sudo apt-get dist-upgrade shows that the following packages will be upgraded:

apt apt-utils gnupg gpgv initramfs-tools libapt-inst1.5 libapt-pkg4.12
libc-bin libc-dev-bin libc6 libc6-dbg libc6-dev libhogweed2 libnettle4
libpcre3 libsystemd0 libtalloc2 libudev1 libwbclient0 locales
multiarch-support openssh-client openssh-server openssh-sftp-server
raspberrypi-sys-mods raspi-config samba-common ssh systemd systemd-sysv
tzdata udev

I can sudo iwlist wlan0 scan > scan.log and find my SSID in the list. I can post this if it would be helpful.

Running ifconfig shows the wlan0.


I am using the default /etc/network/interfaces file that comes loaded on Raspbian Jesse for RPI3:

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
Matthew Moisen
  • 745
  • 5
  • 11
  • 25
  • @dylan In that question, the user never had access to Wifi. For this question, I had access to Wifi and it stopped working all of a sudden. – Matthew Moisen Apr 29 '16 at 17:17
  • @dylan Would you please see my updated question? I believe it proves that this is not a duplicate. – Matthew Moisen Apr 29 '16 at 19:39
  • As you have provided no detail of how you setup WiFi all answers are speculation. At he least include your /etc/network/interfaces – Milliways Apr 30 '16 at 00:36
  • 1
    @Milliways I was under the impression that RPI3's wifi was ready out of the box and that you didn't need to configure /etc/network/interfaces. I am using the default settings, which I've posted. – Matthew Moisen Apr 30 '16 at 03:34
  • It is ready "out of the box", although you still need to configure /etc/wpa_supplicant/wpa_supplicant.conf to tell it your security key, for example. (I'm assuming you're using a commandline interface; this is much more intuitive in the X interface.) – KDM Apr 30 '16 at 09:26
  • @KDM Yes, I configured wpa_supplicant.conf and got WiFi working, but I didn't touch interfaces. – Matthew Moisen Apr 30 '16 at 10:11

5 Answers5

3

(Edit: good point, Matthew Moisen)

I had a problem with my RPi2 (with an external USB WiFi dongle). Ultimately I found a replacement adapter, but my solution (unfortunately, as you've discovered, you'll need a hardwired connection) to resetting it without rebooting the RPi was to restart the WLAN interface:

sudo ifdown wlan0
sudo ifup wlan0 

I've subsequently swapped out my dongle for one which didn't originate in Hong Kong and I've not had any bother with it since ... even though it lives in my airing cupboard, which is not the favoured environment for computing equipment!

Edited again:

The other thing, I've just remembered. Try rebooting your router. I've never fallen foul of this with the Pi, but my android phone loses WiFi every other week and will not re-connect (even after a battery yank). There is an upper limit on the number DHCP addresses which my router can "remember" issuing. My suspicion is that if 10 devices all have a 7 day lease to run, the 11th doesn't get issued an IP. Rebooting seems to clear the leases. Suck it and see.

KDM
  • 708
  • 8
  • 23
  • 1
    The Raspberry Pi 3 has a built in wifi. Is this what you are referring to when you call it a WiFi dongle? I thought those were only used on RPi 1 and 2. – Matthew Moisen Apr 29 '16 at 18:00
  • Hey KDM, I tried your two commands and they indeed worked on my RPI3; thank you. I don't want to mark this as the correct answer however as I am struggling to figure out why the WiFi went off in the first place. I really don't want to have to plug in an ethernet cable and manually issue these commands every week or write a script to do so. – Matthew Moisen Apr 29 '16 at 19:40
  • You'll struggle to issue any commands without plugging in a keyboard or cable, though! Agreed - it's best to figure out why it went wrong. Not sure that's something we can help with, given the information, though. – KDM Apr 30 '16 at 08:13
  • Regarding your edit: My old RPi 1, laptop, and cell phone didn't lose WiFi, only the RPI3.; regarding your comment, I just ssh into it over putty as I use the raspberry pi for headless applications. – Matthew Moisen Apr 30 '16 at 23:35
0

If the wlan0 works for a period of time after booting and then goes away is it possible it is related to localization settings as mentioned in this post. I set my location for WiFi and have not had it dropped.

1JJ1
  • 1
  • 1
0

Running Wicd might get it working without any reboot, but I've never had luck making the settings permanent. Using an /etc/network/interfaces file is a good simple permanent solution that will apply settings every time you boot, OTOH it only works when you're booting. So wicd for now and study the man page for interfaces. If your first version of interfaces doesn't work you can always use wicd each boot until you get it right.

It's just a text file, mine looks like this (for wired and wifi):

    # new interfaces file 4/23/2016

    source /etc/network/interfaces.d/*

    auto lo
    iface lo inet loopback

    auto wlan0
    iface wlan0 inet dhcp
      wireless-essid Moto_lte
      allow-hotplug wlan0

    auto eth0
    iface eth0 inet static
      address 192.168.0.16
      netmask 255.255.255.0
      network 192.168.0.0
      broadcast 192.168.0.255

You should also look at man wpa_supplicant. Oh, and you can run wicd (or most things) by typing sudo wicd into a terminal window if you can't find it in the menus. If you get an error that it's not found then do

     sudo apt-get install wicd

assuming you can connect somehow. It is possible to get it on another machine, put it on a USB stick and load it but I won't go into that.

Alan Corey
  • 201
  • 1
  • 6
  • Hi Alan, I am using the default /etc/network/interfaces provided by Rasbian Jesse. I've included it in the OP. I was under the impression that for RPI3 we didn't have to mess around with interfaces any more. The WiFi worked fine at first but it randomly shut off. – Matthew Moisen Apr 30 '16 at 03:37
  • I thought that was an example, not meant to actually be used without editing it first. You don't have to "mess around" with it but to me it's drastically simpler. Wicd I kept having to reset because it would stop working at random times. I just got a new Pi 3B in the mail today, loaded an image, stashed a copy of my interfaces file in the /boot dir temporarily. Booted up, copied it into place, then next time I rebooted both interfaces were up and running. I prefer static to DHCP too, less to go wrong. – Alan Corey Apr 30 '16 at 23:16
  • I fought with wicd for several months in Debian on an i386 machine, several times per evening I'd have to reset it. Overnight downloads always failed. I didn't do anything with wpa_supplicant this time, but then use an open network tethering from my cell phone. No other houses within 1/4 mile. – Alan Corey Apr 30 '16 at 23:28
0

It sounds you didn't change interfaces file but anyway, make sure your /etc/network/interfaces file has no manual configurations or you should do manual configuration for all interfaces (eth0, wlan0 and lo). For automatic configuration leave it with original code:

source-directory /etc/network/interfaces.d
0

Hey You will need to replace the bcrm folder of any of your WiFi working Operating Systems to the Operating System in which WiFi doesn't work. bcrm folder is located in "/lib/firmware/". I am sure that this helps to resolve all networking issues.

Video Tutorial : https://www.youtube.com/watch?v=xVTgcXE8rrY