MichaIng / DietPi

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

WIFI Realtek RTL8811AU seen by OS, not configurable in dietpi-config #4387

Closed MDAR closed 2 years ago

MDAR commented 3 years ago

Creating a bug report/issue

Required Information

10.9

Additional Information (if applicable)

Purchased a WiFi USB dongle from Odroid to go with this C4.

From these options, Odroid Connectivity options

I chose this one, which is detected as a Realtek RTL8811AU https://www.odroid.co.uk/odroid-accessories/odroid-connectivity?product_id=870

Steps to reproduce

LSUSB shows the USB device connected

root@openHAB2-C4:~# lsusb
Bus 002 Device 002: ID 2109:0817 VIA Labs, Inc.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0bda:a811 Realtek Semiconductor Corp. RTL8811AU 802.11a/b/g/n/ac WLAN Adapter
Bus 001 Device 003: ID 10cf:0b1b Velleman Components, Inc.
Bus 001 Device 002: ID 2109:2817 VIA Labs, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

But dietpi-config > 7 > WiFi reports that "No supported WiFi hardware was found"

Expected behaviour

I'm not entirely sure, as I've never setup a WiFi device on an SBC, I've only ever added second Ethernet dongles

Extra details

Linux openHAB2-C4 4.9.241-arm64 #1 SMP PREEMPT Thu Feb 25 17:57:15 CET 2021 aarc                                                            h64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
 ─────────────────────────────────────────────────────
 DietPi v7.1.2 : 10:40 - Tue 18/05/21
 ─────────────────────────────────────────────────────
 - Device model : Odroid C4/HC4 (aarch64)
 - CPU temp : 32'C : 89'F (Cool runnings)
 - LAN IP : 192.168.178.72 (eth0)
 - MOTD : Did you know that you can run "dietpi-banner" to change its content?
 ─────────────────────────────────────────────────────

 DietPi Team     : MichaIng (lead), Daniel Knight (founder), Joulinar (support)
 Image by        : DietPi Core Team (pre-image: Meveric)
 Web             : https://dietpi.com | https://twitter.com/DietPi_
 Patreon Legends : Camry2731
 Contribute      : https://dietpi.com/contribute.html
 DietPi Hosting  : Powered by https://myvirtualserver.com

 dietpi-launcher : All the DietPi programs in one place.
 dietpi-config   : Feature rich configuration tool for your device.
 dietpi-software : Select optimized software for installation.
 htop            : Resource monitor.
 cpu             : Shows CPU information and stats.
