I had the wifi on my raspi 3B working perfectly for about 2 years. I then saw I had two wpa_supplicant.conf
files:
/etc/wpa_supplicant.conf
/etc/wpa_supplicant/wpa_supplicant.conf
I briefly checked both files and as far as I remember they were the same (but not sure anymore). So I deleted /etc/wpa_supplicant/wpa_supplicant.conf
and then wifi didn't work anymore. So I did
sudo cp /etc/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
After a reboot, wifi still didn't work. So I double checked whether the ssid and password are correct in those files (they are). I also used sudo iwlist wlan0 scan
to check whether the raspi finds/sees my wifi network (it does). After that I've been changing all sorts of things in those wpa_supplicant.conf
files and in /etc/network/interfaces
. After every change I reboot the pi and disconnect the ethernet cable and check the UI of my router to see if it connects. After about two hours banging my head against the wall it still doesn't work and I'm really out of ideas.
The current situation is as follows:
/etc/network/interfaces
:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
/etc/wpa_supplicant.conf
and /etc/wpa_supplicant/wpa_supplicant.conf
:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="my_awesome_network"
psk="my_password"
}
Does anybody have any idea what could be wrong here? Are there any logs that I can check to debug this further? All tips are welcome!
[EDIT]
Ok, so I found out that I've got a Raspi 3B (not the 3B+) and I'm on Raspbian Stretch. I checked out the post that @milliways linked to and made my files look exactly like they say:
I deleted /etc/network/interfaces
and /etc/wpa_supplicant/wpa_supplicant.conf
looks like this:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=NL
network={
ssid="my_network"
psk="my_password"
}
After rebooting the raspi it still doesn't connect to the wifi.
Any more ideas?
[EDIT 2]
So as suggested by @goldilocks I logged in and ran
sudo wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0 -d
which resulted in this output. In there it says it Failed to add interface wlan0
. After some searching I found this post which suggested to check whether wpa_supplicant
is already running on wlan0. So I did
ps aux | grep supplicant
which showed me it was already running indeed. I then killed that process and then ran this again.
sudo wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0 -d
AND YES! It's running!!
Okay, no need for the capslock, because after a reboot wifi still isn't set up automatically. So I can now get wifi running by booting with the ethernet cable attached, ssh'ing into the pi, kill the existing wpa_supplicant
process and then starting it with the command I pasted above. I can then disconnect the ethernet cable and ssh into the pi over wifi.
Any ideas how can get it running correctly after booting up?
[EDIT 3]
Following the instructions of @Milliways I booted the Pi up from scratch with the ethernet cable attached, ssh'ed into it and then ran systemctl status dhcpcd
. The result:
● dhcpcd.service - LSB: IPv4 DHCP client with IPv4LL support
Loaded: loaded (/etc/init.d/dhcpcd; generated; vendor preset: enabled)
Drop-In: /etc/systemd/system/dhcpcd.service.d
└─wait.conf
Active: active (running) since Sat 2019-05-04 23:17:13 CEST; 9h ago
Docs: man:systemd-sysv-generator(8)
Process: 345 ExecStart=/sbin/dhcpcd -q -w (code=exited, status=0/SUCCESS)
CGroup: /system.slice/dhcpcd.service
└─789 /sbin/dhcpcd -q -w
May 04 23:17:04 raspberrypi dhcpcd[345]: wlan0: soliciting a DHCP lease
May 04 23:17:04 raspberrypi dhcpcd[345]: wlan0: carrier lost
May 04 23:17:04 raspberrypi dhcpcd[345]: wlan0: deleting address fe80::bbd4:7378:8a28:43b9
May 04 23:17:05 raspberrypi dhcpcd[345]: wlan0: new hardware address: 66:60:38:2a:89:7d
May 04 23:17:08 raspberrypi dhcpcd[345]: eth0: probing address 192.168.0.100/24
May 04 23:17:13 raspberrypi dhcpcd[345]: eth0: leased 192.168.0.100 for 7200 seconds
May 04 23:17:13 raspberrypi dhcpcd[345]: eth0: adding route to 192.168.0.0/24
May 04 23:17:13 raspberrypi dhcpcd[345]: eth0: adding default route via 192.168.0.1
May 04 23:17:13 raspberrypi systemd[1]: Started LSB: IPv4 DHCP client with IPv4LL support.
May 04 23:17:19 raspberrypi dhcpcd[789]: eth0: no IPv6 Routers available
Warning: dhcpcd.service changed on disk. Run 'systemctl daemon-reload' to reload units.
So dhcpcd seems to be running fine. The contents of /etc/dhcpcd.conf
are:
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
The folder /usr/lib/dhcpcd/dhcpcd-hooks/
doesn't exist (/usr/lib/dhcpcd/
doesn't even exist).
So where can I go from here? Do I need to write a hook to get the wifi started?
systemctl status dhcpcd
. DO NOT run wpa_supplicant - it should be invoked by a hook indhcpcd
. (goldilocks does not use the standard Raspbian network managerdhcpcd
) include the post in your question - NOT an external link – Milliways May 04 '19 at 23:00systemctl status dhcpcd
to the question under [EDIT 3]. I aslo included the contents of/etc/dhcpcd.conf
. Btw, I'm learning a lot from you here, so next to wanting to solve the problem, this is actually really interesting! – kramer65 May 05 '19 at 07:05wpa_supplicant
running, so there's not much harm in trying to start one. It is not an ideal way to do things, but if there is some problem that is preventing the system from operating normally, it may help to isolate whatever that is. – goldilocks May 05 '19 at 10:36cat /etc/issue
will tell you this. – goldilocks May 05 '19 at 10:42