MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.8k stars 494 forks source link

DietPi-Config | WiFi connection fails, when eth + wlan are enabled #2103

Open frankdugan3 opened 5 years ago

frankdugan3 commented 5 years ago

Creating a bug report/issue:

Required Information:

Additional Information (if applicable):

Steps to reproduce:

  1. Enable WiFi, add SSID configurations, and eneable autoreconnect

Expected behaviour:

Actual behaviour:

Extra details:

● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 13:32:35 EDT; 4min 59s ago
 Main PID: 636 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 636 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─1601 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/w
pa_supplicant/wpa_supplicant.conf
           ├─1616 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -d
f /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─1798 ping -I wlan0 -c 1 192.168.86.1

Oct 02 13:37:16 ScrumKiosk-01 dhclient[1605]: No working leases in persistent database - sleeping.
Oct 02 13:37:16 ScrumKiosk-01 bash[636]: No DHCPOFFERS received.
Oct 02 13:37:16 ScrumKiosk-01 bash[636]: No working leases in persistent database - sleeping.
Oct 02 13:37:16 ScrumKiosk-01 bash[636]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 16: G_DIETPI-NOTIFY: comma
nd not found
Oct 02 13:37:18 ScrumKiosk-01 dhclient[1616]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
Oct 02 13:37:22 ScrumKiosk-01 dhclient[1616]: DHCPREQUEST of 192.168.86.45 on wlan0 to 255.255.255.255 port 67
Oct 02 13:37:22 ScrumKiosk-01 dhclient[1616]: DHCPOFFER of 192.168.86.45 from 192.168.86.1
Oct 02 13:37:23 ScrumKiosk-01 dhclient[1616]: DHCPACK of 192.168.86.45 from 192.168.86.1
Oct 02 13:37:23 ScrumKiosk-01 dhclient[1616]: bound to 192.168.86.45 -- renewal in 39930 seconds.
Oct 02 13:37:26 ScrumKiosk-01 bash[636]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 8: G_DIETPI-NOTIFY: comman
d not found
MichaIng commented 5 years ago

@frankdugan3 Thanks for your report.

Hui took a while to even find this service in the code, as I never use WiFi with DietPi 😄.