root@openHAB2-C4:~# dietpi-config
[ INFO ] DietPi-WiFiDB | Applied WiFi DB slot 0 with SSID ""
[ INFO ] DietPi-WiFiDB | Applied WiFi DB slot 1 with SSID ""
[ INFO ] DietPi-WiFiDB | Applied WiFi DB slot 2 with SSID ""
[ INFO ] DietPi-WiFiDB | Applied WiFi DB slot 3 with SSID ""
[ INFO ] DietPi-WiFiDB | Applied WiFi DB slot 4 with SSID ""
[ SUB1 ] DietPi-Services > stop
[  OK  ] DietPi-Services | stop : cron
[  OK  ] DietPi-Services | stop : node-red
[  OK  ] DietPi-Services | stop : smbd
[  OK  ] DietPi-Services | stop : nmbd
[ SUB1 ] DietPi-Set_hardware > wifimodules (enable)
[ INFO ] DietPi-Set_hardware | Please wait, enabling WiFi modules...
[ INFO ] DietPi-Set_hardware | Checking for required APT packages: iw wireless-t                                                            ools crda wpasupplicant
[ INFO ] DietPi-Set_hardware | Flagged for install: iw
[ INFO ] DietPi-Set_hardware | Flagged for install: wireless-tools
[ INFO ] DietPi-Set_hardware | Flagged for install: crda
[ INFO ] DietPi-Set_hardware | Flagged for install: wpasupplicant
[ INFO ] DietPi-Set_hardware | APT update, please wait...
Hit:1 https://deb.debian.org/debian buster InRelease
Hit:2 https://deb.debian.org/debian buster-updates InRelease
Hit:3 https://deb.debian.org/debian-security buster/updates InRelease
Hit:4 https://dietpi.com/meveric all InRelease
Hit:5 https://deb.debian.org/debian buster-backports InRelease
Hit:6 https://dietpi.com/meveric buster InRelease
Hit:7 https://openhab.jfrog.io/openhab/openhab-linuxpkg testing InRelease
Reading package lists...
[  OK  ] DietPi-Set_hardware | APT update
[ INFO ] DietPi-Set_hardware | APT install for: iw wireless-tools crda wpasuppli                                                            cant, please wait...
Selecting previously unselected package libnl-3-200:arm64.
(Reading database ... 50197 files and directories currently installed.)
Preparing to unpack .../0-libnl-3-200_3.4.0-1_arm64.deb ...
Unpacking libnl-3-200:arm64 (3.4.0-1) ...
Selecting previously unselected package libnl-genl-3-200:arm64.
Preparing to unpack .../1-libnl-genl-3-200_3.4.0-1_arm64.deb ...
Unpacking libnl-genl-3-200:arm64 (3.4.0-1) ...
Selecting previously unselected package wireless-regdb.
Preparing to unpack .../2-wireless-regdb_2016.06.10-1_all.deb ...
Unpacking wireless-regdb (2016.06.10-1) ...
Selecting previously unselected package iw.
Preparing to unpack .../3-iw_5.0.1-1_arm64.deb ...
Unpacking iw (5.0.1-1) ...
Selecting previously unselected package crda.
Preparing to unpack .../4-crda_3.18-1_arm64.deb ...
Unpacking crda (3.18-1) ...
Selecting previously unselected package libiw30:arm64.
Preparing to unpack .../5-libiw30_30~pre9-13_arm64.deb ...
Unpacking libiw30:arm64 (30~pre9-13) ...
Selecting previously unselected package libnl-route-3-200:arm64.
Preparing to unpack .../6-libnl-route-3-200_3.4.0-1_arm64.deb ...
Unpacking libnl-route-3-200:arm64 (3.4.0-1) ...
Selecting previously unselected package wireless-tools.
Preparing to unpack .../7-wireless-tools_30~pre9-13_arm64.deb ...
Unpacking wireless-tools (30~pre9-13) ...
Selecting previously unselected package wpasupplicant.
Preparing to unpack .../8-wpasupplicant_2%3a2.7+git20190128+0c1e29f-6+deb10u3_ar                                                            m64.deb ...
Unpacking wpasupplicant (2:2.7+git20190128+0c1e29f-6+deb10u3) ...
Setting up wireless-regdb (2016.06.10-1) ...
Setting up libnl-3-200:arm64 (3.4.0-1) ...
Setting up libiw30:arm64 (30~pre9-13) ...
Setting up wireless-tools (30~pre9-13) ...
Setting up libnl-route-3-200:arm64 (3.4.0-1) ...
Setting up libnl-genl-3-200:arm64 (3.4.0-1) ...
Setting up iw (5.0.1-1) ...
Setting up crda (3.18-1) ...
Setting up wpasupplicant (2:2.7+git20190128+0c1e29f-6+deb10u3) ...
Created symlink /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service → /lib/sy                                                            stemd/system/wpa_supplicant.service.
Created symlink /etc/systemd/system/multi-user.target.wants/wpa_supplicant.servi                                                            ce → /lib/systemd/system/wpa_supplicant.service.
Processing triggers for libc-bin (2.28-10) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for dbus (1.12.20-0+deb10u1) ...
[  OK  ] DietPi-Set_hardware | APT install for: iw wireless-tools crda wpasuppli                                                            cant
[  OK  ] wifimodules enable | Completed
[  OK  ] DietPi-Config | Dropping connections, please wait...
[ INFO ] DietPi-Config | Restarting network, please wait...
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:1e:06:48:30:a6
Sending on   LPF/eth0/00:1e:06:48:30:a6
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPOFFER of 192.168.178.72 from 192.168.178.1
DHCPREQUEST for 192.168.178.72 on eth0 to 255.255.255.255 port 67
DHCPACK of 192.168.178.72 from 192.168.178.1
bound to 192.168.178.72 -- renewal in 363429 seconds.
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
ifup: failed to bring up wlan0
[ SUB1 ] DietPi-Services > start
[  OK  ] DietPi-Services | start : nmbd
[  OK  ] DietPi-Services | start : smbd
[  OK  ] DietPi-Services | start : node-red
[  OK  ] DietPi-Services | start : cron
[ INFO ] DietPi-Config | Reloading networking data, please wait...
[  OK  ] DietPi-Config | Network restarted
[..    ] DietPi-Config | Checking URL: https://dietpi.com (1/2)
[  OK  ] DietPi-Config | Checking URL: https://dietpi.com
root@openHAB2-C4:~# lsusb
Bus 002 Device 002: ID 2109:0817 VIA Labs, Inc.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0bda:a811 Realtek Semiconductor Corp. RTL8811AU 802.11a/b/g/n/ac WLAN Adapter
Bus 001 Device 003: ID 10cf:0b1b Velleman Components, Inc.
Bus 001 Device 002: ID 2109:2817 VIA Labs, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@openHAB2-C4:~# inxi -Fxz
System:    Host: openHAB2-C4 Kernel: 4.9.241-arm64 aarch64 bits: 64 compiler: gcc v: 6.3.0 Console: tty 0
           Distro: Debian GNU/Linux 10 (buster)
Machine:   Type: ARM Device System: Hardkernel ODROID-C4 rev: 0500 serial: <filter>
CPU:       Topology: Quad Core model: N/A variant: cortex-a53 bits: 64 type: MCP arch: ARMv8 rev: 0500
           features: Use -f option to see features bogomips: 0
           Speed: 100 MHz min/max: 100/1908 MHz Core speeds (MHz): 1: 500 2: 500 3: 500 4: 500
Graphics:  Device-1: amhdmitx driver: amhdmitx v: N/A bus ID: N/A
           Device-2: meson-g12a driver: meson_fb v: N/A bus ID: N/A
           Device-3: g12a-sound-card driver: asoc_aml_card v: N/A bus ID: N/A
           Display: tty server: X.org 1.20.4 driver: none tty: 140x24
           Message: Advanced graphics data unavailable in console for root.
Audio:     Device-1: audio- driver: aml_audio_controller bus ID: N/A
           Device-2: snd-iomap driver: auge_snd_iomap bus ID: N/A
           Device-3: sm1-audio-clocks driver: audio_clocks bus ID: N/A
           Device-4: sm1-audio-ddr-manager driver: audio_ddr_manager bus ID: N/A
           Device-5: sm1-snd-spdif-a driver: snd_spdif bus ID: N/A
           Device-6: amhdmitx driver: amhdmitx bus ID: N/A
           Device-7: audio_data driver: audio_data_debug bus ID: N/A
           Device-8: audiolocker driver: audiolocker bus ID: N/A
           Device-9: g12a-sound-card driver: asoc_aml_card bus ID: N/A
           Device-10: vdac-sm1 driver: aml_vdac bus ID: N/A
           Sound Server: ALSA v: k4.9.241-arm64
Network:   Device-1: g12a-eth-dwmac driver: meson6_dwmac v: N/A port: N/A bus ID: N/A
           IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
           Device-2: Realtek RTL8811AU 802.11a/b/g/n/ac WLAN Adapter type: USB driver: usb-network bus ID: 1-1.3:4
Drives:    Local Storage: total: 14.56 GiB used: 3.18 GiB (21.8%)
           ID-1: /dev/mmcblk0 model: AJTD4R size: 14.56 GiB
Partition: ID-1: / size: 13.96 GiB used: 3.11 GiB (22.3%) fs: ext4 dev: /dev/mmcblk0p2
           ID-2: /boot size: 255.7 MiB used: 71.1 MiB (27.8%) fs: vfat dev: /dev/mmcblk0p1
Sensors:   Missing: Required tool sensors not installed. Check --recommends
Info:      Processes: 132 Uptime: 12m Memory: 3.63 GiB used: 748.9 MiB (20.2%) Init: systemd runlevel: 5 Compilers: gcc: 8.3.0
           Shell: bash v: 5.0.3 inxi: 3.0.32
wirelessjimp commented 2 years ago

Wow! Thanks for the hard work. I will be busy the rest of the afternoon, I will check in this evening.

MichaIng commented 2 years ago
sudo make dkms_remove
sudo apt -y install linux-dtb-edge-meson64 linux-headers-edge-meson64 linux-image-edge-meson64 linux-u-boot-odroidn2-edge
. /usr/lib/u-boot/platform_install.sh
sudo write_uboot_platform "$DIR" "$(lsblk -no PKNAME "$(findmnt -no SOURCE /)")"
sudo reboot
# after reboot
sudo apt -y purge linux-dtb-current-meson64 linux-headers-current-meson64 linux-image-current-meson64

You could check now whether the driver shipped by the new kernel works, else again:

cd rtl8812au*
sudo make dkms_install
modprobe 88XXau

Now it works. So it looks like the recent version of this driver is not compatible with Linux v5.10 anymore. Additional hassle causes, that even if the internal version string suffix has been raised to 20220715, the driver still reports v5.6.4.2_35491.20191025, matching the one shipped with the kernel, so that DKMS is not installing the new one without passing the --force option.

wirelessjimp commented 2 years ago

