Ubuntu wireless problems

Linux kernel and modules

Posted by Dave Anderson on July 27, 2016

After a perfect storm on Monday of an Ubuntu kernel update disabling wifi on my laptop (which doesn’t have any other means to connect to the internet) and a literal storm knocking out the power (restored) and Internet (still out) that afternoon, I’m pretty much back in business, thanks to a T-Mobile hotspot on my phone (so useful!) and StackOverflow!

The solution involved turning off SecureBoot in the system BIOS and unloading and re-loading modules using the below commands. Other steps to install packages weren’t required as the drivers and other required software was already installed.

Unload modules:

modprobe -r b43 bcma
modprobe -r brcmsmac bcma
modprobe -r wl

Reload modules:

modprobe wl

Loadable Kernel Modules are pieces of code that can be used to extend functionality of the Linux kernel dynamically without interruption at runtime. The Linux kernel is the lowest level piece of software on a computer that acts as an intermediary between user programs and the hardware. Modules are one way the architects of the system reduced the complexity and memory demands of the core kernel. Typically when modules are changed while the system is active, such as through a system update, a program called DKMS (Dynamic Kernel Module Support) will swap the updated module into the kernel automatically. However, when the kernel is updated, there may be incompatibilities which require to the module to be recompiled before it can be used (as happened to the broadcom adapter in this case).

We can interact with loadable kernel modules through a couple of different commands in Ubuntu.

We can list all of the currently available modules by using lsmod which will show us the module name, size and number of dependencies.

onenote@onenote-lap:~$ lsmod | head
Module                  Size  Used by
binfmt_misc            20480  1
rfcomm                 69632  2
bnep                   20480  2
hid_multitouch         20480  0
dell_wmi               16384  0
dell_laptop            20480  0
dcdbas                 16384  1 dell_laptop
nls_iso8859_1          16384  1
intel_rapl             20480  0

We can also load a module using insmod or modprobe. Modprobe is smarter than insmod as it is able to leverage module dependencies calculated through the depmod command to make multiple calls to insmod to load the modules in the best order per the dependency graph.

Finally, we can remove a module from the kernel using rmmod or modprobe -r.

Hope this post helps demystify Linux Kernel Modules and related tools!