0

I have set up access point according to the manual https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md on respberry pi 4b.

It works fine. Now I need to disable AP and connect my Rpi to a router.

This is a short log of what I do: stop hostapd and restart wpa_supplicant and networking

pi@kyb-pi4 ~> sudo systemctl stop hostapd
pi@kyb-pi4 ~> pgrep -af wpa_supplicant
3361 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
pi@kyb-pi4 ~> pgrep -af hostapd
pi@kyb-pi4 ~> sudo systemctl restart wpa_supplicant
pi@kyb-pi4 ~> sudo systemctl restart networking
pi@kyb-pi4 ~> pgrep -af wpa_supplicant
3443 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
pi@kyb-pi4 ~> tail -f /var/log/syslog&
Oct 22 18:54:43 kyb-pi4 systemd[1]: Starting WPA supplicant...
Oct 22 18:54:43 kyb-pi4 systemd[1]: Started WPA supplicant.
Oct 22 18:54:43 kyb-pi4 wpa_supplicant[3443]: Successfully initialized wpa_supplicant
Oct 22 18:54:49 kyb-pi4 systemd[1]: Stopping Raise network interfaces...
Oct 22 18:54:49 kyb-pi4 ifdown[3477]: ifdown: /etc/network/interfaces.d/wifi-kybs-route:1: misplaced option
Oct 22 18:54:49 kyb-pi4 systemd[1]: networking.service: Succeeded.
Oct 22 18:54:49 kyb-pi4 systemd[1]: Stopped Raise network interfaces.
Oct 22 18:54:49 kyb-pi4 systemd[1]: Starting Raise network interfaces...
Oct 22 18:54:49 kyb-pi4 ifup[3492]: ifup: /etc/network/interfaces.d/wifi-kybs-route:1: misplaced option
Oct 22 18:54:49 kyb-pi4 systemd[1]: Started Raise network interfaces.
pi@kyb-pi4 ~>
pi@kyb-pi4 ~>
pi@kyb-pi4 ~> sudo systemctl restart networking
Oct 22 18:55:17 kyb-pi4 systemd[1]: Stopping Raise network interfaces...
Oct 22 18:55:17 kyb-pi4 ifdown[3573]: ifdown: /etc/network/interfaces.d/wifi-kybs-route:1: misplaced option
Oct 22 18:55:17 kyb-pi4 systemd[1]: networking.service: Succeeded.
Oct 22 18:55:17 kyb-pi4 systemd[1]: Stopped Raise network interfaces.
Oct 22 18:55:17 kyb-pi4 systemd[1]: Starting Raise network interfaces...
Oct 22 18:55:17 kyb-pi4 ifup[3588]: ifup: /etc/network/interfaces.d/wifi-kybs-route:1: misplaced option
Oct 22 18:55:17 kyb-pi4 systemd[1]: Started Raise network interfaces.
pi@kyb-pi4 ~> sudo systemctl restart wpa_supplicant
Oct 22 18:55:25 kyb-pi4 systemd[1]: Stopping WPA supplicant...
Oct 22 18:55:25 kyb-pi4 systemd[1]: wpa_supplicant.service: Succeeded.
Oct 22 18:55:25 kyb-pi4 systemd[1]: Stopped WPA supplicant.
Oct 22 18:55:25 kyb-pi4 systemd[1]: Starting WPA supplicant...
Oct 22 18:55:25 kyb-pi4 systemd[1]: Started WPA supplicant.
Oct 22 18:55:25 kyb-pi4 wpa_supplicant[3638]: Successfully initialized wpa_supplicant
pi@kyb-pi4 ~> ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.144.23  netmask 255.255.0.0  broadcast 192.168.255.255
        inet6 fe80::b01e:b82b:6de0:acb6  prefixlen 64  scopeid 0x20<link>
        ether dc:a6:32:12:87:92  txqueuelen 1000  (Ethernet)
        RX packets 10533  bytes 2106720 (2.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8943  bytes 1099980 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1700  bytes 115208 (112.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1700  bytes 115208 (112.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

As you can see wlan0 does looks down

pi@kyb-pi4 ~> ifconfig wlan0 up
pi@kyb-pi4 ~> ifconfig wlan0
wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 9c:43:1e:49:c0:85  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1656 (1.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

But it has no IP assigned. It does not want to connect to my AP. But it worked before I configured hostapd.

1

It is unclear exactly what you ACTUALLY did, but any services you enable you should disable - including dnsmasq.

Raspberry Pi OS DOES NOT use Debian networking (by default) it uses dhcpcd

systemctl restart networking is not needed (but probably does no harm - unless you are relying on /etc/network/interfaces)

You should NOT systemctl restart wpa_supplicant this should be started by dhcpcd.

The file /etc/wpa_supplicant/wpa_supplicant.conf should contain something like the following:-

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=AU

network={
    ssid="ESSID"
    psk="Your_wifi_password"
}

You probably edited /etc/dhcpcd.conf to set a static IP address, so you should remove this.

You should check systemctl status dhcpcd

Rather than undoing things, it would be easier to restore from your backup. The fragments you have listed are inconclusive.

1
  • You told me main idea: wpa_supplicant is run by dhcpcd! and I found what to do. Thank you.
    – kyb
    Oct 23 '20 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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