Raspberry Pi 2, Raspbian Jessie and WiFi vs. Ethernet at boot-time

I just installed Raspbian Jessie on my new Raspberry Pi 2. I’m using an Edimax EW-7811Un USB WiFi-adapter as a primary network device which I want to configure cleanly within my dis
tribution. Cleanly, in the sense of changing as little as possible the system’s configuration-files and scripts.

Raspberry Pi 2Of course I found several nice tutorials (1 2 3) which indeed helped me to figure how to do it properly
and gave me a good start (especially for wpa_supplicant.conf, which I won’t detail here) . However, the original content of the config-files mentioned there, wasn’t matching with what I found on my installation. Maybe it is because Jessie is still quite new as of writing this.

Starting with the /etc/network/interfaces-file. It mentions eth0 (the wired ethernet port) and two wlan-devices and it says they are all configured manual.

auto lo
iface lo inet loopback

iface eth0 inet manual

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

iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Manual in this context means that the ifplugd takes over the network configuration. Ifplugd detects a physical connection and launches a dhcp-client to complete the interface-configuration. As of writing this, it does not properly take care of wlan-devices, however this it is how ifplugd is configured (from /etc/default/ifplugd).

INTERFACES="auto"
HOTPLUG_INTERFACES="all"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

My RPI2 will be used mainly via WiFi, but for debugging reasons I might plug the wire. Hence I’d like the system to always (try to) configure the WiFi-device and optionally the wired if a cable is plugged. To achieve this, here is what I did.

First I changed the way wlan0 is configured in interfaces, telling it to automatically be configured when the networking-service is started (at boot-time):

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

Then I told ifplugd to no more using all devices but only eth0. I ran:

sudo dpkg-reconfigure ifplugd

And during the follow dialog asking me for “static interfaces to be watched by ifplugd’ I replaced auto by eth0. This makes /etc/default/ifplugd look as follows:

INTERFACES="eth0"
HOTPLUG_INTERFACES="all"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

This does exactly what I want with very few changes to the system’s files, thus clean.

UPDATE 30/10/2015:

I just did an apt-get update of my jessie installation and noticed that upstream has changed the interface-file. It now contains the allow-hotplug-lines I added to my interfaces. However, this does not change anything regarded the problematic I had on my system.

2 thoughts on “Raspberry Pi 2, Raspbian Jessie and WiFi vs. Ethernet at boot-time

  1. Never succeed with RPi2B + edimax dongle + fresh Jessie install + apt upgrade, to make wifi working 🙁
    SSIDs are well displayed and I’m abble to select one of them and key my password in, but RPi never connect, even with the conf you mentionned.

    So I tryed Wheezy and that’s just a little better as the wifi logo is now displayed, and I am probably connected, but not with an automatic local IP my routers DHCP should give me. Usually i’ve got something like 192.168… and here RPi has 169…. ?

    Maybe you can help me… thanks a lot (i’m a real noobs in linux and rpi world)

    • If the RPi gets an 169.x.x.x address it means it has not discovered a DHCP-server (the one who assigns IP-addresses in an IP-network). I assume that when you connect the RPi via an Ethernet cable in the same network and other WiFi-devices are working well. So most likely, even though the RPi could connect to the WiFi using Wheezy it wasn’t able to communicate with other devices.

      Have you checked the log-files? In /var/log/syslog or by running dmesg? Maybe there are some messages giving you some clues.

      Have you tried your Edimax adapter on a Laptop or a PC? Try to make sure that it works.

      What do you use as power supply? Maybe the RPi is not able to power correctly your USB-devices and thus gives this strange behaviour?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.