Skip to content

Fix legacy Broadcom wl conflict on BCM4350 Macs upgrading to Quattro - #8812

Open
rsharma1157 wants to merge 3 commits into
omacom:quattrofrom
rsharma1157:fix-bcm4350-quattro-upgrade
Open

rsharma1157 wants to merge 3 commits into
omacom:quattrofrom
rsharma1157:fix-bcm4350-quattro-upgrade

Conversation

@rsharma1157

Copy link
Copy Markdown

Fixes #8810

Quattro already uses brcmfmac for Apple BCM4350 (14e4:43a3), but legacy Omarchy 3.x installs can retain broadcom-wl or broadcom-wl-dkms during upgrade.

Those legacy wl packages blacklist brcmfmac, which can leave the upgraded system without a Wi-Fi interface when wl fails to initialize.

This change removes legacy broadcom-wl/broadcom-wl-dkms only on Apple BCM4350 systems before the Quattro package transaction.

Other Broadcom devices that intentionally use wl are unchanged.

Validation:

  • bash syntax checks pass
  • full upgrade-to-quattro shell test passes
  • regression test verifies cleanup is limited to Apple BCM4350 systems

Copilot AI balanced review requested due to automatic review settings August 28, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds targeted cleanup of legacy Broadcom wl packages that disable Wi-Fi on BCM4350 Macs during Quattro upgrades.

Changes:

  • Detects Apple BCM4350 hardware before package installation.
  • Removes installed broadcom-wl variants.
  • Adds static regression checks; runtime behavior still needs coverage.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
bin/omarchy-upgrade-to-quattro Adds hardware-gated legacy driver cleanup.
test/shell.d/upgrade-to-quattro-test.sh Adds cleanup and ordering checks.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +140 to +144
for package in broadcom-wl broadcom-wl-dkms; do
grep -F "package_installed_exact \"\$pkg\"" <<<"$bcm4350_body" >/dev/null ||
fail "Omarchy 4 upgrade makes BCM4350 wl cleanup idempotent"
grep -F "$package" <<<"$bcm4350_body" >/dev/null ||
fail "Omarchy 4 upgrade removes legacy package $package from Apple BCM4350 systems"
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5 in Claude Code, with an independent second opinion from Codex at xhigh reasoning. The diagnosis holds up and the gate is right. One real defect, and a push problem that needs you.

The premise checks out. I pulled the Arch package apart on a disposable VM rather than taking it on trust. broadcom-wl ships /usr/lib/modprobe.d/broadcom-wl.conf, which contains blacklist brcmfmac among six others, and because that path is package-owned, pacman -Rdd genuinely removes the blacklist — there is no leftover conf to clean up, and Omarchy itself never writes a brcmfmac blacklist anywhere in the tree. wl.ko's only modalias is pci:v*d*sv*sd*bc02sc80i*, a PCI class match rather than a device list, which is why wl grabs a BCM4350 it cannot drive and then fails in probe — exactly the wl driver 6.30.223.271 failed with code 1 in #8810. So on 14e4:43a3 this removes a driver that was never working, which is the thing that most needed ruling out on a one-shot upgrade path.

One defect, and it is the reverse of the expected one. At bin/omarchy-upgrade-to-quattro:721 the removal was unguarded. The script runs under set -euo pipefail, so any non-zero exit from that pacman call aborted the entire upgrade between remove_conflicting_legacy_packages and install_omarchy_quattro_packages — precisely where cleanup_on_exit prints "Upgrade incomplete - do NOT reboot" and the machine is part Omarchy 3 and part quattro. A legacy Wi-Fi driver that will not uninstall is not worth that outcome. The neighbouring removal at line 698 does the same -Rdd --noconfirm for the same reason and ends with || warn "...; continuing.", and your own proposal in #8810 had || warn too — it looks like it was dropped in the move to -Rdd.

I could not push the fix: your fork rsharma1157/omarchy is archived, so it is read-only and returns 403. That also blocks the maintainer, despite "allow edits by maintainers" being on. Unarchiving it in your repository settings would let a fix land. The patch:

-  as_root pacman -Rdd --noconfirm "${legacy_wl_packages[@]}"
+  as_root pacman -Rdd --noconfirm "${legacy_wl_packages[@]}" ||
+    warn "Could not remove ${legacy_wl_packages[*]}; brcmfmac stays blacklisted and this Mac may have no Wi-Fi. Continuing."

