Attempt to fix nvidia akmod build

This commit is contained in:
Ben Radey
2025-11-23 14:21:42 -05:00
parent bb6256a913
commit a94a93af1c
3 changed files with 9 additions and 4 deletions
+4 -2
View File
@@ -1,8 +1,10 @@
FROM ghcr.io/benradey/workstation-nvidia-base:latest FROM ghcr.io/benradey/workstation-nvidia-base:latest
# Build nvidia akmod with flag that produces proprietary kernal driver for older hardware # Build nvidia akmod with flag that produces proprietary kernal driver for older hardware
RUN sudo sh -c 'echo "%_without_kmod_nvidia_detect 1" > /etc/rpm/macros.nvidia-kmod' RUN sudo sh -c 'echo "%_without_kmod_nvidia_detect 1" > /etc/rpm/macros.nvidia-kmod' && \
RUN /usr/sbin/akmods --force --kernels "$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" mkdir -p /var/log/akmods /var/cache/akmods/nvidia /var/tmp && \
chmod 777 /var/tmp && \
/usr/sbin/akmods --force --kernels "$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')"
# The first check makes sure that we have exactly 4 gpg pubkeys trusted in the rpmdb (the ones from the base image). # The first check makes sure that we have exactly 4 gpg pubkeys trusted in the rpmdb (the ones from the base image).
# Any more than that means that dnf automatically added a new one, which is shady! # Any more than that means that dnf automatically added a new one, which is shady!
+3 -1
View File
@@ -1,7 +1,9 @@
FROM ghcr.io/benradey/workstation-nvidia-base:latest FROM ghcr.io/benradey/workstation-nvidia-base:latest
# Build nvidia akmod with no special arguments - defaults to open kernel driver for newer hardware # Build nvidia akmod with no special arguments - defaults to open kernel driver for newer hardware
RUN /usr/sbin/akmods --force --kernels "$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" RUN mkdir -p /var/log/akmods /var/cache/akmods/nvidia /var/tmp && \
chmod 777 /var/tmp && \
/usr/sbin/akmods --force --kernels "$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')"
RUN dnf5 install -y \ RUN dnf5 install -y \
dkms \ dkms \
+2 -1
View File
@@ -48,7 +48,8 @@ RUN rpm --import \
RUN dnf5 install -y \ RUN dnf5 install -y \
akmod-nvidia \ akmod-nvidia \
xorg-x11-drv-nvidia-cuda \ xorg-x11-drv-nvidia-cuda \
proton-vpn-gnome-desktop || true proton-vpn-gnome-desktop || true && \
dnf5 clean all
# TODO: Remove these unnecessary checks to make sure the packages above actually got installed. rpm exits non-zero if the package is not installed and aborts the Containerfile build # TODO: Remove these unnecessary checks to make sure the packages above actually got installed. rpm exits non-zero if the package is not installed and aborts the Containerfile build
RUN rpm -q akmod-nvidia && \ RUN rpm -q akmod-nvidia && \
rpm -q xorg-x11-drv-nvidia-cuda && \ rpm -q xorg-x11-drv-nvidia-cuda && \