Joshua-Riek / ubuntu-rockchip

Ubuntu 22.04 and 24.04 for Rockchip RK35XX Devices
https://joshua-riek.github.io/ubuntu-rockchip-download/
GNU General Public License v3.0
1.89k stars 206 forks source link

Intermittent wifi connectivity issues with Orange PI 5 Plus #650

Open dsburns opened 4 months ago

dsburns commented 4 months ago

I'm observing an intermittent bug with the wifi module shown here - https://a.co/d/3ICOnOR.

It appears as though the device has two interfaces (wlan0 and wlan1, each with a unique mac address) and systemd will randomly select one of the wlan* device at boot to enumerate as wlP2p33s0. Both devices are able to receive a DHCP address, but wlan1 cannot be ping'd or receive any inbound connections. The wlan0 interface works as expected.

In the lshw output below - the wlan0 interface was enumerated as wlP2p33s0 at boot.

lshw -c network *-network description: Wireless interface product: Realtek Semiconductor Co., Ltd. vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0002:21:00.0 logical name: wlP2p33s0 version: 00 serial: 40:9c:a7:0d:86:79 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=rtl8852be driverversion=v1.15.10.0.5-0-gfa2af07cf.20220 firmware=N/A ip=192.168.1.99 latency=0 link=yes multicast=yes wireles s=IEEE 802.11AX resources: irq:281 ioport:300000(size=256) memory:f2200000-f22fffff *-network description: Ethernet interface product: RTL8125 2.5GbE Controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0003:31:00.0 logical name: enP3p49s0 version: 05 serial: c0:74:2b:fe:e8:b7 capacity: 1Gbit/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8125 driverversion=9.009.00-NAPI-RSS latency=0 link=no multicast=yes port=twisted pair resources: irq:207 ioport:100000(size=256) memory:f3200000-f320ffff memory:f3210000-f3213fff *-network description: Ethernet interface product: RTL8125 2.5GbE Controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0004:41:00.0 logical name: enP4p65s0 version: 05 serial: c0:74:2b:fe:e8:b6 capacity: 1Gbit/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8125 driverversion=9.009.00-NAPI-RSS latency=0 link=no multicast=yes port=twisted pair resources: irq:164 ioport:1000(size=256) memory:f4200000-f420ffff memory:f4210000-f4213fff *-network DISABLED description: Wireless interface physical id: 17 bus info: pci@0002:21:00.0 logical name: wlan1 serial: 42:9c:a7:0d:86:79 capabilities: ethernet physical wireless configuration: broadcast=yes driver=rtl8852be driverversion=v1.15.10.0.5-0-gfa2af07cf.20220 firmware=N/A link=no multicast=yes wireless=unassociated

Additionally, the working device hangs off a PCI node.

lshw *-pci:1 description: PCI bridge product: Rockchip Electronics Co., Ltd vendor: Rockchip Electronics Co., Ltd physical id: 101 bus info: pci@0002:20:00.0 version: 01 width: 32 bits clock: 33MHz capabilities: pci pm msi pciexpress msix normal_decode bus_master cap_list rom configuration: driver=pcieport resources: irq:261 memory:f2300000-f230ffff ioport:300000(size=4096) memory:f2200000-f22fffff *-network description: Wireless interface product: Realtek Semiconductor Co., Ltd. vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0002:21:00.0 logical name: wlP2p33s0 version: 00 serial: 40:9c:a7:0d:86:79 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=rtl8852be driverversion=v1.15.10.0.5-0-gfa2af07cf.20220 firmware=N/A ip=192.168.1.99 latency=0 link=yes multicast=yes wireless=IEEE 802.11AX resources: irq:281 ioport:300000(size=256) memory:f2200000-f22fffff

Where as the non-working interface hangs directly off the motherboard.

lshw *-core description: Motherboard physical id: 0 ... *-network DISABLED description: Wireless interface physical id: 17 bus info: pci@0002:21:00.0 logical name: wlan1 serial: 42:9c:a7:0d:86:79 capabilities: ethernet physical wireless configuration: broadcast=yes driver=rtl8852be driverversion=v1.15.10.0.5-0-gfa2af07cf.20220 firmware=N/A link=no multicast=yes wireless=unassociated