On the tests. Codex demonstrated that deleting the pacman -Rdd line from the function left every one of your new assertions passing — they check that the source contains certain words, not that anything happens. That is the file's established convention and not something to hold against this PR; the script has no main guard and executes its sequence at top level, so no single function can be sourced and exercised without restructuring it, which is a bigger change than this fix. Worth one assertion with teeth, though, which I added alongside the guard and mutation-tested both ways — dropping the guard and deleting the removal outright each fail it:

grep -F 'pacman -Rdd --noconfirm "${legacy_wl_packages[@]}" ||' <<<"$bcm4350_body" >/dev/null ||
  fail "Omarchy 4 upgrade survives a failed legacy wl removal"

Things I checked and cleared, so they do not come back in a later review. lspci cannot be missing: pciutils is a hard dependency of base, so the gate cannot silently no-op on the hardware it targets. The lspci -nn | grep -F ... >/dev/null form avoids the SIGPIPE-141 bug that migrations/1786137597.sh records, because grep without -q consumes all its input — Codex measured 0 for this form against 141 for the grep -q equivalent. The package_installed_exact "$pkg" && legacy_wl_packages+=("$pkg") AND-list does not trip set -e when neither package is installed; I ran that case rather than reasoning about it. broadcom-wl-dkms conflicts with broadcom-wl, so the array only ever holds one element. Ordering before install_omarchy_quattro_packages is right, and re-running after a failure is safe because package_installed_exact skips the removal the second time.

Left open, for the maintainer rather than you. A user-written /etc/modprobe.d blacklist would survive the removal and still outrank /usr/lib/modprobe.d; the function does not look for one, and deciding whether the upgrade should delete a file the user wrote is not a call for a review to make. linux-firmware, which pulls in the linux-firmware-broadcom split package holding brcmfmac4350-pcie.bin, appears only in install/omarchy-other.packages (ISO-builder availability) and not in omarchy-base.packages, so the upgrade relies on it already being present rather than installing it — true on any machine where brcmfmac worked before, as yours did. And non-Apple machines carrying the same 14e4:43a3 keep the bug, which matches the vendor gate in install/hardware/apple/fix-brcmfmac-supplicant.sh and is deliberate as far as I can tell; widening a hardware gate is a maintainer decision, so I have not touched it.

What ran. ./test/shell.d/upgrade-to-quattro-test.sh on a disposable VM with a real session, 23 passed 0 failed before my change and 24 passed 0 failed after, plus bash -n. Nothing was executed on real Mac hardware, and the upgrade script itself was never run — the hardware evidence here is yours from #8810, not mine. Where Codex agreed with conclusions I had already reached, its independence is not currently guaranteed, since its sandbox restricts writes but not reads; the mutation result on the assertions and the SIGPIPE measurement were its own contributions and stand on their own.

Waiting on you to unarchive the fork so the guard can land, then on the maintainer for the merge decision and the three open questions above.

cursoragent and others added 2 commits August 30, 2026 15:07
Wi-Fi driver cleanup should not abort the 3.x to Quattro upgrade when pacman -Rdd exits non-zero.

Co-authored-by: rsharma1157 <rsharma1157@users.noreply.github.com>
The suite greps the function body, so every assertion in it still passed with the removal deleted outright or with its || warn guard dropped. Under set -euo pipefail an unguarded pacman -Rdd aborts the upgrade between remove_conflicting_legacy_packages and install_omarchy_quattro_packages, leaving the machine part Omarchy 3 and part Quattro; this pins the guard that keeps a stubborn Wi-Fi driver from causing that.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at ca9d7757 by Claude Opus 5 in Claude Code, with an independent second opinion from Codex at xhigh reasoning. The guard landed and it is the right one, so the defect from the last review is closed. Three things are new since then, and one of them decides whether this actually finishes #8810.

The fix is correct. bin/omarchy-upgrade-to-quattro:721 now ends in || warn "...; continuing.", which matches the neighbouring remove_conflicting_legacy_packages at line 698 doing the same -Rdd --noconfirm for the same reason. A stubborn Wi-Fi driver no longer aborts the upgrade between remove_conflicting_legacy_packages and install_omarchy_quattro_packages, which is where cleanup_on_exit prints "Upgrade incomplete - do NOT reboot" over a machine that is part Omarchy 3 and part Quattro. Re-running still retries the removal, because package_installed_exact is the only gate and nothing writes a completion marker for this step — I checked for one rather than assuming.

Pushed one commit, f4304d91, adding the assertion the last review said was missing:

grep -F 'pacman -Rdd --noconfirm "${legacy_wl_packages[@]}" ||' <<<"$bcm4350_body" >/dev/null ||
  fail "Omarchy 4 upgrade survives a failed legacy wl removal"

