Skip to content

Move kmod-6.18 nvidia drivers to use overlayfs at boot - #536

Merged
vigh-m merged 3 commits into
bottlerocket-os:developfrom
vigh-m:nvidia-multi-driver/kernel-kit
Sep 18, 2026
Merged

vigh-m merged 3 commits into
bottlerocket-os:developfrom
vigh-m:nvidia-multi-driver/kernel-kit

Conversation

@vigh-m

@vigh-m vigh-m commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description of changes:
Enables the NVIDIA lts (r580) and pb (r595) driver branches to be co-installed on a single Bottlerocket image, with exactly one branch activated at boot. Single-driver images continue to work unchanged.

Both branches previously installed their libraries, binaries, module objects and configs directly onto the canonical system paths (/usr/lib64, /usr/bin, /usr/share/nvidia, /etc/nvidia, ...). This PR moves each branch's files under a per-branch storage root and overlays the selected branch onto the canonical paths at boot.

  • Each branch installs into usr/share/.nvidia/<branch>/ (lts or pb).
  • Per-branch, oneshot services mount overlays that make the storage root's contents appear at the canonical paths:
    • nvidia-<branch>-overlay-driver.service: lib64, bin, share/nvidia, share/vulkan, share/glvnd, share/egl.
    • nvidia-<branch>-overlay-config.service: /etc/nvidia, /etc/nvidia-imex.
  • The /usr/lib64 overlay would otherwise shadow the writable /usr/lib/modules mount, so the base module tree is bound to a /run mount point and re-layered as a lowerdir with a writable upper under /var/lib/kernel-modules/.nvidia.
  • driverdog link/load/copy unit filenames are namespaced per branch (nvidia-lts-* / nvidia-pb-*) so both branches' units coexist without collision. driverdog config tomls are also branch-named and installed normally into the flat /etc/drivers.

New driver file layout

Each branch now lives under its own root, e.g.:

