Skip to content

Commit 375bfaa

Browse files
authored
Merge pull request #1160 from ArangoGutierrez/fix_cdi_service
[no-relnote] Fix DEB/RPM systemd install scripts
2 parents b442fe8 + 90dbcd1 commit 375bfaa

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

packaging/debian/nvidia-container-toolkit-base.postinst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ case "$1" in
66
configure)
77
/usr/bin/nvidia-ctk --quiet config --config-file=/etc/nvidia-container-runtime/config.toml --in-place
88

9+
# Enable nvidia-cdi-refresh services on both install and upgrade
910
if command -v systemctl >/dev/null 2>&1 \
1011
&& systemctl --quiet is-system-running 2>/dev/null; then
1112

12-
systemctl daemon-reload || true
13-
14-
if [ -z "$2" ]; then # $2 empty → first install
15-
systemctl enable --now nvidia-cdi-refresh.path || true
16-
fi
13+
systemctl daemon-reload || echo "Warning: Failed to reload systemd daemon" >&2
14+
systemctl enable --now nvidia-cdi-refresh.path || echo "Warning: Failed to enable nvidia-cdi-refresh.path" >&2
15+
systemctl enable --now nvidia-cdi-refresh.service || echo "Warning: Failed to enable nvidia-cdi-refresh.service" >&2
1716
fi
1817
;;
1918

packaging/rpm/SPECS/nvidia-container-toolkit.spec

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,12 @@ if [ $1 -gt 1 ]; then # only on package upgrade
5151
cp -af %{_bindir}/nvidia-container-runtime-hook %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit
5252
fi
5353

54-
# Reload systemd unit cache
54+
# Reload systemd unit cache and enable nvidia-cdi-refresh services on both install and upgrade
5555
if command -v systemctl >/dev/null 2>&1 \
5656
&& systemctl --quiet is-system-running 2>/dev/null; then
57-
systemctl daemon-reload || true
58-
59-
# On fresh install ($1 == 1) enable the path unit so it starts at boot
60-
if [ "$1" -eq 1 ]; then
61-
systemctl enable --now nvidia-cdi-refresh.path || true
62-
fi
57+
systemctl daemon-reload || echo "Warning: Failed to reload systemd daemon" >&2
58+
systemctl enable --now nvidia-cdi-refresh.path || echo "Warning: Failed to enable nvidia-cdi-refresh.path" >&2
59+
systemctl enable --now nvidia-cdi-refresh.service || echo "Warning: Failed to enable nvidia-cdi-refresh.service" >&2
6360
fi
6461

6562
%posttrans

0 commit comments

Comments
 (0)