Getting WPA_Supplicant to work on boot in Debian 10

7,924

Solution 1

I found a solution, which works nicely

I installed connman instead of `network-manager'.

Disabled the specfic device in /etc/connman/main.conf:

NetworkInterfaceBlacklist=wl4ps0

Create a key using

su -l -c "wpa_passphrase myssid my_very_secret_passphrase > /etc/wpa_supplicant/wpa_supplicant.conf"

Copy and paste the key into /etc/network/interfaces

auto wlp4s0
iface wlp4s0 inet dhcp
    wpa-ssid myssid
    wpa-psk XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This solution works nicely under boot and also using ifup and ifdown

Solution 2

The instructions at https://wiki.debian.org/WiFi/HowToUse#wpa_supplicant are a bit unprecise and possibly misleading, but if you drop the contents of /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf similar to the shown below, it should work without any troubles.

/etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

allow-hotplug wlp2s5
iface wlp2s5 inet dhcp
        wpa-ssid mySSID
        wpa-psk 4825ea1ec0ffeebabe8bc93babe3c1e73965cbdead0789796deadf0a624aecec

/etc/wpa_supplicant/wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
        ssid="mySSID"
        psk=4825ea1ec0ffeebabe8bc93babe3c1e73965cbdead0789796deadf0a624aecec
}

Note: remember to enable dhcpcd.service:

#!/bin/bash
sudo systemctl reenable wpa_supplicant.service
sudo systemctl restart wpa_supplicant.service
sudo systemctl restart dhcpcd.service
Share:
7,924

Related videos on Youtube

SpecialBomb
Author by

SpecialBomb

I am a freelancing coder that is not very advanced with what he has learned. I am a Linux user that moved from Windows (I hold Windows and Linux/Unix in high regards, I have no favorite, just Linux seems a lot more useful to me for what I do). I actively preform mathematics in research and recreation. I also play PC games, my favorite game being Quake.I enjoy collecting fine writing and drawing utensils, like the Rotring 600 and the Staedtler 925-25/35. I usually have no idea what I'm doing half the time.

Updated on September 18, 2022

Comments

  • SpecialBomb
    SpecialBomb over 1 year

    I have just created a fresh install of Debian 10. I have disabled network-manager, since I find it extremely annoying, opting for wpa_supplicant (non-mobile wireless desktop). In order to get this to work, I followed the official guide on wiki.debian.org. Note that dhcpcd.service no longer exists, so I couldn't configure it.

    Unfortunately, it does not work. There are a few strange things happening with it, namely that it does successfully raise the interface and associate, but fails anyway for some reason (you will see this in journalctl dump). There is also about a minutes wait during boot for "raising network interfaces".

    What's even stranger is that once logged in, the interface is configured and has an ip address, but it's in a down state. ifup won't work at this point. if I su to root and lower and raise the wifi interface, it connects no problem and in a short amount of time.

    I have no idea what could be causing this to happen, but it may have to do with something involving systemd targets. Does anyone know what's going on, and how it may be fixed?


    journalctl dump

    • Jens Munk
      Jens Munk over 4 years
      I am looking for a better solution, but right now I am taking off systemd networking and using an entry in the crontab. sudo crontab -e and adding @reboot ifconfig eth$ X.X.X.X && ifup eth$ .
    • SpecialBomb
      SpecialBomb over 4 years
      ill try that, but im using netmanager rn just because I dont want trouble
    • Jens Munk
      Jens Munk over 4 years
      I am running LXQT and using connman. Right now, I am trying to ignore a specific interface, I have configured manually in /etc/network/interfaces....