Nvidia drivers in Fedora Silverblue

UPDATE:

The updated drivers packages are now in the repos, so you don’t need the specially built rpm. Using rpm-ostree install kmod-nvidia xorg-x11-drv-nvidia is enough. If you installed the custom build you need to uninstall it as it can cause upgrade issues.

I really like how Fedora Silverblue combines the best of atomic, image-based updates and local tweaking with its package layering idea.

However, one major issue many people has had with it is support for the NVIDIA drivers. Given they ares not free software they can’t be shipped with the image, so one imagines using package layering to would be a good way to install it. In theory this works, but unfortunately it often runs into issues, because frequent kernel updates cause there to be no pre-built nvidia module for your particular kernel/driver version.

In a normal Fedora installation this is handled by something called akmods. This is a system where the kernel modules ship as sources which get automatically rebuilt on the target system itself when a new kernel is installed.

Unfortunately this doesn’t quite work on Silverblue, because the system image is immutable. So, I’ve been working recently on making akmods work in silverblue. The approach I’ve taken is having the modules being built during the rpm-ostree update command (in the %post script) and the output of that being integrated into the newly constructed image.

Last week the final work landed in the akmods and kmodtools packages (currently available in updates-testing), which means that anyone can easily experiment with akmods, including the nvidia drivers.

Preparing the system

First we need the latest of everything:

$ sudo rpm-ostree update

The required akmods packages are in updates-testing at the moment, so we’ll enable that for now:

$ sudo vi /etc/yum.repos.d/fedora-updates-testing.repo
... Change enabled to 1 ..

Then we add the rpmfusion repository:

$ sudo rpm-ostree install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-29.noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-29.noarch.rpm

At this point you need to reboot into the new ostree image to enable installation from the new repositories.

$ systemctl reboot

Installing the driver

The akmod-nvidia package in the current rpm-fusion is not built against the new kmodtools, so until it is rebuilt it will not work. This is a temporary issue, but  I built a new version we can use until it is fixed.

To install it, and the driver itself we do:

$ sudo rpm-ostree install http://people.redhat.com/alexl/akmod-nvidia-418.43-1.1rebuild.fc29.x86_64.rpm xorg-x11-drv-nvidia

Once the driver in rpm-fusion is rebuilt the custom rpm should not be necessary.

We also need to blacklist the built-in nouveau driver so to avoid driver conflicts:

$ sudo rpm-ostree kargs --append=rd.driver.blacklist=nouveau --append=modprobe.blacklist=nouveau --append=nvidia-drm.modeset=1

Now you’re ready to boot into your fancy new silverblue nvidia experience:

$ systemctl reboot

What about Fedora 30/Rawhide?

All the changes necessary for this to work have landed, but there is no Fedora 30 Silverblue image yet (only a rawhide one), and the rawhide kernel is built with mutex debugging which is not compatible with the nvidia driver.

However, the second we have a Fedora 30 Silverblue image with a non-debug kernel the above should work there too.