Additinally, there are errors during boot where networkd is trying to rename both devices to the same wlP2p33s0 name

journalctl output *-pci:1 Mar 04 20:04:14 ubuntu systemd[1]: Started Getty on tty1. Mar 04 20:04:14 ubuntu systemd[1]: Reached target Login Prompts. Mar 04 20:04:14 ubuntu systemd[1]: Cannot find unit for notify message of PID 750, ignoring. Mar 04 20:04:14 ubuntu apport[745]: ...done. Mar 04 20:04:14 ubuntu systemd[1]: Starting Time & Date Service... Mar 04 20:04:14 ubuntu systemd[1]: Started LSB: automatic crash report generation. Mar 04 20:04:14 ubuntu networkd-dispatcher[765]: wlan0 No such device Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: ERROR:Error handling notification for interface 'wlan0' entering operational state off Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: Traceback (most recent call last): Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 334, in _handle_one_state Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: self.run_hooks_for_state(new_iface, state) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 365, in run_hooks_for_state Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: data = get_interface_data(iface) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 256, in get_interface_data Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: data['ESSID'] = get_wlan_essid(iface.name) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 144, in get_wlan_essid Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: return iwconfig_get_ssid(iface_name) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 160, in iwconfig_get_ssid Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: out = subprocess.check_output([IWCONFIG, '--', iface_name]) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/lib/python3.10/subprocess.py", line 421, in check_output Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/lib/python3.10/subprocess.py", line 526, in run Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: raise CalledProcessError(retcode, process.args, Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: subprocess.CalledProcessError: Command '['/usr/sbin/iwconfig', '--', 'wlan0']' returned non-zero exit status 237. Mar 04 20:04:14 ubuntu systemd[1]: Started Dispatcher daemon for systemd-networkd. Mar 04 20:04:14 ubuntu systemd-networkd[480]: wlP2p33s0: Link DOWN Mar 04 20:04:14 ubuntu sshd[779]: Server listening on 0.0.0.0 port 22. Mar 04 20:04:14 ubuntu sshd[779]: Server listening on :: port 22. Mar 04 20:04:14 ubuntu systemd[1]: Started OpenBSD Secure Shell server. Mar 04 20:04:14 ubuntu chronyd[789]: chronyd version 4.2 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 -DEBUG) Mar 04 20:04:14 ubuntu chronyd[789]: Frequency 10.469 +/- 20.922 ppm read from /var/lib/chrony/chrony.drift Mar 04 20:04:14 ubuntu chronyd[789]: Using right/UTC timezone to obtain leap second data Mar 04 20:04:14 ubuntu chronyd[789]: Loaded seccomp filter (level 1) Mar 04 20:04:14 ubuntu systemd[1]: Started chrony, an NTP client/server. Mar 04 20:04:14 ubuntu systemd[1]: Reached target System Time Synchronized. Mar 04 20:04:14 ubuntu systemd[1]: Started Daily apt download activities. Mar 04 20:04:14 ubuntu systemd[1]: Started Daily apt upgrade and clean activities. Mar 04 20:04:14 ubuntu systemd[1]: Started Daily atop restart. Mar 04 20:04:14 ubuntu systemd[1]: Started Daily dpkg database backup timer. Mar 04 20:04:14 ubuntu systemd[1]: Started Periodic ext4 Online Metadata Check for All Filesystems. Mar 04 20:04:14 ubuntu systemd[1]: Started Discard unused blocks once a week. Mar 04 20:04:14 ubuntu systemd[1]: Started Refresh fwupd metadata regularly. Mar 04 20:04:14 ubuntu systemd[1]: Started Daily rotation of log files. Mar 04 20:04:14 ubuntu systemd[1]: Started Daily man-db regeneration. Mar 04 20:04:14 ubuntu systemd[1]: Started Message of the Day. Mar 04 20:04:14 ubuntu systemd[1]: Condition check resulted in Timer to automatically fetch and run repair assertions being skipped. Mar 04 20:04:14 ubuntu systemd[1]: Started Check to see whether there is a new version of Ubuntu available. Mar 04 20:04:14 ubuntu systemd[1]: Reached target Timer Units. Mar 04 20:04:14 ubuntu ModemManager[675]: [base-manager] port wlP2p33s0 released by device '/sys/devices/platform/fe170000.pcie/pci0002:20/0002:20:00.0/0002:21:00.0' Mar 04 20:04:14 ubuntu ModemManager[675]: [base-manager] couldn't check support for device '/sys/devices/platform/fe170000.pcie/pci0002:20/0002:20:00.0/0002:21:00.0': Operation was cancelled Mar 04 20:04:14 ubuntu dbus-daemon[607]: [system] Successfully activated service 'org.freedesktop.timedate1' Mar 04 20:04:14 ubuntu systemd[1]: Started Time & Date Service. Mar 04 20:04:14 ubuntu systemd[1]: Finished Wait until snapd is fully seeded. Mar 04 20:04:14 ubuntu systemd[1]: Condition check resulted in Auto import assertions from block devices being skipped. Mar 04 20:04:14 ubuntu networkctl[785]: Interface "wlP2p33s0" not found. Mar 04 20:04:14 ubuntu systemd[1]: networkd-dispatcher.service: Got notification message from PID 785, but reception only permitted for main PID 620 Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: ERROR:Failed to get interface "wlP2p33s0" status: Command '['/usr/bin/networkctl', 'status', '--no-pager', '--no-legend', '--', 'wlP2p33s0']' returned non-zero exit status 1. Mar 04 20:04:14 ubuntu networkd-dispatcher[803]: wlP2p33s0 No such device Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: ERROR:Error handling notification for interface 'wlP2p33s0' entering operational state off Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: Traceback (most recent call last): Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 334, in _handle_one_state Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: self.run_hooks_for_state(new_iface, state) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 365, in run_hooks_for_state Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: data = get_interface_data(iface) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 256, in get_interface_data Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: data['ESSID'] = get_wlan_essid(iface.name) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 144, in get_wlan_essid Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: return iwconfig_get_ssid(iface_name) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/bin/networkd-dispatcher", line 160, in iwconfig_get_ssid Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: out = subprocess.check_output([IWCONFIG, '--', iface_name]) Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/lib/python3.10/subprocess.py", line 421, in check_output Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: File "/usr/lib/python3.10/subprocess.py", line 526, in run Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: raise CalledProcessError(retcode, process.args, Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: subprocess.CalledProcessError: Command '['/usr/sbin/iwconfig', '--', 'wlP2p33s0']' returned non-zero exit status 237. Mar 04 20:04:14 ubuntu kernel: rtkm: ====================== RTKM ====================== Mar 04 20:04:14 ubuntu kernel: rtkm: order use peak alloc+ size Mar 04 20:04:14 ubuntu kernel: rtkm: -------------------------------------------------- Mar 04 20:04:14 ubuntu kernel: rtkm: 1 0 2 4 32768 Mar 04 20:04:14 ubuntu kernel: rtkm: 2 0 0 2 32768 Mar 04 20:04:14 ubuntu kernel: rtkm: 3 0 0 2 65536 Mar 04 20:04:14 ubuntu kernel: rtkm: 4 0 1 4 262144 Mar 04 20:04:14 ubuntu kernel: rtkm: sum 0 3 12 393216 Mar 04 20:04:14 ubuntu kernel: rtkm: rtkm_prealloc_destroy Mar 04 20:04:14 ubuntu kernel: rtkm: rtkm_destroy_phy Mar 04 20:04:14 ubuntu kernel: rtkm: ====================== RTKM ====================== Mar 04 20:04:14 ubuntu kernel: rtkm: order use peak alloc+ size Mar 04 20:04:14 ubuntu kernel: rtkm: -------------------------------------------------- Mar 04 20:04:14 ubuntu kernel: rtkm: 1 0 2 4 32768 Mar 04 20:04:14 ubuntu kernel: rtkm: 2 0 0 2 32768 Mar 04 20:04:14 ubuntu kernel: rtkm: 3 0 0 2 65536 Mar 04 20:04:14 ubuntu kernel: rtkm: 4 0 1 4 262144 Mar 04 20:04:14 ubuntu kernel: rtkm: sum 0 3 12 393216 Mar 04 20:04:14 ubuntu kernel: rtkm: rtkm_prealloc_destroy: done Mar 04 20:04:14 ubuntu kernel: rtkm: rtkm_prealloc_init Mar 04 20:04:14 ubuntu kernel: rtkm: rtkm_init_phy Mar 04 20:04:14 ubuntu kernel: rtkm: rtkm_init_phy: memory expansion:1 Mar 04 20:04:14 ubuntu kernel: rtkm: ====================== RTKM ====================== Mar 04 20:04:14 ubuntu kernel: rtkm: order use peak alloc+ size Mar 04 20:04:14 ubuntu kernel: rtkm: -------------------------------------------------- Mar 04 20:04:14 ubuntu kernel: rtkm: 1 0 0 4 32768 Mar 04 20:04:14 ubuntu kernel: rtkm: 2 0 0 2 32768 Mar 04 20:04:14 ubuntu kernel: rtkm: 3 0 0 2 65536 Mar 04 20:04:14 ubuntu kernel: rtkm: 4 0 0 4 262144 Mar 04 20:04:14 ubuntu kernel: rtkm: sum 0 0 12 393216 Mar 04 20:04:14 ubuntu kernel: rtkm: rtkm_prealloc_init: done ret=0 Mar 04 20:04:14 ubuntu kernel: vendor storage:20190527 ret = -1 Mar 04 20:04:14 ubuntu kernel: eric-tx CALL alloc_txring !!!! Mar 04 20:04:14 ubuntu kernel: eric-tx CALL alloc_txring !!!! Mar 04 20:04:14 ubuntu networkd-dispatcher[620]: WARNING:Unknown index 6 seen, reloading interface list Mar 04 20:04:14 ubuntu systemd-udevd[492]: Using default interface naming scheme 'v249'. Mar 04 20:04:14 ubuntu kernel: rtl8852be 0002:21:00.0 wlP2p33s0: renamed from wlan0 Mar 04 20:04:14 ubuntu systemd[1]: rtl8852be-reload.service: Deactivated successfully. Mar 04 20:04:14 ubuntu systemd[1]: Finished Reload RTL8852BE. Mar 04 20:04:14 ubuntu systemd[1]: Reached target Multi-User System. Mar 04 20:04:14 ubuntu systemd[1]: Reached target Graphical Interface. Mar 04 20:04:14 ubuntu systemd[1]: Starting Record Runlevel Change in UTMP... Mar 04 20:04:14 ubuntu systemd-udevd[498]: Using default interface naming scheme 'v249'. Mar 04 20:04:14 ubuntu systemd[1]: systemd-update-utmp-runlevel.service: Deactivated successfully. Mar 04 20:04:14 ubuntu systemd[1]: Finished Record Runlevel Change in UTMP. Mar 04 20:04:14 ubuntu systemd[1]: Startup finished in 3.636s (kernel) + 2.023s (userspace) = 5.660s. Mar 04 20:04:14 ubuntu kernel: ttyFIQ ttyFIQ0: tty_port_close_start: tty->count = 1 port count = 2 Mar 04 20:04:14 ubuntu systemd-networkd[480]: wlan0: Interface name change detected, renamed to wlP2p33s0. Mar 04 20:04:14 ubuntu systemd-udevd[498]: wlan1: Could not set AlternativeName= or apply AlternativeNamesPolicy=, ignoring: File exists Mar 04 20:04:14 ubuntu systemd-udevd[498]: wlP2p33s0: Failed to rename network interface 7 from 'wlan1' to 'wlP2p33s0': File exists Mar 04 20:04:14 ubuntu systemd-udevd[498]: wlan1: Failed to process device, ignoring: File exists Mar 04 20:04:15 ubuntu systemd[1]: dmesg.service: Deactivated successfully. Mar 04 20:04:15 ubuntu systemd-networkd[480]: wlP2p33s0: Link UP Mar 04 20:04:16 ubuntu ModemManager[675]: [base-manager] couldn't check support for device '/sys/devices/platform/fe180000.pcie/pci0003:30/0003:30:00.0/0003:31:00.0': not supported by any plugin Mar 04 20:04:16 ubuntu ModemManager[675]: [base-manager] couldn't check support for device '/sys/devices/platform/fe190000.pcie/pci0004:40/0004:40:00.0/0004:41:00.0': not supported by any plugin Mar 04 20:04:17 ubuntu ModemManager[675]: [base-manager] couldn't check support for device '/sys/devices/platform/fe170000.pcie/pci0002:20/0002:20:00.0/0002:21:00.0': not supported by any plugin Mar 04 20:04:19 ubuntu wpa_supplicant[680]: wlP2p33s0: Trying to associate with c8:7f:54:d6:d9:b8 (SSID='SunnyvaleTP' freq=2417 MHz) Mar 04 20:04:19 ubuntu wpa_supplicant[680]: wlP2p33s0: CTRL-EVENT-REGDOM-CHANGE init=DRIVER type=WORLD
Joshua-Riek commented 4 months ago

