Thumbnail image

Broadcom-wl-dkms Linux Kernel 5.17 Fix [April 2022]

Tue, Apr 26, 2022 5-minute read

Table of Contents

Updating my 2013 Macbook Air to Linux kernel version 5.17.4 broke my Broadcom wireless and required a bit of extra work to get it working.

This post is normally something outside of my wheelhouse, but I decided to add it as a resource for me to revisit if needed, but also for anyone else since I didn’t find a ton of resources on the topic. This article is how I patched the broadcom-wl-dkms module to work for the Linux kernel 5.17.4 under Fedora 35.

Symptoms

Note:
Now that everything is working, I didn’t go back to the broken version to locate the exact file paths and errors. Some my be slightly off as they are from the top of my head. If you found this post and would like to share the exact errors you encountered, I can add them to make it easier for others to find this post.

Let me know in the comments section at the bottom.

Per normal, I updated my laptop with dnf running Fedora 35 (with the Broadcom BCM4360 wireless adapter). It updated from kernel 5.16.20 to kernel 5.17.4, but upon boot, I had no wifi.

While trying to load the module with modprobe wl, I received the error that the module couldn’t be found:

modprobe: FATAL: Module wl not found in directory /lib/modules/5.17.4-200.fc35.x86_64

After some digging I recalled I had installed the broadcom-wl-dkms package through unitedrpms. For a while I’ve actually had the repo disabled as it caused too many package conflicts. So I re-enabled it, updated, but there were no updates regarding the broadcom-wl-dkms package.

Digging further, I tried to rebuild the dkms module with:

dkms build -m broadcom-wl -v 6.30.223.271 -k 5.17.4-200.fc35.x86_64

Running this resulted in an error, leading me to look at the log file:

/var/lib/dkms/broadcom-wl/6.30.223.271/build/make.log

I am no expert in C, but I can peruse a log file for glaring errors. Near the bottom I found:

cc1: some warnings being treated as errors

Followed by Exit Status (2). Alright, well something failed, and looking through a few pieces of the log, it appears a few things have changed, been deprecated, etc. that keep the module from building properly. To the internet!

Findings

Some searching lead me to find others encountering a similar issue with other broadcom dkms packages related to the 5.17.X kernel. Namely in:

Fortunately, there was just enough information in the Slackware post to lead me to the fix. Apparently, the good people in the Arch community already created the patch which can be found here. We will be patching the dkms module below with the aforementioned file.

Fix

We will be following the dkms manual page here.

Reboot your machine into a previous kernel version with functional wifi. For me that meant selecting the 5.16.20 kernel during the boot process. This isn’t a necessary step, but you will need to download (copy) the patch.

Note:
If you don’t have a kernel with functional wifi, all you need is the patch file linked above (and curl’d below). You could download it from another source, put it on a USB drive and copy it over, or even tether your machine via bluetooth/usb.

Create the patches Directory and Download the Patch

Begin by switching to your root account with something like sudo -i.

The first step will be to download the patch, and make sure it is put into the correct directory.

mkdir /usr/src/broadcom-wl-6.30.223.271/patches/ && cd $_
curl -O https://raw.githubusercontent.com/archlinux/svntogit-community/packages/broadcom-wl-dkms/trunk/012-linux517.patch

These 2(3) commands will create the correct directory, move into it, and download the patch we will be applying. You should now see a file called 012-linux517.patch in the patches directory.

Modify our dkms.conf File

Now that we have the patch, we need to tell dkms that it needs to use it when building this module.

Move up a directory with cd .. or you can just edit the dkms.conf file directly.

vi /usr/src/broadcom-wl-6.30.223.271/dkms.conf
dkms conf file before patch

My dkms.conf before changes added.

Mine is 5 lines long, and we will be adding the following two lines to the bottom:

1
2
3
4
5
6
7
PACKAGE_NAME="broadcom-wl"
PACKAGE_VERSION="6.30.223.271"
BUILT_MODULE_NAME[0]="wl"
DEST_MODULE_LOCATION[0]="/kernel/drivers/net/wireless"
AUTOINSTALL="yes"
PATCH[0]="012-linux517.patch"
PATCH_MATCH[0]="5.17.4"

Note:

  • We add the PATCH declaration and add the [0] to the end so we can identify it below. Then we identify the file name of the patch, in this case 012-linux517.patch
  • We add PATCH_MATCH[0] to indicate that we only want patch number 0 to be applied when building the specified kernel. In this case I’m limiting it to 5.17.4, but you could expand it to more versions with a regex pattern.

I kept it at just the single kernel version in case an update occurs fixing this issue.

Save & Quit your editor.

Build the DKMS Module

Now that everything is in place, we simply build the module with the same command I tried earlier:

dkms build -m broadcom-wl -v 6.30.223.271 -k 5.17.4-200.fc35.x86_64

This time, the broadcom-wl module should build correctly.

Install the Kernel Module

Lastly, we can install our newly build module with:

dkms install -m broadcom-wl -v 6.30.223.271 -k 5.17.4-200.fc35.x86_64

Reboot into kernel 5.17.4 and you should have a working wifi! There’s a chance you will need to use modprobe wl, but I guess that’s only if you did this whole process from the 5.17.4 kernel instead of a different one.

Conclusion

I originally jumped around to a few different ways of using the broadcom-wl driver, and settled on the broadcom-wl-dkms version as it seemed to cause me the least headaches. The best part is that it generally requires little maintenance and is constantly rebuilt with kernel updates. However, occasionally there are breaking changes, and I’m not all that surprised on major and minor kernel releases.

I hope you found this quick article helpful and didn’t have to dig around for hours like I did. There seem to be fewer and fewer people on these older machines and the help for keeping them running is dwindling. As always, any questions or comments are welcome below!


Thank you for visiting my site and checking out this post! I hope you found it helpful. If you are feeling generous, please consider a small donation to help keep the server running.

Buy Me A Coffee