Search code examples
raspberry-pishutdownwifipower-off

How to get Raspberry Pi‘s wlan1 interface work after poweroff?


I plugged an additional wifi connector in my Raspberry Pi 3B+. I can‘t see the interface of the additional connector after plugging my Raspberry Pi out of power or use sudo poweroff for save shutdown. But after sudo reboot the wifi connector is visible after typing sudo iwconfig in the terminal.

My /etc/network/interfaces contains:

source-directory /etc/network/interfaces.d
auto lo 
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
    post-up iw dev $IFACE set power_save off
auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
    post-up iw dev $IFACE set power_save off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

My /etc/modules contains:

i2c-dev
bcm2835_wdt
# r8712u # this driver makes problems 
r92su

The internal WiFi adapter in my Raspberry Pi 3 b+ is a broadcom and my external WiFi adapter is a Realtek RTL8191SU.

I tried already to shut down the power save mode of the wlan adapter:

post-up iw dev wlan1 set power_save off

EDIT:

Networking.service:

systemctl status networking.service

Returns: Failed to initialize control interface 'DIR=/var/run/wpa_supplicant GROUP=netdev'. You may have another wpa_supplicant process already running or the file was left by an unclean termination of wpa_supplicant in which case you will need to manually remove this file before.

EDIT 2: My WLAN connected after

sudo killall wpa_supplicant
sudo poweroff

Shutdown the stream and start Raspberry Pi and it works nice, but if I do this and remove a usb mouse and keyboard it won‘t connect with the wifi. It looks like there is a start problem with usb connectors of the Pi.

EDIT 3:

There seems to be a bug in the system with the USB connection and the current distribution. Every time I remove the usb mouse and keyboard, the wlan usb adapter is no longer activated.

EDIT 4:

It could also be a driver problem for rtl8191su and therefor r8712u. My post on the raspberry pi forum: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=230193&p=1410456&hilit=wlan1#p1410456

EDIT 5: I tried already https://www.raspberrypi.org/forums/viewtopic.php?t=191844 , but after i did this my system won‘t boot correctly and the broadcom internal wlan adapter won‘t work correctly. After this i got wlan0 and wlan1 but both were the same network adapters connected to the same wlan (strange). So the problem is not fixed until now!

How to get Raspberry Pi‘s wlan1 interface work after shut down the stream and start the Raspberry Pi?


Solution

  • I got the solution for this problem:

    First load the module (driver) for your usb wlan adapter after the internal chip adapter. In this example case, I got the RTL8191SU with the sudo apt-get install firmware-realtek and therefor r8712u driver.

    sudo nano /etc/modprobe.d/wlan-blacklist.conf
    

    Edit wlan-blacklist.conf like this:

    blacklist r8712u
    

    After this run:

    sudo depmod -ae
    sudo update-initramfs -u
    sudo nano /etc/modules
    

    Edit modules like this:

    i2c-dev
    brcmfmac
    r8712u
    

    Now load the r8712u module a little bit later after the internal wlan chip of the Raspberry Pi 3b+:

    sudo nano /etc/crontab
    

    Add line to crontab:

    @reboot root (sleep 20; modprobe r8712u) &
    

    Now have a right interfaces file:

    sudo nano /etc/network/interfaces
    

    wlan1 is the realtek wlan adapter and wlan0 the internal broadcom wlan chip:

    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet dhcp
    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet manual
    post-up iw dev wlan0 set power_save off
    auto wlan1
    allow-hotplug wlan1
    iface wlan1 inet dhcp
    post-up iw dev wlan1 set power_save off
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet manual
    

    It is really important, that the default interface is manual!

    sudo reboot 
    

    or

    sudo poweroff
    

    Both of these commands will let the wifi configured correctly. Even if I turn off the raspberry pi and then boot again.

    Enjoy your second wlan adapter!