I'd been curious on what it's like to use Linux as the main OS, and wanted to upgrade from my Linux VM setup for a while now. So when a family member was upgrading to a newer machine, I asked for their older machine - a 2017 MacBook Pro - and decided to install Linux on it.
I chose Ubuntu as that's the distro I'm most comfortable with. After some initial research, I created a bootable installer using this guide and proceeded with the install which went smoothly. Ubuntu also booted much faster compared to macOS on the same machine, so I was feeling good about this.
The feel-good-ness went away fairly quickly, as I started to notice major problems - one of them being that the WiFi wouldn't connect. I could see the list of networks, but it got stuck at the connecting stage after I entered the password. I failed to catch this during the installation process as I skipped the "Connect to WiFi" step.
With the power of the search engine, I came to the conclusion that the WiFi driver was missing. The driver was available via apt
, but I needed WiFi for apt
to work. The solution I kept coming across was to get a direct connection via Ethernet and then install. Great idea, except my machine doesn't have an Ethernet port.
womp womp
While I was sure I would need an Ethernet adapter and even planned on buying one, I wrote about this situation in a weeknote in the slight hopes of finding an alternate solution. And I DID! A fellow Recurser reached out with links I hadn't come across, and one of them provided the required driver as a ZIP file with installation instructions.
And that's when it clicked - I can download the required files on a machine that has WiFi and transfer them via USB. A very obvious idea in hindsight, I'm still wondering why I didn't think of this earlier.
While the file in the post didn't work, I now knew what to search for, and then came across this answer on askubuntu. I downloaded the two files it suggests:
- the driver itself -
broadcom-wl-5.100.138
- a package called
b43-fwcutter
that extracts the firmware specific to the hardware on my system
Once I transferred these files via USB, I ran the remaining steps, and had working WiFi!!!
$ sudo dpkg -i b43-fwcutter_015-9_amd64.deb
$ tar xfvj broadcom-wl-5.100.138.tar.bz2
$ sudo b43-fwcutter -w /lib/firmware broadcom-wl-5.100.138/linux/wl_apsta.o
$ sudo modprobe b43
Another answer in another thread suggested installing the package via apt
once the WiFi works so future updates would be managed by apt
, which I thought was a nice idea.
$ sudo apt install b43-firmware-installer
The WiFi signal appeared to be pretty weak in the top bar, however I didn't face any issues while running apt install
, interesting.
So problem solved, right? Not reaally. When I logged into the machine a few days later, the WiFi stopped connecting once again.
On further searching, I came across mbp-2016-linux - an absolute gem of a resource that mentions what works and doesn't work on Linux for the 2016 and 2017 MacBook Pro's. Particularly, the section about WiFi caught my eye:
The MacBook Pro models with Touch Bar come with a
Broadcom Limited BCM43602 802.11ac Wireless LAN SoC (rev 02)
which is also supported bybrcmfmac
, but has several issues rendering it unusable, caused by the available firmware.
My machine has a Touch Bar, let me check what hardware I have:
$ lspci -nn | grep Network
03:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM43602 802.11ac Wireless Lan SoC [14e4:43ba] (rev 02)
Aaand it's the same one. This was confusing since I got WiFi working earlier, that wasn't a dream. So now I needed to figure out what apart from installing the drivers made it work.
Then I remembered a command I ran in my initial attempt at fixing WiFi - copy-pasting commands without knowing what they do. It seemed relevant enough here for some reason, so I ran it again.
$ sudo iwconfig wlp3s0 txpower 10dBm
Reconnected the WiFi, and I had a working connection again! I tried figuring out what led to this confusion, and here's what happened:
- The drivers were still missing when I ran the command the first time, so it didn't work on its own.
- Once I had the correct driver, I forgot I ran this command and thought that the drivers alone made it work.
This command is suggested as a workaround after installing the driver, and comes from this bug report. I'm not really sure why this works (if you do, let me know!), but it does explain why the WiFi signal appears weak after connecting.
Based on replies in the report and issues on mbp-2016-linux, this isn't a guaranteed fix but rather a "your mileage may vary" fix. I been using WiFi with this fix for a few weeks and haven't faced any issues, so looks like it seemed to work fine in my case (yay!)
Okay one last thing before I wrap up this post. This workaround isn't a one-time fix, so I had to type the command and restart the WiFi on each boot to make it work. That got repetitive, so I recently created and enabled a systemd
service to run these commands on boot.
# mbp-linux-wifi.service
[Unit]
Description=Fixes to make WiFi work on a MBP running Linux
Requires=network.target
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/iwconfig wlp3s0 txpower 10dBm
ExecStart=/usr/bin/systemctl restart NetworkManager
RemainAfterExit=yes
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Earlier iterations of this service failed to run, since it would sometimes try to execute commands before the wireless interface (wlp3s0
) is even detected. To solve this, I added the Restart
and RestartSec
parameters to retry after it fails, and now it connects shortly after booting.