Unfortunately when I was able to try it this morning, I came up with this error when trying to install the packages:

root@DietPi:~/rtl8812au# sudo apt -y install linux-dtb-next-meson64 linux-headers-next-meson64 linux-image-next-meson64 linux-u-boot-odroidn2-edge. /usr/lib/u-boot/platform_install.sh
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package linux-dtb-next-meson64
E: Unable to locate package linux-headers-next-meson64
E: Unable to locate package linux-image-next-meson64
MichaIng commented 2 years ago

Ah sorry, it's "edge", not "next" in the package names. I edited it above.

wirelessjimp commented 2 years ago

I have somehow managed to mangle the build so I need to wipe the install and start over fresh. Do I need to start from your comment from yesterday with the "fresh Odroid N2" steps or from the steps from today?

wirelessjimp commented 2 years ago

Latest update. After getting stuck I went ahead and rebooted, and the RTL8812au card was working! The desktop, ssh, and xrdp were broken and didn't work, but the card was working. So, in an effort to start over fresh, I wiped the card and reinstalled. Went through the normal start-up and initial config stuff, and the card didn't work. So, I started over with the install part of the packages that were renamed to edge. That worked fine. Then, this happened:

root@DietPi:~# sudo write_uboot_platform "$DIR" "$(lsblk -no PKNAME "$(findmnt -no SOURCE /)")"
sudo: write_uboot_platform: command not found

I went ahead and rebooted the board as that was the next step. I had the rtl8812au card plugged in and upon reboot, it got a blue light on it which tells me it is working. Almost too well. I had to unplug it to gain access to the device through the Ethernet. Once back in I was able to run the last command to purge the packages, and now I can see this:

root@DietPi:~# iw wlan0 info
Interface wlan0
    ifindex 3
    wdev 0x1
    addr 00:c0:ca:ac:42:c3
    type managed
    wiphy 0
    channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz
    txpower 20.00 dBm

I still need to do some more work to make sure the adapter is working as intended, but this is a very promising step in the right direction! I'll update here after I do more testing.

MichaIng commented 2 years ago

write_uboot_platform is part of the sourced script the line before on the instructions. However/obviously, likely it is not needed. Older U-Boot usually works with newer kernel as well.

So the WiFi adapter is working now without compiling it via dkms? Or did you do that as well? Probably it got updated on edge kernel, fixing the issue.

wirelessjimp commented 2 years ago

The dkms compile didn't work, but I also didn't need to do it. After I purged the packages I started to investigate the operation. When I went to dietpi-config and looked at the network adapters, it showed an active interface so I never went back to do those final three commands.

I have also been able to confirm that the adapter works as intended and can scan both bands. I can also put it into monitor mode (my primary intention) and it works well in scanning all the spectrum the chip can support. I haven't tried packet or frame injection but I will try that eventually. For most people, I think this is all they would need to make the rtl8812au chip work, at least for the time being.

sudo apt -y install linux-dtb-edge-meson64 linux-headers-edge-meson64 linux-image-edge-meson64 linux-u-boot-odroidn2-edge . /usr/lib/u-boot/platform_install.sh
sudo reboot
# after reboot
sudo apt -y purge linux-dtb-current-meson64 linux-headers-current-meson64 linux-image-current-meson64

Just to put a final bow on this instance, this is what I am running currently:

DietPi v8.7.1
Odroid C4/HC4 (aarch64)
$ uname -a
Linux DietPi 5.17.5-meson64 #22.05.1 SMP PREEMPT Sat May 28 08:20:29 UTC 2022 aarch64 GNU/Linux
MichaIng commented 2 years ago

Okay great, so it has been resolved with edge kernel already 🙂. It may still take a while until this gets merged into "current" kernel branch, so I leave this open. On Linux 5.10 an older version of the driver sources should build successfully, but we can find this out when someone else is landing here and moving to "edge" is not an option.

MichaIng commented 2 years ago

I'm going to close this. There was quite some back and forth with the 88XXau/88XXcu kernel driver in Armbian edge kernels, but now they reliable work with my RTL8811CU adapters.

I only hope it does not break again with Linux 6.0: https://github.com/aircrack-ng/rtl8812au/issues/1006, https://github.com/aircrack-ng/rtl8812au/pull/1008

Better maintained and on newer branch seems to be: https://github.com/morrownr/8821au-20210708 Probably we can suggest to Armbian to switch.

A pain that these drivers are not maintained upstream as part of Linux kernel itself, so that it does not rely on reports and fixes from the community when running into compiling issues with newer Linux versions...