No Wifi reconnect after AP disabled

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
74cmonty
Posts: 18
Joined: Tue Jan 15, 2019 5:25 pm

No Wifi reconnect after AP disabled

Post by 74cmonty »

Hi,
I have configured network with Wifi to Eth brigde setup; I basically followed this guide.

In general this is working, however there's an issue when AP goes down for +8hrs, means Wifi is disabled.
After AP is enabled again Raspi is not reconnecting to Wifi.

Searching for a solution in internet the most common solution is this:
1. Install package ifplugd
2. Copy file /etc/wpa_supplicant/ifupdown.sh to /etc/ifplugd/action.d/ifupdown
3. Define ifplugd configuration in this file /etc/default/ifplugd with this content:

Code: Select all

INTERFACES="all"                                                              
HOTPLUG_INTERFACES="eth0"
ARGS="-q -f -u0 -d10 -w -I"                                                   
SUSPEND_ACTION="none"
4. Reboot Raspi

I have created a symlink in /etc/ifplugd/action.d/ with this command:

Code: Select all

cd /etc/ifplugd/action.d/
ln -s /etc/wpa_supplicant/ifupdown.sh ifupdown
Unfortunately this solution is not working.

Do you have any idea how to fix it?

THX
Last edited by 74cmonty on Sat Jun 08, 2019 10:57 am, edited 2 times in total.
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

Re: No Wifi reconnect after AP disabled

Post by MichaIng »

Did you actually install the ifplugd package? G_AGI ifplugd

You can also enable DietPi-WiFi-Monitor via dietpi-config which will check WiFi connection every 10 seconds and in case try to reconnect. But since you did some custom network setup, be careful before hitting any "Apply" within dietpi-config since it overwrites /etc/network/interfaces.

With yesterday released v6.23 we implemented to possibility to add custom drop-in configs via /etc/network/interfaces.d/. That might generally resolve issues with dietpi-config overwriting custom network settings.
74cmonty
Posts: 18
Joined: Tue Jan 15, 2019 5:25 pm

Re: No Wifi reconnect after AP disabled

Post by 74cmonty »

Hello,

I installed package ifplugd from stretch repo:

Code: Select all

root@pc9-fhem:~# apt-cache policy ifplugd
ifplugd:
  Installiert:           0.28-19.2
Can you please share some details how dietpi-config which will check WiFi connection every 10 seconds?
Is this done with cron-job?

THX
74cmonty
Posts: 18
Joined: Tue Jan 15, 2019 5:25 pm

Re: No Wifi reconnect after AP disabled

Post by 74cmonty »

MichaIng wrote: Mon May 13, 2019 3:36 pm You can also enable DietPi-WiFi-Monitor via dietpi-config which will check WiFi connection every 10 seconds and in case try to reconnect. But since you did some custom network setup, be careful before hitting any "Apply" within dietpi-config since it overwrites /etc/network/interfaces.
Where can I enable DietPi-WiFi-Monitor?
I didn't find anything in dietpi-config.
74cmonty
Posts: 18
Joined: Tue Jan 15, 2019 5:25 pm

Re: [Solved] No Wifi reconnect after AP disabled

Post by 74cmonty »

Enabled service dietpi-wifi-monitor.
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

Re: [Solved] No Wifi reconnect after AP disabled

Post by MichaIng »

@74cmonty
dietpi-config > Network Options: Adapters > WiFi > WiFi Monitor (or similar)
74cmonty
Posts: 18
Joined: Tue Jan 15, 2019 5:25 pm

Re: [Solved] No Wifi reconnect after AP disabled

Post by 74cmonty »

Hello!
I have enabled dietpi-wifi-monitor.

This bash script is checking for a working connection to the router, and if this fails triggers

Code: Select all

ifdown $ADAPTER
sleep 1
ifup $ADAPTER
However this is not working with my Raspi.

There's no general issue with Wifi connection of my Raspi using this device:

Code: Select all

root@pc9-fhem:~# lsusb | grep WLAN
Bus 001 Device 006: ID 0bda:8172 Realtek Semiconductor Corp. RTL8191SU 802.11n WLAN Adapter
This means Raspi is booting w/o errors, and the Wifi connection is working w/o any issues.

Code: Select all

root@pc9-fhem:~# dmesg | grep 8712
[   12.307140] r8712u: module is from the staging directory, the quality is unknown, you have been warned.
[   12.602489] r8712u: register rtl8712_netdev_ops to netdev_ops
[   12.602532] usb 1-1.5: r8712u: USB_SPEED_HIGH with 4 endpoints
[   12.630273] usb 1-1.5: r8712u: Boot from EFUSE: Autoload OK
[   15.166884] usb 1-1.5: r8712u: CustomerID = 0x000a
[   15.166914] usb 1-1.5: r8712u: MAC Address from efuse = 24:05:0f:9a:4b:55
[   15.166928] usb 1-1.5: r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
[   15.167958] usbcore: registered new interface driver r8712u
[   28.113946] r8712u 1-1.5:1.0 wlan0: 1 RCR=0x153f00e
[   28.114698] r8712u 1-1.5:1.0 wlan0: 2 RCR=0x553f00e
The required kernel module is loaded

Code: Select all

root@pc9-fhem:~# lsmod | grep 8712
r8712u                182711  0
and iwconfig confirms a working connection

Code: Select all

root@pc9-fhem:~# iwconfig
eth0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"wlanAP_nomap"  Nickname:"rtl_wifi"
          Mode:Managed  Frequency:2.437 GHz  Access Point: C8:0E:14:xx:xx:xx
          Bit Rate:150 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=98/100  Signal level=98/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.
The issue is reproducible by deactivating Wifi for +1hr; in my apartment Wifi is off every day from 0:00h to 7:00h.

There are 2 potential workarounds for this issue:
1. Enable Wifi 24/7
2. Setup a cronjob to reboot Raspi daily after 7:00h

But there must be a sustainable solution because Wifi connection is generally working after reboot.
Maybe I must trigger the steps that are executed during boot to startup network manually.

Please advise.

THX
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

Re: No Wifi reconnect after AP disabled

Post by MichaIng »

@74cmonty
Got it, jep in this case WiFi monitor is no solution, leave it disabled or disabled it again if you tried so. I would just be an unnecessary overload.

I think the cron job is the best shot. Run it e.g. on 07:05 with:

Code: Select all

ifdown wlan0
sleep 1
ifup wlan0
Or is this what does not work, so currently a reboot is required to make it connect again?
In this case:

Code: Select all

ip a
ip r
Are a start to debug.
Post Reply