[root@admin]# tree /.bottlerocket/rootfs/usr/share/.nvidia/ -d
/.bottlerocket/rootfs/usr/share/.nvidia/
|-- lts
|   |-- bin
|   |-- etc
|   |   |-- nvidia
|   |   `-- nvidia-imex
|   |-- lib64
|   |   `-- tesla
|   `-- share
|       |-- egl
|       |   `-- egl_external_platform.d
|       |-- glvnd
|       |   `-- egl_vendor.d
|       |-- nvidia
|       |   |-- grid
|       |   |   `-- drivers
|       |   |-- open-gpu
|       |   |   `-- drivers
|       |   `-- tesla
|       |       |-- module-objects.d
|       |       `-- nvswitch
|       `-- vulkan
|           |-- icd.d
|           `-- implicit_layer.d
`-- pb
    |-- bin
    |-- etc
    |   |-- nvidia
    |   `-- nvidia-imex
    |-- lib64
    |   `-- tesla
    `-- share
        |-- egl
        |   `-- egl_external_platform.d
        |-- glvnd
        |   `-- egl_vendor.d
        |-- nvidia
        |   |-- grid
        |   |   `-- drivers
        |   |-- open-gpu
        |   |   `-- drivers
        |   `-- tesla
        |       |-- module-objects.d
        |       `-- nvswitch
        `-- vulkan
            |-- icd.d
            `-- implicit_layer.d

Backwards compatibility

  • A single-driver image installs exactly one branch; its overlay services project that branch onto the canonical paths, giving the same runtime layout as before.

Testing

  • Single-driver lts (r580) image: boots, driver loads, nvidia-smi works
  • Single-driver pb (r595) image: boots, driver loads, nvidia-smi works
  • Overlay mounts present after boot (lib64/bin/share-nvidia/etc-nvidia)
  • Nvidia Smoke test workload on g4dn, g5, g6, g7(595 only)
  • MIG and EFA testing (580 and 595)

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@vigh-m
vigh-m force-pushed the nvidia-multi-driver/kernel-kit branch from 0774264 to 8f3da52 Compare September 9, 2026 21:03
Comment thread packages/kmod-6.18-nvidia-r580/kmod-6.18-nvidia-r580.spec Outdated
ExecStart=/usr/bin/mount -t overlay overlay --options ro,nodev,noatime,lowerdir=__NVIDIA_ROOT__/bin:/usr/bin /usr/bin
ExecStart=/usr/bin/mount -t overlay overlay --options ro,nosuid,nodev,noexec,noatime,lowerdir=__NVIDIA_ROOT__/share/vulkan:/usr/share/vulkan /usr/share/vulkan
ExecStart=/usr/bin/mount -t overlay overlay --options ro,nosuid,nodev,noexec,noatime,lowerdir=__NVIDIA_ROOT__/share/glvnd:/usr/share/glvnd /usr/share/glvnd
ExecStart=/usr/bin/mount -t overlay overlay --options ro,nosuid,nodev,noexec,noatime,lowerdir=__NVIDIA_ROOT__/share/egl:/usr/share/egl /usr/share/egl

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we refresh the host linker cache after mounting the selected driver's overlays?

On dual-branch boots, the existing ldconfig.service runs before branch selection, so its scan cannot see these NVIDIA libraries. The legacy NVIDIA runtime uses that host cache to discover libraries to mount into containers.

Appending the refresh here would keep the existing early ldconfig.service in place and update the cache after the overlays are mounted.

Suggested change
ExecStart=/usr/bin/mount -t overlay overlay --options ro,nosuid,nodev,noexec,noatime,lowerdir=__NVIDIA_ROOT__/share/egl:/usr/share/egl /usr/share/egl
ExecStart=/usr/bin/mount -t overlay overlay --options ro,nosuid,nodev,noexec,noatime,lowerdir=__NVIDIA_ROOT__/share/egl:/usr/share/egl /usr/share/egl
ExecStart=/sbin/ldconfig -X

The PB overlay service needs the same change. Could we also validate this with a legacy-mode GPU container test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah. This isn't really needed. Since we overlay the .so files into /usr/lib64 glibc will fallback to that. Running ldconfig only populates the ldconf.so.cache which has almost no impact on a customers workflow.

When testing by calling nvidia-smi, the binary was discovered as expected so this is safe to omit.

Comment thread packages/kmod-6.18-nvidia-r580/nvidia-lts-overlay-config.service.in Outdated
@vigh-m
vigh-m force-pushed the nvidia-multi-driver/kernel-kit branch from 44fcd59 to e314dab Compare September 16, 2026 20:49
Comment thread packages/kmod-6.18-nvidia-r580/kmod-6.18-nvidia-r580.spec Outdated
@vigh-m
vigh-m force-pushed the nvidia-multi-driver/kernel-kit branch from e314dab to 4580483 Compare September 18, 2026 20:11
Install the driver's libraries, binaries, kernel-module objects,
driverdog tomls and /etc configs under a per-branch storage root
(/usr/nvidia/lts) instead of directly onto the canonical system paths,
and overlay them into place at bootime.

- Add nvidia-lts-overlay-driver.service: a oneshot that overlays lib64,
  bin, share-nvidia, share-vulkan, share-glvnd and share-egl from the
  storage root onto their canonical /usr and /usr/share paths
- Add nvidia-lts-overlay-config.service: overlay etc-nvidia onto
  /etc/nvidia and etc-nvidia-imex onto /etc/nvidia-imex
- Namespace the driverdog module sets and the link/load/copy unit
  filenames under the branch so the overlay wiring is unambiguous

Signed-off-by: Vighnesh Maheshwari <vighmah@amazon.com>
Install the driver's libraries, binaries, kernel-module objects,
driverdog tomls and /etc configs under a per-branch storage root
(/usr/nvidia/fb) instead of directly onto the canonical system paths,
and overlay them into place at bootime.

- Add nvidia-fb-overlay-driver.service: a oneshot that overlays lib64,
  bin, share-nvidia, share-vulkan, share-glvnd and share-egl from the
  storage root onto their canonical /usr and /usr/share paths
- Add nvidia-fb-overlay-config.service: overlay etc-nvidia onto
  /etc/nvidia and etc-nvidia-imex onto /etc/nvidia-imex
- Namespace the driverdog module sets and the link/load/copy unit
  filenames under the branch so the overlay wiring is unambiguous

Signed-off-by: Vighnesh Maheshwari <vighmah@amazon.com>
Adds the full IMEX support and a default-channel modprobe config

- Add nvidia-imex.service, its config.cfg and tmpfiles to the imex
  subpackage.

Signed-off-by: Vighnesh Maheshwari <vighmah@amazon.com>
@vigh-m
vigh-m force-pushed the nvidia-multi-driver/kernel-kit branch from 4580483 to 617e99a Compare September 18, 2026 20:56
@vigh-m
vigh-m merged commit d4cfd11 into bottlerocket-os:develop Sep 18, 2026
3 checks passed
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