16 thoughts on “Nvidia drivers in Fedora Silverblue”

  1. Awesome! I wanted to try Silverblue but decided to wait because of the optimus system, maybe once 30 is released I should give it a shot 🙂
    Thanks a lot for your work

  2. To make it work with Wayland is needed to edit /usr/lib/udev/rules.d/61-gdm.rules. In Silverblue (30, the version I’m using) this file is read only. What is the correct way of edit this file? Or what is the other way of making wayland work with nvidia proprietary driver in Silverblue? Thanks for your work!

  3. > To make it work with Wayland is needed to edit /usr/lib/udev/rules.d/61-gdm.rules. In Silverblue (30, the version I’m using) this file is read only. What is the correct way of edit this file?

    It should work to: `cp /usr/lib/udev/rules.d/61-gdm.rules /etc/udev/rules.d` and edit the new copy in `/etc`. Same design as systemd unit files.

  4. > /usr/lib/udev/rules.d/61-gdm.rules. In Silverblue (30, the version I’m using) this file is read only. What is the correct way of edit this file?

    Override it in `/etc`:

    `cp /usr/lib/udev/rules.d/61-gdm.rules /etc/udev/rules.d`

    This is the same model used by systemd unit files.

  5. Hi and thanks for the great work!
    But I have a question: for me the RPM fusion driver never worked on my newer machines (GeForce GTx 750Ti and 1060), so I always had to install it manually with the NVidia driver blob (on on my latest I even had to sign the driver for UEFI). So my question is: Is there a way to still install thedriver manually on silverblue, or is it possible to build my own RPM to do something similar?

  6. no worky after re-base to 30?

    error: Packages not found: kmod-nvidia, xorg-x11-drv-nvidia

    any ideas?

      1. pointed me in the right direction…thanks!

        I couldn’t rebase from 29 to 30 because of conflicts against the rpmfusion-free-release-29 and rpmfusion-nonfree-release-29.noarch repos. So I uninstalled them.

        Next I undid the kargs so I could have a graphical environment with:
        sudo rpm-ostree kargs –delete=rd.driver.blacklist=nouveau –delete=modprobe.blacklist=nouveau –delete=nvidia-drm.modeset=1

        Next was rebase to Fedora 30

        Then install version 30 of the rpmfusion repos
        sudo rpm-ostree install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-30.noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-30.noarch.rpm

        Then put the kargs back:
        sudo rpm-ostree kargs –append=rd.driver.blacklist=nouveau –append=modprobe.blacklist=nouveau –append=nvidia-drm.modeset=1

        and all is good! Thanks!

  7. I was able to install the two Nvidia packages successfully (non-custom), however, the system is still booting with nouveau. Tried blacklisting, but no luck. Any suggestions?

  8. Update from my last comment:

    My issue was an unrelated grub issue. After resolving my grub issue, it worked fine.

    Two additional observations I found using Silverblue 30:

    1) I was able to complete install with fedora’s “fedora-workstation-repositories” by enabling “rpmfusion-nonfree-nvidia-driver.repo”. Worked without any issues.

    2) After I did a general system upgrade that included an update to the kernal, the akmod no longer worked! I am not sure why the akmod post-scripts didnt execute after kernal update. I havnt found a “real” solution to this problem: my uneducated workaround was to uninstall/install the packages, which worked of me.

    1. I’m having the same issue on a fresh Fedora Silverblue 30:

      May 28 21:45:05 localhost.localdomain rpm-ostree(akmod-nvidia.post)[2702]: error: Bad exit status from /var/tmp/rpm-tmp.Tiwpbi (%build)
      May 28 21:45:05 localhost.localdomain rpm-ostree(akmod-nvidia.post)[2702]: RPM build errors:
      May 28 21:45:05 localhost.localdomain rpm-ostree(akmod-nvidia.post)[2702]: cannot open Packages database in /var/lib/rpm
      May 28 21:45:05 localhost.localdomain rpm-ostree(akmod-nvidia.post)[2702]: user mockbuild does not exist – using root
      May 28 21:45:05 localhost.localdomain rpm-ostree(akmod-nvidia.post)[2702]: group mock does not exist – using root
      May 28 21:45:05 localhost.localdomain rpm-ostree(akmod-nvidia.post)[2702]: user mockbuild does not exist – using root
      May 28 21:45:05 localhost.localdomain rpm-ostree(akmod-nvidia.post)[2702]: group mock does not exist – using root
      May 28 21:45:05 localhost.localdomain rpm-ostree(akmod-nvidia.post)[2702]: cannot open Packages database in /var/lib/rpm
      May 28 21:45:05 localhost.localdomain rpm-ostree(akmod-nvidia.post)[2702]: Bad exit status from /var/tmp/rpm-tmp.Tiwpbi (%build)

    2. I wonder how has this changed? The guide is really good, thanks for the work! The kargs should still work.

      I adapted it slightly, to work universally.

      rpm-ostree install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && reboot

      sudo rpm-ostree kargs –append=rd.driver.blacklist=nouveau –append=modprobe.blacklist=nouveau –append=nvidia-drm.modeset=1

      rpm-ostree update –install xorg-x11-drv-nvidia akmod-nvidia

      rpm-ostree update –install xorg-x11-drv-nvidia akmod-nvidia

      Questions: are there any distro upgrade problems? Can you make the sysroot read only afterwards? How are the FOSS drivers and how is it working on Wayland?

Leave a Reply

Your email address will not be published. Required fields are marked *