0

Ubuntu 23.04 hard freezes with 1-2 min of using wifi. I tried the proprietary driver broadcom-sta-dkms suggested by ubuntu but it didn't solve the issue. I'd had the exact same problem with any distribution with kernel 6 (like Fedora). Any thoughts on how to solve the problem?

Output of lspci -nn | grep Broadcom

05:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4313 802.11bgn Wireless Network Adapter [14e4:4727] (rev 01)

3 Answers3

1

For anyone cannot use

sudo apt install bcmwl-kernel-source

So you guy can manually build from their source code (with patches applied to build for kernel 6.x).

!note: mine is kernel 6.5, test OK.

First, we clone the source:

git clone https://git.launchpad.net/ubuntu/+source/bcmwl/

(to be detailed, my latest commit is cd76516d116a73018ca4cbe6b580bfd603465cb9 , you can 'git checkout cd76516d116a73018ca4cbe6b580bfd603465cb9' if you want to have the same branch with me)

Go into the source code, you will see Makefile, README, debian and src, move Makefile into src folder

mv Makefile ./src/

Now create script in src directory for applying patches (already in source code)

#!/bin/bash

path to your patches (change if you want absolute dir)

PATCH_DIR="../debian/patches"

PATCHES=( "0002-Makefile.patch" "0003-Make-up-for-missing-init_MUTEX.patch" "0010-change-the-network-interface-name-from-eth-to-wlan.patch" "0013-gcc.patch" "0019-broadcom-sta-6.30.223.248-3.18-null-pointer-fix.patch" "0020-add-support-for-linux-4.3.patch" "0021-add-support-for-Linux-4.7.patch" "0022-add-support-for-Linux-4.8.patch" "0023-add-support-for-Linux-4.11.patch" "0024-add-support-for-Linux-4.12.patch" "0025-add-support-for-Linux-4.14.patch" "0026-add-support-for-Linux-4.15.patch" "0027-add-support-for-linux-5.1.patch" "0028-add-support-for-linux-5.6.patch" "0029-Update-for-set_fs-removal-in-Linux-5.10.patch" "0040-add-support-for-linux-5.18.patch" "0041-dev-addr-access.patch" "0042-add-support-for-linux-6.x.patch" )

Apply all

for PATCH in "${PATCHES[@]}"; do echo "Applying patch: $PATCH" patch -p1 < "$PATCH_DIR/$PATCH"

if [ $? -ne 0 ]; then
    echo &quot;Failed to apply $PATCH, skipping.&quot;
fi

done

echo "All patches applied successfully."

Now we can build

make -C /lib/modules/$(uname -r)/build M="$(pwd)"

or just :

make

after building, we can install by using command:

sudo make install
sudo modprobe -r wl
sudo modprobe wl
lsmod |grep wl

If there is wl, you can see wifi works.


For anyone want to use dkms to build: You guys need to get source code and apply patch like above. Copy the src folder to

/var/lib/dkms/bcmwl/6.30.223.271+bdcom/source

Now check if there is any dkms installed before, we need to delete it:

dkms status
sudo dkms remove bcmwl/6.30.223.271+bdcom --all
dkms status

Go to /var/lib/dkms/bcmwl/6.30.223.271+bdcom/source/dkms.conf and delete all patches:

PACKAGE_NAME="bcmwl"
PACKAGE_VERSION="#VERSION#"
CLEAN="rm -f *.*o"

BUILT_MODULE_NAME[0]="wl" MAKE[0]="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build" DEST_MODULE_LOCATION[0]="/updates" AUTOINSTALL="yes"

Now everything is clean, just go to build

sudo dkms build bcmwl/6.30.223.271+bdcom
sudo dkms install bcmwl/6.30.223.271+bdcom

or just do this:

sudo apt update
sudo apt install bcmwl-kernel-source

Now everything works normally.

0

I believe that the best working driver for your 14e4:4727 Broadcom is bcmwl-kernel-source, instead of brcmsmac or b43 and firmware. Let's install it and see if there is any improvement:

sudo apt update
sudo apt install bcmwl-kernel-source

Reboot and tell us if there is any improvement.

EDIT: You have shown that bcmwl-kernel-source does not work. Let's try brcmsmac:

sudo -i
apt purge bcmwl-kernel-source
echo "blacklist b43" >>  /etc/modprobe.d/blacklist.conf
echo "blacklist ssb" >>  /etc/modprobe.d/blacklist.conf
exit

Reboot. Is there any improvement?

chili555
  • 61,330
0

Following the clues I found this bug reported to kernel. The reporter had the same issue as me which is recognized as a kernel regression problem.

Solution has already been suggested by arch developers to kernel.

As stated in the discussion:

There are some codepaths that do not initialize rx->link_sta properly. This causes a crash in places which assume that rx->link_sta is valid if rx->sta is valid. One known instance is triggered by __ieee80211_rx_h_amsdu being called from fast-rx. It results in a crash

I couldn't verify this on ubuntu since it has kernel 6.2 but the patch works on mainline 6.1 kernel.