After meticulously following the instructions in this thread. I have a problem with my Raspberry Pi 4 on Raspberry Pi OS. Indeed, when I use this script:
#!/bin/bash
# This script will stop Hotspot (AP+DHCP) and will Switch your Raspberry to a WIFI Client (Definitely)
# Effect is dynamic and definive --> Next start will be as Client mode
# Run : bash sap2cl.sh
echo "========================================"
echo " Switch from Hotspot (AP+DHP) to Client "
echo " Next start will be : Wifi Client mode "
echo "========================================"
echo " "
echo "Stopping hostapd, dnsmasq "
sudo systemctl stop hostapd.service
sudo systemctl stop dnsmasq.service
echo "Configure Client to recover dhcp"
sudo cp /etc/dhcpcd-dynamic.conf /etc/dhcpcd.conf
sudo systemctl daemon-reload
echo "Restart wpa_supplicant"
sudo pkill wpa_supplicant
sleep 2
sudo wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -B -Dnl80211,wext
echo "Done."
exit
My wlan0 interface remains in DOWN, i.e.:
wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN
I tried various solution like reboot, using the command :
sudo wpa_cli -i wlan0 reconfigure
But nothing does, I searched different article, but most of it is cut for Raspian Buster (Pi3).
wpa_supplicant being started by dhcpcd, shouldn’t I re-start dhcpcd instead?
Today I am looking to you for help, and I thank you in advance.
EDIT 29/08/2022 :
Is it valid if I disable the hostapd services and the dnsmasq service to just enable the dhcpcd service? dhcpcd is the one who manages wpa_supplicant on Raspberry Pi OS?
├─dhcpcd.service
│ ├─581 /usr/sbin/dhcpcd -b -q
│ └─654 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0
My question may seem a bit stupid but I would like to understand how it works..
I will still try to switch to wifi management via systemd.