TLDR: On a headless raspberry pi 3 when router goes down and comes back up, wifi connection is lost.
I have two network services:
/etc/init.d/net.wlan0
/etc/init.d/net.enu1u1
with corresponding files in /etc/conf.d:
net.wlan0:
Code: Select all
preup() {
rfkill unblock all
return 0
}
modules_wlan0="wpa_supplicant dhcpcd"
config_wlan0="dhcp"Code: Select all
config_enu1u1="192.168.100.177/24"
dns_servers_enu1u1="192.168.100.1 8.8.8.8"If I restart any of those services, things work fine.
Things get hairy when wireless router goes down and comes back.
Those are the relevant entries from /var/log/messages:
Code: Select all
Feb 5 13:09:53 rpi dhcpcd[1891]: wlan0: carrier lost
Feb 5 13:09:53 rpi wpa_cli[3882]: interface wlan0 DISCONNECTED
Feb 5 13:09:53 rpi dhcpcd[1891]: wlan0: deleting route to 192.168.0.0/24
Feb 5 13:09:53 rpi dhcpcd[1891]: wlan0: deleting default route via 192.168.0.1
Feb 5 13:09:55 rpi dhcpcd[4080]: sending signal TERM to pid 1891
Feb 5 13:09:55 rpi dhcpcd[4080]: waiting for pid 1891 to exit
Feb 5 13:09:55 rpi dhcpcd[1891]: received SIGTERM, stopping
Feb 5 13:09:55 rpi dhcpcd[1891]: wlan0: removing interface
Feb 5 13:10:45 rpi dhcpcd[4080]: pid 1891 failed to exit # <-- this is dhcpcd failing to exit
Feb 5 13:11:29 rpi wpa_cli[4263]: interface wlan0 CONNECTED
Feb 5 13:11:30 rpi rfkill[4354]: unblock set for all
Feb 5 13:11:31 rpi dhcpcd[4449]: sending commands to dhcpcd process
Feb 5 13:11:31 rpi dhcpcd[1891]: control command: dhcpcd -m 2003 wlan0
I noticed that restarting net.wlan0 service fails to terminate dhcpcd process just the same.
If I kill dhcpcd and restart the service, things work.
If I stop net.wlan0 service and run wpa_supplicant and dhcpcd manually, network gets back up when router goes down and comes back up.
My /etc/dhcpcd.conf contains default settings.
So clearly the issue is with dhcpcd failing to exit when it is run as a part of a net.wlan0 service.
I'm failing to understand why and what to do about it.


