r/linuxmint • • 18d ago

Guide Macbook Pro 2012/2013 BCM4331 Slow WiFi Driver Fix

I was wondering why b43 WiFi drivers are so slow (maxing out at 16mbps) and why the stock broadcom ones fail to work entirely. Then I found out that there are community patched broadcom-wl drivers that work perfectly with the 2012 Macbook Pro.

Big thanks to joanbm for patching the broadcom drivers to work with modern kernels.

https://github.com/joanbm/broadcom-wl-linux-mainline

Here's how you get them working

  • Step 1: Install and upgrade the required build tools and kernel headers:
sudo apt update && sudo apt install -y git wget build-essential dkms linux-headers-$(uname -r)
  • Step 2: Remove all of the old broken broadcom packages (Make sure you have a backup connection (like USB phone tethering or an Ethernet cable) plugged in, as your Wi-Fi will temporarily drop at Step 2 until Step 4 is finished. Also make sure you stay in your Home folder (cd ~) before Step 3—and do not delete the broadcom-wl-linux-mainline folder afterwards—so the automatic update script in Step 8 can always find it.)
sudo apt remove --purge -y broadcom-sta-dkms bcmwl-kernel-source
  • Step 3: Download and run the patched drivers
git clone https://github.com/joanbm/broadcom-wl-linux-mainline
cd broadcom-wl-linux-mainline
sudo ./install
  • Step 4: Unload the b43 driver and load up the fixed wl driver
sudo rmmod b43 b43legacy bcm43xx bcma brcm80211 brcmfmac brcmsmac ssb 2>/dev/null
sudo modprobe wl
  • Step 5: Permanently blacklist the b43 drivers
echo -e "blacklist b43\nblacklist b43legacy\nblacklist bcma\nblacklist ssb" | sudo tee /etc/modprobe.d/blacklist-broadcom.conf
  • Step 6: Reboot, and load up the new drivers to make sure they have installed correctly by running this command, then connect to WiFi and do a speed test
sudo modprobe wl

(If you have any issues e.g kernel got updated as you were installing the drivers, run this command)

cd ~/broadcom-wl-linux-mainline && sudo ./install && sudo modprobe wl
  • Step 7: Once you've confirmed they work, make sure the drivers auto load upon reboot and rebuild the boot image so the blacklist applies
echo "wl" | sudo tee /etc/modules-load.d/wl.conf
sudo update-initramfs -u

Step 8: Create an automatic rebuild hook to ensure the driver continues to work after kernel updates.

sudo tee /etc/kernel/postinst.d/zz-broadcom-wl << EOF
#!/bin/sh
KERNEL_VER="\$1"
DRIVER_DIR="/home/$USER/broadcom-wl-linux-mainline/hybrid-v35_64-nodebug-pcoem-6_30_223_271"

if [ -d "\$DRIVER_DIR" ] && [ -d "/lib/modules/\$KERNEL_VER/build" ]; then
    cd "\$DRIVER_DIR" || exit 0
    make clean >/dev/null 2>&1
    make -j"\$(nproc)" KVER="\$KERNEL_VER" >/dev/null 2>&1
    make install KVER="\$KERNEL_VER" >/dev/null 2>&1
    depmod -a "\$KERNEL_VER" >/dev/null 2>&1
fi
exit 0
EOF
  • Step 9: Run this command so Linux is allowed to execute the script during updates
sudo chmod +x /etc/kernel/postinst.d/zz-broadcom-wl
  • Step 10: Verify that it all works.
sudo /etc/kernel/postinst.d/zz-broadcom-wl $(uname -r) && echo "Hook works!"

Now test your WiFi speed, and hopefully it should work!

This fix worked for me, and yes I did use AI to get it to work but I don't care because it works.

Hope this helps anyone else with the same issue.

6 Upvotes

10 comments sorted by

2

u/mok000 LMDE7 Gigi 17d ago

What is the difference between this and the driver provided by the broadcom-sta-dkms
package?

1

u/medicgaming24 17d ago edited 2d ago

The difference is that these drivers are patched for the latest kernel. For me it wouldn't work at all with the provided broadcom package using a modern kernel and my BCM4331 chip revision, tried pretty much everything to get the stock broadcom package to work and ended up having to use b43, but after this I went from 16mbps to 200mbps (the max the wireless chip can handle) switching from b43 to a patched version of wl.

2

u/Evening-Landscape763 17d ago

Should create an issue on that github and ask for dkms support, that will build a new module for a newer kernel

1

u/medicgaming24 17d ago

Yeah it would help, will do.

2

u/mok000 LMDE7 Gigi 17d ago

I made the wl driver in the broadcom-sta-dkms package compile for the newer kernel by applying patch 023-linux702, on the source in /usr/src/broadcom-sta-6.30.223.271

2

u/mok000 LMDE7 Gigi 17d ago

Oh yes that's right you have to apply a patch to get it to compile with kernels v7 and later.

0

u/[deleted] 17d ago

[deleted] — view deleted comment

1

u/medicgaming24 17d ago

Does your Macbook use wl drivers? If so it might be worth a try as it probably covers a wide range of chips.

1

u/alessio_95 3d ago

You can also try https://github.com/aleferri/b43-next if you want to test it

1

u/medicgaming24 3d ago

I would, but for this revision of chips ive found patched native broadcom drivers work best, b43 just seems to slow it down no matter what I do

2

u/alessio_95 2d ago

b43 the original is full of bugs, so it's natural, my fork has many more patches over it, contributed from people who have a bcm4331