Overriding individual files

Hi, I’d love to try out Silverblue on my Surface Go but the linux-firmware package ships with a broken firmware for the wifi-card. There’s no fix upstream yet but it’s possible to manually replace a couple of files installed by linux-firmware to get the wifi card working, described in the following reddit post (I’m currently doing this on regular Fedora Workstation).

Since /usr is handled by ostree, I tried creating an RPM that replaces the file that I could overlay with rpm-ostree but RPM’s don’t let you override other packages’ files like this.

Is it possible to create your own ostree layer that just replaces the files until there’s an upstream fix or might there be another way to solve this?

Generally for replacing base system files you would use the rpm-ostree override replace command. If it comes in an RPM, rpm-ostree install can be used as you would dnf install to layer rpm packages onto the base OStree. After layering it is essential to do a systemctl reboot before doing any more work on the ostree. Also it is a good habit to get into using rpm-ostree cleanup -m before trying to modify the ostree. So for clarity, layering won’t solve what you’re trying to fix since the package is already part of the ostree commit. You will have to use rpm-override replace for your purpose.

In addition, maybe a post-install script could do this? Off the top of my head, I think they’re run on the final composed deployment.

The small RPM that I created doesn’t contain all the firmware in linux-firmware so I’m hesitant to run
rpm-ostree replace. The man page says Replace a package in the base tree.. Does it remove the entire linux-fimware package or just the conflicting files?

Since fedpkg won’t let me build an RPM with an empty %files field, I’ll try making one that manages a dummy file and replaces the actual files in %post like refi64 suggested. Another way would maybe be to build a patched linux-firmware and run the rpm-ostree override replace

It worked fine to replace files in the %post section of the .spec file for the RPM package. I’m now a happy user of Silverblue! I think it would be nice to be able to create an ostree layer with arbitrary files since this workaround is a little bit ugly.