WIFI switches off when not in use

Hello, everyone,

an unofficial Armbian image (version 5.41) is installed on my BananaPI M2 Zero.

If I have connected Ethernet to the BananaPI via the Ethernet PINs, the network connection will always remain. If I have connected the BananaPI to the network via WLAN, then the connection will be disconnected after a few minutes, if one does not actively communicate with the BananaPI via e.g. SSH.

– Contents of the interfaces file –

    source /etc/network/interfaces.d/*
    # Wired adapter #1
    allow-hotplug eth0
    no-auto-down eth0
    iface eth0 inet dhcp
    #address 192.168.0.100
    #netmask 255.255.255.0
    #gateway 192.168.0.1
    #dns-nameservers 8.8.8.8 8.8.4.4
    #       hwaddress ether # if you want to set MAC manually
    #       pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838


    # Wireless adapter #1
    # Armbian ships with network-manager installed by default. To save you time
    # and hassles consider using 'sudo nmtui' instead of configuring Wi-Fi settings
    # manually. The below lines are only meant as an example how configuration could
    # be done in an anachronistic way:
    #
    #allow-hotplug wlan0
    #iface wlan0 inet dhcp
    #address 192.168.0.100
    #netmask 255.255.255.0
    #gateway 192.168.0.1
    #dns-nameservers 8.8.8.8 8.8.4.4
    #   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    # Disable power saving on compatible chipsets (prevents SSH/connection dropouts over WiFi)
    #wireless-mode Managed
    #wireless-power off
    #no-auto-down wlan0

    # Local loopback
    auto lo
    iface lo inet loopback

– End of interfaces-file –

Could someone help me or send me a tutorial on this subject? I would be very grateful!

Many thanks in advance and with kind regards,

Lukas

Try to uncomment

wireless-mode Managed

and reboot.

Edit: now that I look better at your interfaces file, it looks a bit different than mine. I have a full configuration for wlan0 (wpa-psk), and when I experienced connection issues, wireless-mode managed solved the problem. Try to configure your wlan0 via this file… when I’m at home I’ll post mine.

Hello, Namero999, unfortunately the uncommenting of the “wireless-mode” did not bring any change.

Could you please send your interface file on occasion so that I can compare it with my file?

Many thanks in advance, Lukas

First of all, one thing you should know is that I’m using this image

This dude is a hero and he’s building minimal images for the banana zero which are way better than the official ones. I just noticed that he released a new one on kernel 5.x, but I have not yet tried it.

So, this is my interfaces file

ubuntu@bpi-m2z:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
##allow-hotplug eth0
##no-auto-down eth0
##iface eth0 inet static
##address 192.168.0.100
##netmask 255.255.0.0
##gateway 192.168.254.254
##dns-nameservers 8.8.8.8 8.8.4.4

allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-ssid <redacted>
        wpa-psk <redacted>
        dns-nameservers 8.8.8.8 8.8.4.4
        wireless-power off
        wireless-mode managed

#address 192.168.254.55
#netmask 255.255.0.0
#gateway 192.168.254.254
#dns-nameservers 8.8.8.8 8.8.4.4
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
# Disable power saving on compatible chipsets (prevents SSH/connection dropouts over WiFi)
#wireless-mode Managed
#wireless-power off

By default, wireless-power and wireless-mode are not there, I added them myself because of network issues, I assume power saving kicking in as suggested by the comment at the end of the file.

Before, network would slow down to few-bits-per-second level and then hang completely. By adding those lines, I could stream from my wlan at >3 Mb/s steady.

If this has no effect on your distro, maybe it’s because your network is not configured via /etc/network/interfaces but by another mean, such as wpa_supplicant. In that case, I’m not sure I can help you, but I would probably search the correct file (probably under /etc/wpa*) where to disable wlan power management.

Otherwise, you could try the images from github I linked to you, the last one based on kernel 4.x works great!