From a94a93af1c16b48249de9208a37b0bcb995a31ff Mon Sep 17 00:00:00 2001 From: Ben Radey Date: Sun, 23 Nov 2025 14:21:42 -0500 Subject: [PATCH] Attempt to fix nvidia akmod build --- Containerfile-asrock-x570 | 6 ++++-- Containerfile-lenovo-16arh7h | 4 +++- Containerfile-workstation-nvidia-base | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Containerfile-asrock-x570 b/Containerfile-asrock-x570 index cbeed5e..b67884a 100644 --- a/Containerfile-asrock-x570 +++ b/Containerfile-asrock-x570 @@ -1,8 +1,10 @@ FROM ghcr.io/benradey/workstation-nvidia-base:latest # 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 /usr/sbin/akmods --force --kernels "$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" +RUN sudo sh -c 'echo "%_without_kmod_nvidia_detect 1" > /etc/rpm/macros.nvidia-kmod' && \ + 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). # Any more than that means that dnf automatically added a new one, which is shady! diff --git a/Containerfile-lenovo-16arh7h b/Containerfile-lenovo-16arh7h index a6c041e..ff56ed2 100644 --- a/Containerfile-lenovo-16arh7h +++ b/Containerfile-lenovo-16arh7h @@ -1,7 +1,9 @@ FROM ghcr.io/benradey/workstation-nvidia-base:latest # 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 \ dkms \ diff --git a/Containerfile-workstation-nvidia-base b/Containerfile-workstation-nvidia-base index 4070044..3ddede4 100644 --- a/Containerfile-workstation-nvidia-base +++ b/Containerfile-workstation-nvidia-base @@ -48,7 +48,8 @@ RUN rpm --import \ RUN dnf5 install -y \ akmod-nvidia \ 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 RUN rpm -q akmod-nvidia && \ rpm -q xorg-x11-drv-nvidia-cuda && \