Skip to content

Conversation

@pmenzel
Copy link
Contributor

No description provided.

`N` is the result of an arithmetic expansion, so it is never empty, and
`[ ! -z $N ]` is always true.  Even with zero counted controllers,
/dev/nvidiactl is created and nvidia-uvm, nvidia-modeset and nvidia-drm
are loaded:

    $ N=$(( 0 + 0 )); if [ ! -z $N ]; then echo "taken, N=$N"; fi
    taken, N=0

Test for a positive count instead.

Assisted-by: claude-opus-5.5 (Claude Code)
`mknod` fails if the node already exists, for example when the service
is restarted:

    mknod: /dev/nvidiactl: File exists

Add the helper `make_chardev`, which removes an existing node before
creating it.  Recreating it, instead of skipping it, also makes sure
the node has the current major number, which is assigned dynamically
for nvidia-uvm.

Assisted-by: claude-opus-5.5 (Claude Code)
The variable `nvver` first holds the PCI ID of the first NVIDIA card,
and is later reused for the driver version.  Store the PCI ID in
`pciid` instead.

Also, fill the array with `mapfile` instead of word splitting, which
shellcheck warns about:

    In nvidiactl/nvidiactl line 29:
    nvidiacards=( $(lspci -n | grep " 030[0,2]: 10de:" | cut -d ' ' -f 3) )
                  ^-- SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).

While at it, quote the variable in the emptiness test.

Assisted-by: claude-opus-5.5 (Claude Code)
@pmenzel Paul Menzel (pmenzel) merged commit c2478a2 into master Oct 14, 2026
@pmenzel Paul Menzel (pmenzel) deleted the nvidiactl-fix-device-nodes branch October 14, 2026 13:20
Sign in to join this conversation on GitHub.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant