I run a Raspberry Pi at our university (Raspbian Stretch). I use it for a project where it has to rely on WiFi. I configured the connection using wpa_supplicant and it worked perfectly well. Now there's a problem with it, so I no longer get onto it using WiFi/ssh. I unplugged the SD card and modified /etc/network/interfaces file to configure a static network that allows me to acces the Raspi over Ethernet. Here's the file:

source-directory /etc/network/interfaces.d

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

auto eth0
allow-hotplug eth0
iface eth0 inet static

The Ethernet connection works perfectly, so I can acces my Raspi via ssh again. When I do /etc/init.d/neworking restart, it takes a while, but I don't get a WiFi connection. When i run sudo systemctl restart dhcpcd.service, it fails. systemctl status dhcpcd.service says:

Feb 23 09:33:01 pren7 systemd[1]: Starting dhcpcd on all interfaces...
Feb 23 09:33:01 pren7 dhcpcd[3065]: Not running dhcpcd because /etc/network/interfaces
Feb 23 09:33:01 pren7 dhcpcd[3065]: defines some interfaces that will use a
Feb 23 09:33:01 pren7 dhcpcd[3065]: DHCP client or static address
Feb 23 09:33:01 pren7 systemd[1]: dhcpcd.service: Control process exited, code=exited status=6
Feb 23 09:33:01 pren7 systemd[1]: Failed to start dhcpcd on all interfaces.
Feb 23 09:33:01 pren7 systemd[1]: dhcpcd.service: Unit entered failed state.
Feb 23 09:33:01 pren7 systemd[1]: dhcpcd.service: Failed with result 'exit-code'.

So can't I use DHCP for wlan0 when I configure eth0 using a static IP? Is there a workaround? I cannot just deactivate eth0, because if the wlan0 connection fails, I need to modify the config directly on the SD card again.

EDIT: Following your suggestion, I switched from classic networking to dhcpcd. Here's my new /etc/network/interfaces:

# 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 dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

And here's my /etc/dhcpcd.conf:

interface eth0
static ip_address=
static routers=
static domain_name_servers=

3 Answers 3


Now I figured it out, thanks for the link!

Raspi Setup

After copying image to SD card:

mount /dev/mmcblk0p1 /mnt # mount boot partition
touch /mnt/ssh # activates ssh
umount /mnt

mount /dev/mmcblk0p2 /mnt # mount root partition

Edit /mnt/etc/dhcpcd.conf:

# static ethernet interface for debugging
interface eth0
static ip_address=
static routers=
static domain_name_servers=

Umount SD card:

umount /mnt

Remove SD card, plug it into the Raspberry.

On Arch Linux, set up the Ethernet as follows:

sudo ip link set enp0s31f6 up
sudo ip addr add broadcast dev enp0s31f6

Connect to Raspberry using ssh:

ssh [email protected] # default password: raspberry

Add WiFi credentials:

wpa_passphrase [essid] [passphrase] >> /etc/wpa_supplicant/wpa_supplicant.conf

Enable wpa_supplicant:

systemctl enable wpa_supplicant.service
systemctl start wpa_supplicant.service

Restart networking:

systemctl restart dhcpcd.service

You can continue to use obsolete Debian networking despite its limitations - it normally configures a single interface (your implementation is non-standard and it is anyone's guess what it would do).

Including dhcp in /etc/network/interface causes dhcpcd to disable itself.

However I suggest you use the recommended normal dhcpcd networking.

See How to set up networking/WiFi

  • I now tried to switch to dhcpcd. Can I use dhcp in iface wlan0 inet dhcp as i did (see my edit above). Feb 23, 2018 at 10:41
  • You haven't specified what OS you are using. The link specifies the correct settings for both Jessie/Stretch. /etc/network/interface is an anachronism - the default setting effectively does nothing - if you delete it networking continues. The only limitation is dhcpcd detects if dhcp is used and disables itself (as the logs will show).
    – Milliways
    Feb 23, 2018 at 11:10
  • I have, see the first line of my post. Feb 23, 2018 at 14:56
  • @PatrickBucher You should indicate OS in a tag, rather than expecting people to search your post. Raspbian is ambiguous.
    – Milliways
    Feb 23, 2018 at 23:31

Try to add line below to /etc/dhcpcd:

denyinterfaces wlan0
  • 3
    Welcome! This should rather be a comment on the original question, unless you'd like to expand on your answer?
    – Vincent P
    Dec 24, 2019 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.