Both mutations now fail on a worker where before they passed: dropping the || warn gives not ok - Omarchy 4 upgrade survives a failed legacy wl removal, and so does deleting the as_root pacman -Rdd line outright. Codex found the same gap by reading the assertions; I ran it. One weakness left in your own loop, small enough that I left it alone: grep -F "$package" on the broadcom-wl iteration matches the substring inside broadcom-wl-dkms, so dropping the standalone broadcom-wl token would not fail that check — Codex's catch.

The thing that needs you: this does not repair a Mac that has already upgraded. The hook is in the upgrade script, so it only runs for someone still on 3.x. #8810 reports the opposite machine — its pre-upgrade snapshot shows brcmfmac driving wlp2s0, and the post-upgrade state shows broadcom-wl-dkms 6.30.223.271-48 installed and wl driver 6.30.223.271 failed with code 1. That machine is on Quattro now and nothing in this PR reaches it. omarchy-migrate and migrations/*.sh are the mechanism for existing installs, and this PR adds no migration, so merging it with Fixes #8810 closes the issue while the reporter still has no Wi-Fi. Whether to write that migration is a call for the maintainer rather than something a review should push, but the body's closing keyword is worth a second look either way. #6972, which happens to edit the same two files, is the shape of doing both: an upgrade-script change plus a migration for the machines that already went through.

Two smaller things about the failure path, both judgement calls I have not touched. The warning names the packages but not the symptom, so a user reading Could not remove legacy Broadcom driver(s) broadcom-wl-dkms; continuing. at the end of a long upgrade has nothing connecting it to the Wi-Fi that stops working after the reboot. And with --reboot there is nobody to read it: line 2383 reboots automatically, and the WARNING: You must address any errors in the above banner scrolls past. The script already has the precedent for this — boot_cmdline_unsafe suppresses the automatic reboot for exactly that reason. Codex's own suggestion, which I had not reasoned about and think is the better shape if you want one: re-query both packages after the pacman call and continue only when they are genuinely absent, so a nonzero exit from a hook that removed the packages anyway is tolerated while a package that actually survived is not silently accepted.

Things checked and cleared, so they do not come back. The gate is genuinely specific: [[ $sys_vendor == Apple* ]] plus lspci -nn containing 14e4:43a3 matches an Apple machine with a BCM4350 and nothing else — not 14e4:43a0 (BCM4360) or 14e4:4331 (BCM4331), the two devices install/hardware/fix-bcm43xx.sh deliberately installs broadcom-wl for. It is the same predicate shape install/hardware/apple/fix-brcmfmac-supplicant.sh already uses, whose comment names 43a3 as a BCM4350 that brcmfmac drives and names the BCM4360 as deliberately absent because it runs wl. Nothing later in the sequence puts the driver back: install_omarchy_quattro_packages reads only omarchy-base.packages, install_hardware_transition_packages is audio and GPU only, install/omarchy-other.packages is an ISO list the upgrade never reads, and install/hardware/all.sh is reached through omarchy-apply-hardware, which the upgrade does not call. Idempotence holds on a second pass: package_installed_exact "$pkg" && legacy_wl_packages+=("$pkg") is exempt from set -e as the non-final command of an && list, and ((${#legacy_wl_packages[@]})) returning 1 on an empty array sits on the left of || return 0. And #6972 edits bin/omarchy-upgrade-to-quattro and test/shell.d/upgrade-to-quattro-test.sh too, but git merge-tree merges the two heads with no conflict — the hunks are 1600 lines apart in the script, and the maintainer can take them in either order.

What ran. ./test/shell.d/upgrade-to-quattro-test.sh through the session wrapper on a disposable VM, 23 passed 0 failed at ca9d7757 and again after my commit, plus both mutations above and ./test/cli at 116 ok, 0 failures. Nothing was run on real Mac hardware and the upgrade script itself was never executed — the hardware evidence here is still yours from #8810. Where Codex agreed with conclusions already reached, its independence is not currently guaranteed, since its sandbox restricts writes but not reads; the --reboot bypass, the re-query proposal and the broadcom-wl substring were its own and stand on their own.

Waiting on the maintainer for the merge decision, for whether an already-upgraded machine gets a migration, and for the two failure-path questions above.

@omarchybot omarchybot added bug Something isn't working compatibility Make Omarchy work better on everything! labels Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working compatibility Make Omarchy work better on everything!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quattro upgrade leaves legacy broadcom-wl-dkms installed on BCM4350 Macs, disabling brcmfmac

5 participants