[Bug]: an empty --drop-in-config overwrites the engine config with drop-in-only content
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start from cmd/nvidia-ctk/runtime/configure/configure.go (validateFlags and getOutputConfigPath), then pkg/config/engine/crio and pkg/config/engine/containerd where the destination is seeded with toml.NewEmpty() / ConfigWithDropIn, plus Options.Flush in the installer which shares the fallback. Decide between rejecting the empty value in validateFlags or using the source config as destination when no drop-in is in play. Done means an empty --drop-in-config either errors or preserves existing runtimes for cri-o and emits the nvidia runtime for containerd. Note an open PR (#2124) already targets this issue, so coordinate before starting.
Written by the indexing model from the issue text.
Description
Describe the bug
An empty --drop-in-config writes drop-in-only content over the top-level engine config. For cri-o that means every runtime already in crio.conf is replaced by the nvidia one; for containerd it means the nvidia runtime does not end up anywhere, and the config gains an imports glob pointing at its own directory. Both report success and exit 0.
The empty value is not a nonsense input, it is the value the code uses for docker, and validateFlags does not reject it for the other engines. docker.New returns a plain in-place config, so nothing goes wrong there. crio.New seeds its destination with toml.NewEmpty() and containerd.New seeds it with only the CRI plugin section wrapped in ConfigWithDropIn, so for those two the destination is always a drop-in tree, while getOutputConfigPath falls back to the top-level path when the drop-in path is empty.
The installer has the same fallback in Options.Flush, and RUNTIME_DROP_IN_CONFIG="" reaches it, since the flag's value source is os.LookupEnv, which reports an empty variable as set. That is the obvious way to turn drop-ins off from the GPU Operator.
To Reproduce
cri-o. Starting from a config with another runtime in it:
$ cat crio.conf
[crio]
[crio.runtime]
default_runtime = "crun"
[crio.runtime.runtimes]
[crio.runtime.runtimes.crun]
runtime_path = "/usr/bin/crun"
runtime_type = "oci"
$ nvidia-ctk runtime configure --runtime=crio --config=$PWD/crio.conf --drop-in-config=
INFO Wrote updated config to /tmp/dropin/crio.conf
INFO It is recommended that crio daemon be restarted.
$ cat crio.conf
[crio]
[crio.runtime]
[crio.runtime.runtimes]
[crio.runtime.runtimes.nvidia]
runtime_path = "/usr/bin/nvidia-container-runtime"
runtime_type = "oci"
default_runtime and the crun definition are gone, so cri-o comes up with no default runtime.
containerd, starting from a v2 config with runc and a cni section:
$ nvidia-ctk runtime configure --runtime=containerd --config=$PWD/config.toml --drop-in-config=
INFO Wrote updated config to /tmp/dropin/config.toml
$ head -2 config.toml
imports = ["/tmp/dropin/*.toml"]
version = 2
$ grep -c runtimes.nvidia config.toml
0
The original content survives here, but the nvidia runtime is not in the file at all, so --runtime nvidia and RuntimeClass nvidia fail. ConfigWithDropIn.Save writes the drop-in to the top-level path and then overwrites that same path with the top-level tree, which is also where the self-referential imports glob comes from.
With the default sentinel --drop-in-config both runtimes behave correctly, which is what isolates the empty value as the trigger.
Expected behavior
Either the empty value is rejected for containerd and cri-o, the way the docker combination is already rejected in validateFlags, or the engines honour it by using the source config as the destination when no drop-in is in play. The second is the better of the two, since Options.Flush in the installer has the identical fallback and would otherwise stay broken.
Environment
nvidia-container-toolkitversion: built frommainat a672e378, and the paths are unchanged on the current tip- Host OS: this was reproduced with
nvidia-ctkbuilt and run locally, not on a GPU node; the code path is the TOML config handling incmd/nvidia-ctk/runtime/configure/configure.goandpkg/config/engine/{crio,containerd}, which does not touch the driver - CPU Architecture: arm64
Happy to send a PR for whichever of the two shapes you prefer.
- Dominant language
- Go
- Stars
- 4.6k
- Forks
- 609
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 36
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NVIDIA/nvidia-container-toolkit
-
[Bug]: Containers with NVIDIA_VISIBLE_DEVICES=all fail to start in jit-cdi mode when every GPU is bound to vfio-pciPossibly taken @efegokdemir claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
NVIDIA/nvidia-container-toolkit#2163 ·
Maintainers usually reply within 1 day
-
Address TODO comments in internal/platform-support/dgpu/dgpu.goPossibly taken @truongbo17 claimed this 32 days ago. Opendsx-ws-0930 good-first-issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NVIDIA/nvidia-container-toolkit#2114 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug]: nvidia-ctk runtime configure --runtime=docker without --set-as-default leaves default-runtime set to nvidiaPossibly taken @blacksoxx claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
NVIDIA/nvidia-container-toolkit#2155 ·
Maintainers usually reply within 1 day
-
[Bug]: Containerized installer removes the existing Toolkit installation before the replacement is complete and durablePossibly taken @henry118 claimed this 12 days ago. Openbug needs-triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
NVIDIA/nvidia-container-toolkit#2153 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
NVIDIA/nvidia-container-toolkit#2147 · 1 comment ·
Maintainers usually reply within 1 day
All issues in NVIDIA/nvidia-container-toolkit
Similar issues
-
needs-area
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Azure/typespec-azure#5936 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
Fix mode unpins a reusable workflow call when the same repository is also used as a step actionOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
github/gh-actions-lock#261 ·
Maintainers usually reply within 1 day
-
bug documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
labmonkeys-space/nl6#974 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100