The entire kernel is technically Android and one major hack after another. There are very few developers will spend time to properly fix broken or crappy drivers on this messy kernel. But given that WiFi and Bluetooth work, i do not want to spend time on this.

dsburns commented 4 months ago

Thanks for reviewing this so quickly. I would argue that if I can only connect to my board if it enumerates the correct wifi interface at boot, then Wifi is broken. Perhaps there's a udev work around to make the wifi behavior consistent across reboots..

JFLim1 commented 4 months ago

Hi @dsburns,

Are you having WiFi issue with kernel-5.10.160 or kernel-6.1.43? I have the same WiFi module as you RTL8852BE-CG for Opi5-Plus.

In my case the WiFi is stable on kernel-5.10.160 only occassionally WiFi is not connected and all I have to do is

sudo modprobe -r 88552be sudo modprobe -i 88552be

and WiFi will connected and stable.

I have WiFi stability or NO WiFi with kernel-6.1.43. WiFi essentially does not function on kernel-6.1.43 with RTL8852BE-CG as of now.

Joshua-Riek commented 4 months ago

I've not released the 6.1 kernel yet, it should not be used for comparison.

dsburns commented 4 months ago

I'm using the 5.10 kernel with the Ubuntu server image. I managed to create an ugly workaround that ensures network connectivity via WiFi at boot, but it doesn't address the driver issue. The suggestion from @JFLim1 doesn't work for my use case since I'm running headless and the system needs to maintain network connectivity across reboots without manual intervention.

