Skip to content

Improve Nvidia compatibility with multilib based containers - #1831

Open
angiglesias wants to merge 6 commits into
containers:mainfrom
angiglesias:improve-nvidia-multilib-compat
Open

Improve Nvidia compatibility with multilib based containers#1831
angiglesias wants to merge 6 commits into
containers:mainfrom
angiglesias:improve-nvidia-multilib-compat

Conversation

@angiglesias

@angiglesias angiglesias commented Aug 2, 2026

Copy link
Copy Markdown

Introduces a new container persistent configuration package with a helper library to manage persistent additional tunables and configuration for toolbx containers, such as environment variables.

This new mechanism is then used to patch in multilib based distros containers patching the GBM implementations dynamic loading done by libglvnd and egl-gbm by injecting the environment variable GBM_BACKENDS_PATH pointing to mounted from fedora host Nvidia libraries locations (/usr/lib64/gbm) and container multilib search path (usually /usr/lib/x86_64-linux-gnu/gbm or /usr/lib/aarch64-linux-gnu/gbm depending on host arch).

Currently the system is only used by this workaround to improve nvidia compatibility with mutilib containers, but it can be easily extended for further tunables or specify additional environment variables when the container is created with toolbox create

Includes #1810

NVIDIA Container Toolkit 1.19.1 requires Go >= 1.25 and introduces various
format changes in mount options[1].
The new mounts options now include rbind and rprivate options, provoking an
error when the mount command gets those options and a --rbind flag. A new
mountExt helper function is added and a minimal adapter mountBind is preserved
to avoid breaking compat with existing calls.

[1] NVIDIA Container Toolkit commit d0103aa
    NVIDIA/nvidia-container-toolkit@d0103aa

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Adds the helper function GetMultilibDir to discover if a container
is using a multilib linux distro

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Adds a new config package that will manage persistent container config,
such as custom environment variables and prepare way to introduce new tunables
in the future.
The configurations will be serialez to a JSON file stored in the toolbox config
directory ($HOME/.config/toolbox/<container>-config.json)

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Use new persistent config library to load container config and injects
additional environment variables to the command to be run

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
…stros

Use container persistent config (pkg/config) to patch the environment var
GBM_BACKENDS_PATH when a container using multilib is detected.

The Nvidia CDI specs generated in fedora will point the nvidia libraries to
/usr/lib64 while multilib systems will (usually) expect them in
/usr/lib/x86_64-linux-gnu or /usr/lib/aarch64-linux-gnu.
While the libraries are indexed using using ldconfig with the config fragment
toolbx-nvidia.conf generated by toolbox, some apps and frameworks will still
lookup for dynamic libraries under the multilib path. This happens with
libglvnd looking up for GBM backends, but can be instructed custom lookup
paths wiith the environment variable GBM_BACKENDS_PATH

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@angiglesias
angiglesias marked this pull request as ready for review August 2, 2026 12:59
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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.

1 participant