davesteele / comitup

Bootstrap Wifi support over Wifi
https://davesteele.github.io/comitup/
GNU General Public License v2.0
322 stars 54 forks source link

Comitup/Network Manager disconnecting exactly after a week or 7 days #141

Closed Anjum9694 closed 3 years ago

Anjum9694 commented 3 years ago

I have my comitup working fine. However there is one thing I don't understand, it fails to connect to the AP exactly a week after boot. Only way to fix is by rebooting. It still creates a hotspot but the dhcp fails to assign an IP. I can still SSH through the hotspot, but the IP address has to be entered manually (10.41.0.1 gateway). This behavior is on a fresh installed comitup image, by the way.

Since I can access through the hotspot, what can I check to debug the behaviour? As a workaround I just made a crontab to restart comitup and dhcpd service every week.

davesteele commented 3 years ago

I don't see this behavior.

DNS is provided by dnsmasq.

See https://github.com/davesteele/comitup/blob/master/CONTRIBUTING.md.

davesteele commented 3 years ago

If the dhcp is failing to assign an IP, how can you ssh through the hotspot?

Are you connecting to an upstream network?

Is this actually an avahi failure?

Anjum9694 commented 3 years ago

Hi, After exactly a week comitup fails to connect to the AP and creates a HOTSPOT. When connected to the HOTSPOT my device is stuck on obtaining IP address (DHCP failure?). I manually enter 10.41.0.150 as the IP and 10.41.0.1 as the Gateway.

I have currently 2 crontabs that execute when this happens (which is always a we ek after boot), I am restarting these services comitup and dhcpd. I will post how it goes.

This behaviour has been talked on this site, but it can't be due to Pihole because it happens on a fresh install. https://www.raspberrypi.org/forums/viewtopic.php?t=240612

davesteele commented 3 years ago

Ok. Note:

The link you provide strongly suggests that restarting comitup will not fix the problem. Unless all the reporters are running Comitup, then NetworkManager is not responsible either. That sounds more like the WiFi device driver. Try a USB WiFi (though there are many adapters that don't work)? Your cron job may have to reboot the Pi.

The other common denominator appears to be Pihole.

This may not be directly related, but the bottom of this comment mentions that Pihole rewrites the dnsmasq configuration file, meaning that it is independently using dnsmasq. This is a major opportunity for conflict with Comitup.

davesteele commented 3 years ago

If you are using this for Pihole, and Comitup is just about headless setup, why not directly connect the Pi to the router? The Ethernet interface would be configured automatically.

davesteele commented 3 years ago

Something you can look at now - how long is the DHCP lease time for the AP connection. Is it 7 days perchance?

nmcli -f ipv4.method con show "`nmcli -t -f NAME connection `"

Anjum9694 commented 3 years ago

Ah.. I see. Network Manager handles the connection to AP. Uncommented the restart cronjobs for now. I changed IPv4 to Manual and entered a static IP in nmtui for the AP connection.

nmcli -f ipv4.method con show "nmcli -t -f NAME connection " returns

Error: AP-SSID
dhcp
comitup Pi-0000
static - no such connection profile.
Anjum9694 commented 3 years ago

"Solved" for now by switching to ethernet. If anyone else has encountered this and knows a solution please comment on this issue.

davesteele commented 3 years ago

You say that swap fills after pretty much exactly one week. Do you know which process is taking the memory? I've got two days in on a system - "top" mode "M" doesn't show any candidate problem children.

Something like this has come up before. I wonder if this is related. Perhaps you can see if the wpa_cli commands in that file help.

Anjum9694 commented 3 years ago

It may not be caused by comitup, it could be related to a Grafana datasource prometheus I installed leaking into memory. I raised this issue in the first place in case anyone else encounters it.