#!/bin/bash
{
URL_PING="$WIFI_GATEWAY"
ADAPTER="wlan$WIFI_DEV_INDEX"
TICKRATE=10
while true
do
G_DIETPI-NOTIFY 2 "Checking connnection for: \$ADAPTER"
ping -I \$ADAPTER -c 1 \$URL_PING
if (( \$? != 0 )); then
G_DIETPI-NOTIFY 2 "Detected connection loss: \$ADAPTER. Reconnecting"
ifdown "\$ADAPTER"
sleep 1
ifup "\$ADAPTER"
G_DIETPI-NOTIFY 0 'Completed'
else
G_DIETPI-NOTIFY 0 "Connection \$ADAPTER"
fi
sleep \$TICKRATE
done

/var/lib/dietpi/dietpi-wifi-monitor.sh: line 16: G_DIETPI-NOTIFY: command not found

As we do not source DietPi-Globals, we cannot use G_DIETPI-NOTIFY here. Error our side. Either we need to source globals or use simple echo. As output should just go to journal, I would just do echo, also to reduce init time and RAM usage of the service.

Also currently it looks quite spammy, producing output on every tick. I would just create output, if connection was actually lost and after successful reconnection. @Fourdee What do you think?

So but the errors should no break the script. Also your status output shows it is active and running.

Other topic when checking the code: https://github.com/Fourdee/DietPi/blob/testing/dietpi/dietpi-config#L3451

https://github.com/Fourdee/DietPi/blob/testing/dietpi/dietpi-config#L2434

But besides that I do not find a reason WiFi should break and have no DietPi with WiFi device here to test. I hope Fourdee finds time to check.

frankdugan3 commented 5 years ago

@MichaIng Not sure where it breaks, but in the end something in the re-connection script ends up dropping the connection. ip link reports wlan0 as down, and I can't ping anything outside localhost.

MichaIng commented 5 years ago

@frankdugan3 Strange, it should only drop WiFi interface, if it could not ping the gateway. Then it should bring up the same interface. So if $ADAPTER should somehow be wrong, it should not affect the right interface.

But if $WIFI_GATEWAY was wrong, it would be in a connection loop, perhaps breaking after some time.

Can you please do the following:

frankdugan3 commented 5 years ago

OK, here's the full log from the time of login until getting a successful connection. It's long, so I'll comment up here.

I'm using DHCP. The reason my previous log shows connection is because I had it running for a long time before I checked the logs, and it apparently connected eventually.

When I have autoreconnect off, the WiFi connects immediately both on changing the settings via dietpi-config and on boot.

The more I dig, the behavior is very strange. It becomes a very long connection process with a lot of false starts and stops when the reconnect script is starting the WiFi connection. It also times out WiFi during boot. Also, if I manually run ifdown wlan0 and ifup wlan0, the behaves the same way as the reconnect script. Perhaps this comes down to my particular WiFi module (Edimax EW-7811Un), but something is different about connecting during boot or dietpi-config and simply running ifup.

If I wait long enough, it does seem to randomly connect successfully. The issue is that it's so flaky it randomly drops the connection, and then randomly picks it back up after many false starts.

● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 29s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─1423 ifup wlan0
           ├─1439 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─1442 /bin/sh -c /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0 
           └─1443 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0

Oct 02 16:32:58 ScrumKiosk-01 bash[646]: Listening on LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:32:58 ScrumKiosk-01 bash[646]: Sending on   LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:32:58 ScrumKiosk-01 bash[646]: Sending on   Socket/fallback
Oct 02 16:32:58 ScrumKiosk-01 bash[646]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
Oct 02 16:32:58 ScrumKiosk-01 dhclient[1443]: Sending on   LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:32:58 ScrumKiosk-01 dhclient[1443]: Sending on   Socket/fallback
Oct 02 16:32:58 ScrumKiosk-01 dhclient[1443]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
Oct 02 16:32:59 ScrumKiosk-01 wpa_supplicant[1439]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:96:25 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:33:00 ScrumKiosk-01 wpa_supplicant[1439]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:33:02 ScrumKiosk-01 wpa_supplicant[1439]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:96:25 (SSID='Duganators' freq=2462 MHz)
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 44s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─1439 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─1629 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─1663 sleep 10

Oct 02 16:33:05 ScrumKiosk-01 wpa_supplicant[1439]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="Duganators" auth_failures=1 duration=10 reason=CONN_FAILED
Oct 02 16:33:09 ScrumKiosk-01 dhclient[1443]: No DHCPOFFERS received.
Oct 02 16:33:09 ScrumKiosk-01 bash[646]: No DHCPOFFERS received.
Oct 02 16:33:09 ScrumKiosk-01 bash[646]: No working leases in persistent database - sleeping.
Oct 02 16:33:09 ScrumKiosk-01 dhclient[1443]: No working leases in persistent database - sleeping.
Oct 02 16:33:10 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 16: G_DIETPI-NOTIFY: command not found
Oct 02 16:33:13 ScrumKiosk-01 dhclient[1629]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
Oct 02 16:33:16 ScrumKiosk-01 wpa_supplicant[1439]: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="Duganators"
Oct 02 16:33:16 ScrumKiosk-01 wpa_supplicant[1439]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:33:17 ScrumKiosk-01 wpa_supplicant[1439]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="Duganators" auth_failures=2 duration=20 reason=CONN_FAILED
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 1min 1s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─1711 ifup wlan0
           ├─1727 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─1730 /bin/sh -c /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0 
           └─1731 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0

Oct 02 16:33:32 ScrumKiosk-01 bash[646]: Listening on LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:33:32 ScrumKiosk-01 bash[646]: Sending on   LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:33:32 ScrumKiosk-01 bash[646]: Sending on   Socket/fallback
Oct 02 16:33:32 ScrumKiosk-01 bash[646]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Oct 02 16:33:32 ScrumKiosk-01 dhclient[1731]: Sending on   LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:33:32 ScrumKiosk-01 dhclient[1731]: Sending on   Socket/fallback
Oct 02 16:33:32 ScrumKiosk-01 dhclient[1731]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Oct 02 16:33:33 ScrumKiosk-01 wpa_supplicant[1727]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:96:25 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:33:34 ScrumKiosk-01 wpa_supplicant[1727]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:33:34 ScrumKiosk-01 wpa_supplicant[1727]: wlan0: Trying to associate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 1min 32s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─1826 ifup wlan0
           ├─1828 /bin/sh -c /bin/run-parts --exit-on-error /etc/network/if-pre-up.d
           ├─1829 /bin/run-parts --exit-on-error /etc/network/if-pre-up.d
           ├─1831 /bin/sh /etc/network/if-pre-up.d/wireless-tools
           └─1834 /sbin/ip link set dev wlan0 up

Oct 02 16:34:04 ScrumKiosk-01 dhclient[1805]: DHCPRELEASE on wlan0 to 192.168.86.1 port 67
Oct 02 16:34:04 ScrumKiosk-01 dhclient[1805]: send_packet: Network is unreachable
Oct 02 16:34:04 ScrumKiosk-01 bash[646]: DHCPRELEASE on wlan0 to 192.168.86.1 port 67
Oct 02 16:34:04 ScrumKiosk-01 bash[646]: send_packet: Network is unreachable
Oct 02 16:34:04 ScrumKiosk-01 bash[646]: send_packet: please consult README file regarding broadcast address.
Oct 02 16:34:04 ScrumKiosk-01 bash[646]: dhclient.c:2733: Failed to send 300 byte long packet over fallback interface.
Oct 02 16:34:04 ScrumKiosk-01 dhclient[1805]: send_packet: please consult README file regarding broadcast address.
Oct 02 16:34:04 ScrumKiosk-01 dhclient[1805]: dhclient.c:2733: Failed to send 300 byte long packet over fallback interface.
Oct 02 16:34:04 ScrumKiosk-01 wpa_supplicant[1727]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Oct 02 16:34:04 ScrumKiosk-01 wpa_supplicant[1727]: wlan0: CTRL-EVENT-TERMINATING
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 1min 52s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─1843 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─1888 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─1930 sleep 10

Oct 02 16:34:13 ScrumKiosk-01 dhclient[1847]: bound to 192.168.86.41 -- renewal in 35516 seconds.
Oct 02 16:34:13 ScrumKiosk-01 bash[646]: bound to 192.168.86.41 -- renewal in 35516 seconds.
Oct 02 16:34:13 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 16: G_DIETPI-NOTIFY: command not found
Oct 02 16:34:23 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 8: G_DIETPI-NOTIFY: command not found
Oct 02 16:34:23 ScrumKiosk-01 bash[646]: PING 192.168.86.1 (192.168.86.1) from 192.168.86.41 wlan0: 56(84) bytes of data.
Oct 02 16:34:23 ScrumKiosk-01 bash[646]: 64 bytes from 192.168.86.1: icmp_seq=1 ttl=64 time=12.8 ms
Oct 02 16:34:23 ScrumKiosk-01 bash[646]: --- 192.168.86.1 ping statistics ---
Oct 02 16:34:23 ScrumKiosk-01 bash[646]: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
Oct 02 16:34:23 ScrumKiosk-01 bash[646]: rtt min/avg/max/mdev = 12.884/12.884/12.884/0.000 ms
Oct 02 16:34:23 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 20: G_DIETPI-NOTIFY: command not found
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 2min 15s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─1843 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─1888 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─1942 ping -I wlan0 -c 1 192.168.86.1

Oct 02 16:34:23 ScrumKiosk-01 bash[646]: rtt min/avg/max/mdev = 12.884/12.884/12.884/0.000 ms
Oct 02 16:34:23 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 20: G_DIETPI-NOTIFY: command not found
Oct 02 16:34:33 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 8: G_DIETPI-NOTIFY: command not found
Oct 02 16:34:33 ScrumKiosk-01 bash[646]: PING 192.168.86.1 (192.168.86.1) from 192.168.86.41 wlan0: 56(84) bytes of data.
Oct 02 16:34:33 ScrumKiosk-01 bash[646]: 64 bytes from 192.168.86.1: icmp_seq=1 ttl=64 time=10.8 ms
Oct 02 16:34:33 ScrumKiosk-01 bash[646]: --- 192.168.86.1 ping statistics ---
Oct 02 16:34:33 ScrumKiosk-01 bash[646]: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
Oct 02 16:34:33 ScrumKiosk-01 bash[646]: rtt min/avg/max/mdev = 10.890/10.890/10.890/0.000 ms
Oct 02 16:34:33 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 20: G_DIETPI-NOTIFY: command not found
Oct 02 16:34:43 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 8: G_DIETPI-NOTIFY: command not found
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 2min 25s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─2004 ifup wlan0
           ├─2020 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─2023 /bin/sh -c /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0 
           └─2024 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0

Oct 02 16:34:56 ScrumKiosk-01 dhclient[2024]: For info, please visit https://www.isc.org/software/dhcp/
Oct 02 16:34:56 ScrumKiosk-01 dhclient[2024]: 
Oct 02 16:34:56 ScrumKiosk-01 dhclient[2024]: Listening on LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:34:56 ScrumKiosk-01 dhclient[2024]: Sending on   LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:34:56 ScrumKiosk-01 bash[646]: Listening on LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:34:56 ScrumKiosk-01 bash[646]: Sending on   LPF/wlan0/74:da:38:ee:b3:db
Oct 02 16:34:56 ScrumKiosk-01 bash[646]: Sending on   Socket/fallback
Oct 02 16:34:56 ScrumKiosk-01 bash[646]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Oct 02 16:34:56 ScrumKiosk-01 dhclient[2024]: Sending on   Socket/fallback
Oct 02 16:34:56 ScrumKiosk-01 dhclient[2024]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 2min 34s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─2020 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─2034 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─2068 sleep 10

Oct 02 16:35:04 ScrumKiosk-01 wpa_supplicant[2020]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:35:04 ScrumKiosk-01 dhclient[2024]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Oct 02 16:35:04 ScrumKiosk-01 bash[646]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Oct 02 16:35:05 ScrumKiosk-01 wpa_supplicant[2020]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:96:25 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:35:06 ScrumKiosk-01 wpa_supplicant[2020]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:35:07 ScrumKiosk-01 dhclient[2024]: No DHCPOFFERS received.
Oct 02 16:35:07 ScrumKiosk-01 bash[646]: No DHCPOFFERS received.
Oct 02 16:35:07 ScrumKiosk-01 bash[646]: No working leases in persistent database - sleeping.
Oct 02 16:35:07 ScrumKiosk-01 dhclient[2024]: No working leases in persistent database - sleeping.
Oct 02 16:35:07 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 16: G_DIETPI-NOTIFY: command not found
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 3min 6s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─2119 ifup wlan0
           ├─2135 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─2138 /bin/sh -c /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0 
           └─2139 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0

Oct 02 16:35:30 ScrumKiosk-01 bash[646]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Oct 02 16:35:30 ScrumKiosk-01 dhclient[2139]: Sending on   Socket/fallback
Oct 02 16:35:30 ScrumKiosk-01 dhclient[2139]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Oct 02 16:35:31 ScrumKiosk-01 wpa_supplicant[2135]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:35:32 ScrumKiosk-01 wpa_supplicant[2135]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:35:34 ScrumKiosk-01 wpa_supplicant[2135]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:96:25 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:35:36 ScrumKiosk-01 wpa_supplicant[2135]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:35:37 ScrumKiosk-01 wpa_supplicant[2135]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:96:25 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:35:38 ScrumKiosk-01 dhclient[2139]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Oct 02 16:35:38 ScrumKiosk-01 bash[646]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 3min 21s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─2135 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─2153 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─2190 ping -I wlan0 -c 1 192.168.86.1

Oct 02 16:35:41 ScrumKiosk-01 bash[646]: No working leases in persistent database - sleeping.
Oct 02 16:35:41 ScrumKiosk-01 dhclient[2139]: No working leases in persistent database - sleeping.
Oct 02 16:35:41 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 16: G_DIETPI-NOTIFY: command not found
Oct 02 16:35:46 ScrumKiosk-01 dhclient[2153]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
Oct 02 16:35:50 ScrumKiosk-01 dhclient[2153]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
Oct 02 16:35:51 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 8: G_DIETPI-NOTIFY: command not found
Oct 02 16:35:51 ScrumKiosk-01 bash[646]: ping: Warning: source address might be selected on device other than wlan0.
Oct 02 16:35:51 ScrumKiosk-01 wpa_supplicant[2135]: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="Duganators"
Oct 02 16:35:51 ScrumKiosk-01 wpa_supplicant[2135]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:35:52 ScrumKiosk-01 wpa_supplicant[2135]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="Duganators" auth_failures=2 duration=20 reason=CONN_FAILED
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 3min 47s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─2251 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─2268 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─2302 sleep 10

Oct 02 16:36:13 ScrumKiosk-01 wpa_supplicant[2251]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:36:15 ScrumKiosk-01 wpa_supplicant[2251]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:96:25 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:36:15 ScrumKiosk-01 dhclient[2255]: No DHCPOFFERS received.
Oct 02 16:36:15 ScrumKiosk-01 bash[646]: No DHCPOFFERS received.
Oct 02 16:36:15 ScrumKiosk-01 bash[646]: No working leases in persistent database - sleeping.
Oct 02 16:36:15 ScrumKiosk-01 dhclient[2255]: No working leases in persistent database - sleeping.
Oct 02 16:36:15 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 16: G_DIETPI-NOTIFY: command not found
Oct 02 16:36:17 ScrumKiosk-01 wpa_supplicant[2251]: wlan0: SME: Trying to authenticate with 70:3a:cb:1f:94:15 (SSID='Duganators' freq=2462 MHz)
Oct 02 16:36:18 ScrumKiosk-01 dhclient[2268]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
Oct 02 16:36:18 ScrumKiosk-01 wpa_supplicant[2251]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="Duganators" auth_failures=1 duration=10 reason=CONN_FAILED
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 4min 19s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─2369 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─2388 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─2422 sleep 10

Oct 02 16:36:40 ScrumKiosk-01 wpa_supplicant[2369]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=US
Oct 02 16:36:41 ScrumKiosk-01 dhclient[2373]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Oct 02 16:36:41 ScrumKiosk-01 bash[646]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Oct 02 16:36:41 ScrumKiosk-01 wpa_supplicant[2369]: wlan0: WPA: Key negotiation completed with 70:3a:cb:1f:94:15 [PTK=CCMP GTK=CCMP]
Oct 02 16:36:41 ScrumKiosk-01 wpa_supplicant[2369]: wlan0: CTRL-EVENT-CONNECTED - Connection to 70:3a:cb:1f:94:15 completed [id=0 id_str=]
Oct 02 16:36:49 ScrumKiosk-01 dhclient[2373]: No DHCPOFFERS received.
Oct 02 16:36:49 ScrumKiosk-01 bash[646]: No DHCPOFFERS received.
Oct 02 16:36:49 ScrumKiosk-01 bash[646]: No working leases in persistent database - sleeping.
Oct 02 16:36:49 ScrumKiosk-01 dhclient[2373]: No working leases in persistent database - sleeping.
Oct 02 16:36:49 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 16: G_DIETPI-NOTIFY: command not found
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 4min 44s ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─2369 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─2388 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─2464 sleep 10

Oct 02 16:36:59 ScrumKiosk-01 bash[646]: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
Oct 02 16:36:59 ScrumKiosk-01 bash[646]: rtt min/avg/max/mdev = 150.664/150.664/150.664/0.000 ms
Oct 02 16:36:59 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 20: G_DIETPI-NOTIFY: command not found
Oct 02 16:37:09 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 8: G_DIETPI-NOTIFY: command not found
Oct 02 16:37:09 ScrumKiosk-01 bash[646]: PING 192.168.86.1 (192.168.86.1) from 192.168.86.41 wlan0: 56(84) bytes of data.
Oct 02 16:37:09 ScrumKiosk-01 bash[646]: 64 bytes from 192.168.86.1: icmp_seq=1 ttl=64 time=7.97 ms
Oct 02 16:37:09 ScrumKiosk-01 bash[646]: --- 192.168.86.1 ping statistics ---
Oct 02 16:37:09 ScrumKiosk-01 bash[646]: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
Oct 02 16:37:09 ScrumKiosk-01 bash[646]: rtt min/avg/max/mdev = 7.975/7.975/7.975/0.000 ms
Oct 02 16:37:09 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 20: G_DIETPI-NOTIFY: command not found
● dietpi-wifi-monitor.service - Monitors loss of WiFi connection and automatically reconnects
   Loaded: loaded (/etc/systemd/system/dietpi-wifi-monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-02 16:32:33 EDT; 5min ago
 Main PID: 646 (dietpi-wifi-mon)
   CGroup: /system.slice/dietpi-wifi-monitor.service
           ├─ 646 /bin/bash /var/lib/dietpi/dietpi-wifi-monitor.sh
           ├─2369 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
           ├─2388 /sbin/dhclient -4 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0
           └─2478 sleep 10

Oct 02 16:37:19 ScrumKiosk-01 bash[646]: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
Oct 02 16:37:19 ScrumKiosk-01 bash[646]: rtt min/avg/max/mdev = 9.107/9.107/9.107/0.000 ms
Oct 02 16:37:19 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 20: G_DIETPI-NOTIFY: command not found
Oct 02 16:37:29 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 8: G_DIETPI-NOTIFY: command not found
Oct 02 16:37:29 ScrumKiosk-01 bash[646]: PING 192.168.86.1 (192.168.86.1) from 192.168.86.41 wlan0: 56(84) bytes of data.
Oct 02 16:37:29 ScrumKiosk-01 bash[646]: 64 bytes from 192.168.86.1: icmp_seq=1 ttl=64 time=7.52 ms
Oct 02 16:37:29 ScrumKiosk-01 bash[646]: --- 192.168.86.1 ping statistics ---
Oct 02 16:37:29 ScrumKiosk-01 bash[646]: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
Oct 02 16:37:29 ScrumKiosk-01 bash[646]: rtt min/avg/max/mdev = 7.525/7.525/7.525/0.000 ms
Oct 02 16:37:29 ScrumKiosk-01 bash[646]: /var/lib/dietpi/dietpi-wifi-monitor.sh: line 20: G_DIETPI-NOTIFY: command not found
Fourdee commented 5 years ago

@frankdugan3

line 20: G_DIETPI-NOTIFY: command not found

Yep, needs globals loaded in.

If I wait long enough, it does seem to randomly connect successfully. The issue is that it's so flaky it randomly drops the connection, and then randomly picks it back up after many false starts.

This appears to be working as intended? If no ping result, the service will drop and restart the WiFi adapter. Its then down to the adapter to achieve a stable connection, which it has 10 seconds to achieve before next check.

Looks more like a slow DHCP + possible signal strength issue. Try using a static IP, under flaky connections it removes the need for DHCP lease/ack.

Also, whats the signal strength (dietpi-config)?

I'll setup my C2 with same adapter and run tests.

frankdugan3 commented 5 years ago

@Fourdee The signal should be pretty strong given that it's 3 ft away from the AP. I haven't had issues with slow DHCP with any other devices, and there's only a few things connecting to the AP. The same image is also being testing in a completely different location with a different brand of AP with another C2 and WiFi module (same model), and it's behaving exactly the same way. An older image with an older version of DietPi does not have this issue on the same hardware and network.

I'm starting to think this is coming down to a WiFi driver issue. @Fourdee are you using the same WiFi adapter as me (Edimax EW-7811Un)?

Fourdee commented 5 years ago

@frankdugan3

Yep, testing now.

root@DietPi:~# lsusb
Bus 001 Device 003: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Fourdee commented 5 years ago

Notes:

Listening on LPF/wlan0/74:da:38:26:9d:65
Sending on   LPF/wlan0/74:da:38:26:9d:65
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPREQUEST of 192.168.43.65 on wlan0 to 255.255.255.255 port 67
DHCPOFFER of 192.168.43.65 from 192.168.43.1
DHCPACK of 192.168.43.65 from 192.168.43.1
Oct 03 23:18:48 DietPi dhclient[5584]: Sending on   LPF/wlan0/74:da:38:26:9d:65
Oct 03 23:18:48 DietPi bash[4634]: Listening on LPF/wlan0/74:da:38:26:9d:65
Oct 03 23:18:48 DietPi bash[4634]: Sending on   LPF/wlan0/74:da:38:26:9d:65
Oct 03 23:18:48 DietPi bash[4634]: Sending on   Socket/fallback
Oct 03 23:18:48 DietPi bash[4634]: DHCPRELEASE on wlan0 to 192.168.43.1 port 67
Oct 03 23:18:48 DietPi dhclient[5584]: Sending on   Socket/fallback
Oct 03 23:18:48 DietPi dhclient[5584]: DHCPRELEASE on wlan0 to 192.168.43.1 port 67
Oct 03 23:18:48 DietPi wpa_supplicant[5478]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:ec:0a:ce:2b:76 reason=3 locally_generated=1
Oct 03 23:18:48 DietPi wpa_supplicant[5478]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Oct 03 23:18:48 DietPi wpa_supplicant[5478]: wlan0: CTRL-EVENT-TERMINATING

🈯️ Confirmed, dmesg full of constant reconnects.

Actually, the above is due to connecting on a hotspot, where the gateway scraped from active (eth0) is not available for ping on wlan.

Fourdee commented 5 years ago

So the issue appears to be, when both eth and wlan are enabled/active, with the wifi connection script, and, connections are on different subnetworks:

Causing the re-connection script to constantly reconnect.


Also fails to ping the gateway of wlan0, when on different subnetworks:

root@DietPi:~# ip route show 0.0.0.0/0 dev wlan0 | awk '{print $3}'
192.168.43.1
root@DietPi:~# ping -I wlan0 -c 1 192.168.43.1
PING 192.168.43.1 (192.168.43.1) from 192.168.43.65 wlan0: 56(84) bytes of data.

--- 192.168.43.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

root@DietPi:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1e:06:33:c5:2c brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.113/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::21e:6ff:fe33:c52c/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 74:da:38:26:9d:65 brd ff:ff:ff:ff:ff:ff
    inet 192.168.43.65/24 brd 192.168.43.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::76da:38ff:fe26:9d65/64 scope link
       valid_lft forever preferred_lft forever
Fourdee commented 5 years ago

@frankdugan3

frankdugan3 commented 5 years ago

@Fourdee They are on the same networks. By disabled, do you mean configuration or just pull the plug? It definitely has the issue when eth is unplugged.

Fourdee commented 5 years ago

@frankdugan3

They are on the same networks.

Thanks.

Interesting, what happens if you run these commands (please paste results):

systemctl stop dietpi-wifi-monitor
ifdown wlan0
ifup wlan0
sleep 5
ping -I wlan0 -c 1 $(ip route show 0.0.0.0/0 dev wlan0 | awk '{print $3}')
ip r

By disabled, do you mean configuration or just pull the plug

dietpi-config > Networking > Eth > disable

frankdugan3 commented 5 years ago

@Fourdee Seems like if I disable eth, it has no problem disconnecting/reconnecting with ifup wlan0/ifdown wlan0.

The following was run with eth disabled and auto-reconnect enabled, and after a reboot:

root@ScrumKiosk-01:~# systemctl stop dietpi-wifi-monitor
root@ScrumKiosk-01:~# ifdown wlan0
Removed stale PID file
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/74:da:38:ee:b3:db
Sending on   LPF/wlan0/74:da:38:ee:b3:db
Sending on   Socket/fallback
DHCPRELEASE on wlan0 to 192.168.86.1 port 67
root@ScrumKiosk-01:~# ifup wlan0
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not supported.
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/74:da:38:ee:b3:db
Sending on   LPF/wlan0/74:da:38:ee:b3:db
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPREQUEST of 192.168.86.41 on wlan0 to 255.255.255.255 port 67
DHCPOFFER of 192.168.86.41 from 192.168.86.1
DHCPACK of 192.168.86.41 from 192.168.86.1
bound to 192.168.86.41 -- renewal in 32984 seconds.
root@ScrumKiosk-01:~# sleep 5
root@ScrumKiosk-01:~# ping -I wlan0 -c 1 $(ip route show 0.0.0.0/0 dev wlan0 | awk '{print $3}')
PING 192.168.86.1 (192.168.86.1) from 192.168.86.41 wlan0: 56(84) bytes of data.
64 bytes from 192.168.86.1: icmp_seq=1 ttl=64 time=33.3 ms

--- 192.168.86.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 33.339/33.339/33.339/0.000 ms
root@ScrumKiosk-01:~# ip r
default via 192.168.86.1 dev wlan0 
192.168.86.0/24 dev wlan0 proto kernel scope link src 192.168.86.41 
Fourdee commented 5 years ago

@frankdugan3

Seems like if I disable eth, it has no problem disconnecting/reconnecting with ifup wlan0/ifdown wlan0.

Many thanks for testing 👍

So basically, running both eth and wlan causes wlan to fail any actual connections (eg: ping).

Ok, so we need to rule out if this is a hardware specific issue. I'll run the same tests on RPi, see if we can replicate.

If the issue is limited to C2, we can confirm its a hardware/kernel limitation, outside of our control. If the issue is device wide, we'll try to find a fix :)

Fourdee commented 5 years ago

Ok RPi tests:

Same network:

STATIC

--- 192.168.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 4.859/4.859/4.859/0.000 ms root@DietPi:~# ip route show dev wlan0 192.168.0.0/24 proto kernel scope link src 192.168.0.28


#### Different networks (hotspot)
DHCP
- 🈴 Ping fails

root@DietPi:~# ping -I wlan1 -c 1 192.168.43.1 PING 192.168.43.1 (192.168.43.1) from 192.168.43.146 wlan1: 56(84) bytes of data


- 🈴 No gateway from ``` ip route```

---

So it appears routing is limited, when 2 adapters are connecting. Only ```eth``` is usable, unless the ```wlan``` is on same network, which can route through ```eth```?.
Fourdee commented 5 years ago

So issue appears device wide.

Seems solution is to setup a routing table: https://askubuntu.com/questions/868942/how-to-configure-2-network-interfaces-with-different-gateways

However, I do not know enough about it, to implement it at this time.

The current solution, is to ensure only 1 hardware network device is enabled. EG: once WiFi is setup, disable the ethernet device via dietpi-config.

frankdugan3 commented 5 years ago

OK, thanks for digging deep into it!

MichaIng commented 5 years ago

@frankdugan3 @Fourdee To go forward with this, perhaps workaround for v6.17:

As long as we cannot provide a real fix, perhaps then we should workaround:

Fourdee commented 5 years ago

@MichaIng

WiFi + Ethernet being enabled

Yep, the issue is no routing table being applied once setup. So the system has no idea which device to use. We used to install a package which allowed for both devices at the same time (cant remember name at the moment), however, this broke in Stretch I believe.

WiFi hotspot works, due to routing table being applied.

If required, when enabling WiFi via dietpi-config, disable Ethernet automatically and the other way round.

This would be the ideal solution, however, will drop current SSH session midpoint, auto reboot?

twikedk commented 5 years ago

I'm not sure if this is a solution and my test is on a RPi not a Ordroid C2 but according to this: https://www.raspberrypi.org/forums/viewtopic.php?p=1073973#p1072266 dhcpcd5 should be able to handle the situation. I replaced isc-dhcp-client with dhcpcd5 and have done a local test and am able to ping on both adapters. If I have misunderstood the issue (I didn't read into it all :-)) then just ignore my input.

miguelpruivo commented 8 months ago

@MichaIng I've been using the DietPI with eth only in a particular subnet, but since I use vlans, I would take advantage of the wlan in the pi4 to connect to a different vlan and use that interface to a set of services, but I've been experiencing issues whule connecting (actually, I was never able to connect to wifi at all). Not sure if it's because I'm already using eth but the errors I am seeing are these:


Listening on LPF/wlan0/dc:a6:32:78:1f:68
Sending on LPF/wlan0/dc:a6:32:78:1f:68
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 16
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
No DHCPOFFERS received.

No working leases in persistent database - sleeping.

Thank you.

Joulinar commented 8 months ago

@miguelpruivo pls stick to your forum post https://dietpi.com/forum/t/cant-connect-to-wifi-with-pi4/18775/3 It doesn't make sense to use this old topic. I doubt your issue is related.