JFLim1 commented 4 months ago

I've not released the 6.1 kernel yet, it should not be used for comparison.

It wasn't meant to be used for comparison between 5.10.160 and 6.1.43. Wasn't sure which kernel he was using.

For the record, you have done fantastic works on bsp-kernel-6.1.43 and making 3D GPU and vpu hw acceleration available.

arun-511 commented 4 months ago

WiFi modules, specially realtek ones are a mess on rockchip kernel. If you are on a server image, you should configure /etc/netplan/*.yaml to connect a specific interface to WIFI specifically that wlP one and give it dhcp4&6. I have Intel AX21, 8265NGW and 7265NGW and they as appear with wlP (on mainline-6.7 & rockchip-6.1 builds) with no trace of wlan* interfaces at all.

dsburns commented 4 months ago

Understood. But the problem is the naming isn't consistent. Depending on the timing at boot, you can see the same wlP* device may have been renamed from wlan0 or wlan1. Look at logs during boot and you can see the errors from the device driver.

Joshua-Riek commented 4 months ago

This problem will be fixed in Ubuntu 24.04 with the 6.1 Linux kernel. It's still heavily in development but I'm re-visiting the wireless drivers right now.

image

KlausBuchegger commented 2 months ago

I faced the same issue on my Orange Pi 5 Plus (but I'm running armbian). As @dsburns mentioned, configuring the wifi based on the interface name is not reliable, as it randomly changes during boot. But I noticed, that both interfaces have individual, fixed MAC addresses. On armbian, I'm using NetworkManager to configure the wifi, and it allows to limit the connection based on the interface MAC.

Instead of specifying the interface-name in the [connection] section you can specify mac-address in the [wifi] section.

So far, this seems to be reliable for me. Maybe it also works for you, until it will be fixed properly