Error (and fix) for switching from NVidia to AMD images

I had previously been using an NVidia RTX 3060 TI GPU in my system and was running an image based on ghcr.io/ublue-os/bazzite-gnome-nvidia

I recently purchased an AMD Radeon RX 9070 XT and swapped it into my system.

Before going too deep into customizing my image, I chose to rebase to the vanilla ghcr.io/ublue-os/bazzite-gnome image using brh rebase bazzite-gnome:stable

When I rebooted the system, the rebase had not happened and I saw a semi-familiar message in the output of rpm-ostree status that I needed to check journalctl -b -1 -u ostree-finalize-staged.service

$  journalctl -b -1 -u ostree-finalize-staged.service 
Jun 06 04:09:21 infidelicious systemd[1]: Finished ostree-finalize-staged.service - OSTree Finalize Staged Deployment.
Jun 06 15:44:46 infidelicious systemd[1]: Stopping ostree-finalize-staged.service - OSTree Finalize Staged Deployment...
Jun 06 15:44:47 infidelicious ostree[251851]: Finalizing staged deployment
Jun 06 15:44:48 infidelicious ostree[251851]: Copying /etc changes: 58 modified, 0 removed, 238 added
Jun 06 15:44:48 infidelicious ostree[251851]: Copying /etc changes: 58 modified, 0 removed, 238 added
Jun 06 15:44:48 infidelicious ostree[251851]: Refreshing SELinux policy
Jun 06 15:44:48 infidelicious ostree[251922]: libsemanage.semanage_direct_get_module_info: Unable to open nvidia-container module lang ext file at /etc/selinux/targeted/tmp/modules/400/nvidia-container/lang_ext. (No such file or directory).
Jun 06 15:44:48 infidelicious ostree[251922]: semodule:  Failed!
Jun 06 15:44:48 infidelicious ostree[251851]: Refreshed SELinux policy in 389 ms
Jun 06 15:44:48 infidelicious ostree[251851]: error: Finalizing deployment: Finalizing SELinux policy: Child process exited with code 1
Jun 06 15:44:48 infidelicious systemd[1]: ostree-finalize-staged.service: Control process exited, code=exited, status=1/FAILURE
Jun 06 15:44:48 infidelicious systemd[1]: ostree-finalize-staged.service: Failed with result 'exit-code'.
Jun 06 15:44:48 infidelicious systemd[1]: Stopped ostree-finalize-staged.service - OSTree Finalize Staged Deployment.
Jun 06 15:44:48 infidelicious systemd[1]: ostree-finalize-staged.service: Consumed 910ms CPU time over 11h 35min 27.121s wall clock time, 125.3M memory peak.

I threw the problem a Claude Code and it thankfully was able to help resolve the issue. I’ll just post it’s reasoning here:

● The rebase succeeded. Here’s what happened and what I did:

Root cause: The nvidia-container SELinux module (a legacy binary .pp format, owned by ublue-os-nvidia-addons) was causing semodule to fail during ostree’s deployment finalization. Specifically, libsemanage was unable to write the lang_ext file into its temporary working directory while rebuilding the SELinux policy store for the new deployment. The semodule --refresh call on the running system worked fine, but it failed when ostree ran it in the context of the staged deployment.

What I did: Removed the nvidia-container SELinux module with sudo semodule -r nvidia-container, which cleared the problematic state from the local /etc/selinux store. Then re-ran the rebase.

The rebase to bazzite-gnome:stable staged successfully. Key things in the diff to be aware of:

  • The new image removes ublue-os-nvidia-addons (and with it the problematic nvidia-container.pp module) — this is why it caused the conflict during finalization.
  • All the NVIDIA driver packages (nvidia-driver, nvidia-container-toolkit, etc.) are removed in the new image — so this is a switch away from your custom nvidia-enabled image to the standard bazzite-gnome.
  • A new ublue-os-selinux-workarounds package is being added, suggesting upstream bazzite has addressed SELinux issues like this one.

You can now reboot to apply the changes: systemctl reboot

With the offending SELinux module removed, the rebase succeeded and I successfully rebooted into the new image.

I don’t know if this is “technically correct”, but it got me up and running.