Troubleshooting Guide¶
Common issues and solutions for Mock NVML.
Build Issues¶
CGo Not Enabled¶
Error:
Solution:
# Ubuntu/Debian
sudo apt-get install build-essential
# RHEL/CentOS
sudo yum groupinstall "Development Tools"
# macOS
xcode-select --install
Go Version Too Old¶
Error:
Solution:
# Install Go 1.25+
wget https://go.dev/dl/go1.25.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.25.0.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
Build on macOS¶
Problem: Cannot build shared library on macOS for Linux.
Solution: Use Docker build:
Runtime Issues¶
Library Not Found¶
Error:
Solution:
# Verify library exists
ls -la pkg/gpu/mocknvml/libnvidia-ml.so*
# Set library path correctly
export LD_LIBRARY_PATH=$(pwd)/pkg/gpu/mocknvml:$LD_LIBRARY_PATH
# Or use absolute path
LD_LIBRARY_PATH=/full/path/to/pkg/gpu/mocknvml nvidia-smi
Symbol Not Found¶
Error:
Solution:
-
Check if symbol is exported:
-
If missing, check if it's a stub or needs implementation:
Segmentation Fault¶
Error:
Causes and Solutions:
- Handle dereferencing issue:
- Enable debug mode:
MOCK_NVML_DEBUG=1 - Check which function crashes
-
Verify handle table is working
-
CGo memory issue:
-
Run with address sanitizer:
-
nvidia-smi version mismatch:
- Ensure driver version in config matches nvidia-smi expectation
- Try different nvidia-smi versions
YAML Config Not Loading¶
Error:
Solution:
-
Verify file exists and is readable:
-
Validate YAML syntax:
-
Check required fields:
-
Enable debug to see specific error:
nvidia-smi Shows Wrong Values¶
Problem: Values don't match YAML config.
Solution:
-
Verify config is loaded:
-
Check device override vs defaults:
- Per-device settings override defaults
-
Check
devices:section in YAML -
Verify field mapping:
- Some nvidia-smi fields map to different config fields
- Check Configuration Reference
NOT_SUPPORTED Errors¶
Problem: nvidia-smi shows "N/A" or errors for some queries.
Explanation: Functions return NOT_SUPPORTED when:
- YAML config doesn't provide the value
- Function is not implemented (stub)
Solution:
-
Add missing config values:
-
Check if function is implemented:
Testing Issues¶
Integration Test Fails¶
Error:
Solution:
-
Ensure mock library is built:
-
Check library is accessible in Docker:
Race Conditions¶
Error:
Solution:
- All Engine methods should use mutex
- Check that new code acquires locks properly
- Run tests with race detector: go test -race ./...
Performance Issues¶
Slow Startup¶
Problem: nvidia-smi takes long to start.
Causes: 1. Large YAML config parsing 2. Debug logging enabled
Solution:
Memory Usage¶
Problem: High memory usage.
Explanation: - Each handle allocates ~40 bytes of C memory - Error string cache grows with unique errors
This is typically not a problem for normal usage.
Environment Issues¶
LD_LIBRARY_PATH Not Working¶
Problem: System uses real NVML despite setting LD_LIBRARY_PATH.
Solutions:
-
Check library search order:
-
Verify no cached libraries:
-
Use absolute path:
-
Check for ld.so.conf entries:
Docker Issues¶
Problem: Library doesn't work in Docker container.
Solutions:
-
Mount library correctly:
-
Ensure nvidia-smi is available:
-
Use correct architecture:
kind load docker-image Fails with "content digest not found"¶
Problem: Loading the published image into a kind cluster fails:
ERROR: command "docker exec --privileged -i <node> ctr --namespace=k8s.io images import -"
failed with error: exit status 1
ctr: content digest sha256:...: not found
Cause: ghcr.io/nvidia/nvml-mock is a multi-arch image. Docker Desktop's
containerd image store keeps the whole manifest list, and kind load
docker-image hands the node an archive whose per-platform layers it does not
have. The error names the digest, not the cause. This is the default Docker
Desktop configuration on macOS.
Solution: save a single platform and load the archive:
ARCH=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')
docker save --platform "linux/${ARCH}" ghcr.io/nvidia/nvml-mock:latest -o nvml-mock.tar
kind load image-archive nvml-mock.tar --name <cluster>
The platform must match the kind node's architecture. A locally built image
(docker build -t nvml-mock:local ...) is single-arch already and loads with
kind load docker-image unchanged.
GPU Operator Issues¶
Validator Pod in CrashLoopBackOff¶
Problem: The GPU Operator validator pod repeatedly crashes.
Explanation: The GPU Operator validator (/usr/bin/nvidia-validator) is a
statically-linked Go binary with no shell. It probes the driver root for
expected files.
Solution: Ensure the mock driver root has all required files:
# Use the specific Kind cluster and node name (adjust cluster name as needed)
NODE_CONTAINER="nvml-mock-operator-control-plane"
docker exec "$NODE_CONTAINER" ls -la /run/nvidia/driver/usr/lib64/libnvidia-ml.so*
docker exec "$NODE_CONTAINER" cat /var/lib/nvml-mock/driver/config/config.yaml
CDI Spec Not Generated¶
Problem: CDI specs are not appearing in /var/run/cdi/.
Solution: Check nvml-mock DaemonSet logs for CDI generation errors:
Device Plugin Shows 0 GPUs with GPU Operator¶
Problem: The GPU Operator-managed device plugin reports 0 GPUs.
Solution: Verify the device plugin is using the mock driver root:
The GPU Operator must be installed with --set driver.enabled=false and
--set toolkit.enabled=false when using mock GPUs, since there is no real
NVIDIA driver to manage.
Getting Help¶
Debug Information to Collect¶
When reporting issues, include:
-
Environment:
-
Debug output:
-
Library info:
-
Config file (if using YAML)
-
Expected vs actual output
Filing Issues¶
Include: - Steps to reproduce - Expected behavior - Actual behavior - Debug output - Environment info