Skip to content

[no-relnote] cleanup /etc/cdi/nvidia.yaml on uninstall #1177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcpunk
Copy link
Contributor

@jcpunk jcpunk commented Jul 8, 2025

This PR adds a cleanup of /etc/cdi/nvidia.yaml upon uninstallation (not upgrade) of the nvidia-container-toolkit-base package.

When things are truly screwed up on my system, uninstall and reinstall of the nvidia components is a quick way to get back to a known state. However, since the current packages don't track the CDI config, a broken nvidia.yaml can persist on the system. If I don't remember I generated this file, I wont remember to remake it. My existing config management notices when the file is missing and builds it automatically.

Copy link

copy-pr-bot bot commented Jul 8, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@elezar elezar requested a review from ArangoGutierrez July 8, 2025 18:18
@elezar elezar assigned elezar and ArangoGutierrez and unassigned elezar Jul 8, 2025
@ArangoGutierrez ArangoGutierrez requested a review from Copilot July 9, 2025 09:21
Copilot

This comment was marked as outdated.

@jcpunk jcpunk force-pushed the ghost-file-config branch 2 times, most recently from b915e99 to 4f566c7 Compare July 9, 2025 15:46
@ArangoGutierrez ArangoGutierrez requested a review from Copilot July 9, 2025 16:07
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds cleanup of the generated /etc/cdi/nvidia.yaml file when uninstalling the NVIDIA container toolkit packages.

  • Marks /etc/cdi/nvidia.yaml as a ghost config in the RPM spec
  • Adjusts Debian postrm hooks to remove the toolkit symlink on remove and clean up nvidia.yaml in the base package
  • Introduces a new Debian postrm script for the base package to delete the stale nvidia.yaml on purge/remove

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packaging/rpm/SPECS/nvidia-container-toolkit.spec Declares /etc/cdi/nvidia.yaml as a %config(noreplace) %ghost
packaging/debian/nvidia-container-toolkit.postrm Expands purge to `purge
packaging/debian/nvidia-container-toolkit-base.postrm New script to delete /etc/cdi/nvidia.yaml on purge/remove
Comments suppressed due to low confidence (1)

packaging/debian/nvidia-container-toolkit-base.postrm:7

  • [nitpick] There’s no automated test verifying that /etc/cdi/nvidia.yaml is removed on purge/remove. Adding a simple integration test for the postrm behavior would help catch regressions.
        /bin/rm -f /etc/cdi/nvidia.yaml

Copy link
Collaborator

@ArangoGutierrez ArangoGutierrez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - @elezar ?

@jcpunk jcpunk force-pushed the ghost-file-config branch from 4f566c7 to a1acd4e Compare July 9, 2025 16:09
@coveralls
Copy link

Pull Request Test Coverage Report for Build 16174536002

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 35.012%

Totals Coverage Status
Change from base Build 16172620400: 0.0%
Covered Lines: 4442
Relevant Lines: 12687

💛 - Coveralls

Copy link
Member

@elezar elezar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to note is that the /etc/cdi/nvidia.yaml file is ENTIRELY user created. I can see a case being made for removing /var/run/cdi/nvidia.yaml, but removing user-generated content when uninstalling packages seems incorrect.

@jcpunk
Copy link
Contributor Author

jcpunk commented Jul 10, 2025

I'm not sure /etc/cdi/nvidia.yaml makes any sense on the filesystem if the package is removed. If the package is removed and then installed again, shouldn't the user be required to regenerate the config?

@jcpunk jcpunk force-pushed the ghost-file-config branch from a1acd4e to 5596450 Compare July 10, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants