The purpose of these images is to provide community Fedora images with Nvidia drivers built-in. This approach can lead to greater reliability as failures can be caught at the build level instead of the client machine. This also allows for individual sets of images for each series of Nvidia drivers, allowing users to remain current with their OS but on an older, known working driver. Performance regression with a recent driver update? Reboot into a known-working driver after one command. That's the goal!
These images are based on the experimental ostree native container images hosted at quay.io (repo).
Note: This project is a work-in-progress. You should at a minimum be familiar with the Fedora documentation on how to administer an ostree system.
- Multiple Nvidia driver streams (525xx, 520xx, and 470xx)
- CUDA support
- Container runtime support
- Secure boot
- Hardware-accelerated video playback
- Selinux support
- Multiple Fedora flavors and releases
- Post-install setup with
just
-
Rebase onto the image
Any system running
rpm-ostree
should be able to rebase onto one of the images built in this project:Note: The image previously titled "nvidia" will not be updated anymore. If you wish to retain the same functionality, switch to "silverblue-nvidia".
rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/silverblue-nvidia:latest
rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/kinoite-nvidia:latest
rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/lxqt-nvidia:latest
rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/mate-nvidia:latest
rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/vauxite-nvidia:latest
Sericea (Sway, unofficial as of Fedora 38):
Note: The Sway session has some custom configuration options set to improve stability on Nvidia GPUs
rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/sericea-nvidia:38
rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/base-nvidia:latest
And then reboot.
Note: The Fedora release and Nvidia version can be set with the image tag as well:
525xx series 520xx series 470xx series (Kepler 2012-2014 support) F37 :latest / :37 / :37-525 / :37-current :37-520 :37-470 F38 :38 / :38-525 / :38-current -
Set kargs after rebasing
Setting kargs to disable nouveau and enabling nvidia early at boot is currently not supported within container builds. They must be set after rebasing:
rpm-ostree kargs \
--append=rd.driver.blacklist=nouveau \
--append=modprobe.blacklist=nouveau \
--append=nvidia-drm.modeset=1
And then reboot one more time!
-
Enable Secure Boot support
Secure Boot support for the nvidia kernel modules can be enabled by enrolling the signing key:
sudo mokutil --import /etc/pki/akmods/certs/akmods-nvidia.der
Alternatively, the key can be enrolled from within this repo:
sudo mokutil --import ./certs/public_key.der
Generally you can perform a rollback with the following:
rpm-ostree rollback
To rebase onto a specific date, use a date tag:
rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/silverblue-nvidia:20230128
Or to rebase onto a specific release, driver, and date:
rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/silverblue-nvidia:37-525-20230128
More options for image tags can be found on the container catalog.
These images are signed with sisgstore's cosign. You can verify the signature by downloading the cosign.pub
key from this repo and running the following command:
cosign verify --key cosign.pub ghcr.io/ublue-os/base
If you're forking this repo you should read the docs on keeping secrets in github. You need to generate a new keypair with cosign. The public key can be in your public repo (your users need it to check the signatures), and you can paste the private key in Settings -> Secrets -> Actions with the name SIGNING_SECRET.
- Build container
A container build can be invoked by simply running:
$ podman build \
--file build.Containerfile \
--tag build-test:latest
$ podman build \
--file install.Containerfile \
--tag install-test:latest
Or to specify the version of Fedora and/or Nvidia driver:
$ podman build \
--build-arg IMAGE_NAME=silverblue \
--build-arg FEDORA_MAJOR_VERSION=37 \
--build-arg NVIDIA_MAJOR_VERSION=525 \
--file build.Containerfile \
--tag build-test:37-525
$ podman build \
--build-arg IMAGE_NAME=silverblue \
--build-arg FEDORA_MAJOR_VERSION=37 \
--build-arg NVIDIA_MAJOR_VERSION=525 \
--build-arg AKMODS_CACHE=build-test \
--build-arg AKMODS_VERSION=37 \
--file install.Containerfile \
--tag build-test:latest
- Generate signing keys
If you are forking this repo, then you should add a private key to the repository secrets:
$ ./generate-akmod-key
$ gh secret set AKMOD_PRIVKEY < certs/private_key.priv.prod
$ cp certs/public_key.der.prod certs/public_key.der
There is support for enabling Nvidia GPUs in containers. This can can be verified by running the following:
$ podman run \
--user 1000:1000 \
--security-opt=no-new-privileges \
--cap-drop=ALL \
--security-opt label=type:nvidia_container_t \
docker.io/mirrorgooglecontainers/cuda-vector-add:v0.1
Additional runtime packages are added for enabling hardware-accelerated video playback. This can the enabled in Firefox (RPM or flatpak) by setting the following options to true
in about:config
:
gfx.webrender.all
media.ffmpeg.vaapi.enabled
Extensive host access and reduced sandboxing is needed for Firefox flatpak to use /usr/lib64/dri/nvidia_drv_video.so
:
$ flatpak override \
--user \
--filesystem=host-os \
--env=LIBVA_DRIVER_NAME=nvidia \
--env=LIBVA_DRIVERS_PATH=/run/host/usr/lib64/dri \
--env=LIBVA_MESSAGING_LEVEL=1 \
--env=MOZ_DISABLE_RDD_SANDBOX=1 \
--env=NVD_BACKEND=direct \
org.mozilla.firefox
Thanks to Alex Diaz for advice, and who got this working first, check out this repo: