From 03925e1ca3047c071d98cf619df36eb4a928ba58 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 14 Feb 2025 15:00:46 +0100 Subject: [PATCH] setup-nvidia: Make "current" symlink logic more robust Users have reported that in some cases the nvidia.service fails because /opt/nvidia/current is a directory and the symbolic link gets created inside it. I have no idea how we get there, but to make the service robust in the face of this kind of issue: - remove the directory if it exists - use `-T` with ln to ensure that symbolic link creation fails if `current` is a directory Signed-off-by: Jeremi Piotrowski --- .../x11-drivers/nvidia-drivers/files/bin/setup-nvidia | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/coreos-overlay/x11-drivers/nvidia-drivers/files/bin/setup-nvidia b/sdk_container/src/third_party/coreos-overlay/x11-drivers/nvidia-drivers/files/bin/setup-nvidia index c63b624df9..5cf7a851ac 100644 --- a/sdk_container/src/third_party/coreos-overlay/x11-drivers/nvidia-drivers/files/bin/setup-nvidia +++ b/sdk_container/src/third_party/coreos-overlay/x11-drivers/nvidia-drivers/files/bin/setup-nvidia @@ -88,7 +88,11 @@ SYSEXT_LEVEL=1.0 EOF pushd /opt/nvidia - ln -sfn "${NVIDIA_FLATCAR_VERSION_PAIR}" current + if [[ -d "${NVIDIA_CURRENT_INSTALLATION}" ]] + then + rm -rf "${NVIDIA_CURRENT_INSTALLATION}" + fi + ln -sfn -T "${NVIDIA_FLATCAR_VERSION_PAIR}" "${NVIDIA_CURRENT_INSTALLATION}" popd }