Skip to content

fix(nvidia): replace /usr overlay mounts with reflink copies so dnf updates survive reboot - #2841

Merged
kummatty merged 1 commit into
awslabs:mainfrom
kummatty:main
Oct 2, 2026
Merged

kummatty merged 1 commit into
awslabs:mainfrom
kummatty:main

Conversation

@kummatty

@kummatty kummatty commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Description of changes:

The NVIDIA driver tree was exposed at /usr/{bin,lib64,share} through overlay mounts, so package updates such as dnf update systemd* wrote into the overlay upperdir instead of the real /usr. On the next boot systemd starts before the overlays are mounted, can't find its new libraries, and the node fails to boot.

This replaces the three mount units with nvidia-copy-usr@.service, run as @bin, @lib64 and @share in parallel after nvidia-driver-resolve. Each instance copies the tree's entries into the real directory once with cp -a --reflink=auto, and a per-directory marker skips it on later boots.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Testing Done

  • Built the AL2023 NVIDIA AMI for Kubernetes 1.35.
  • Performance: compared first-boot timings against the overlay-mount AMI on g4dn.xlarge, g6.xlarge, g6.8xlarge, g6f.xlarge, g7.8xlarge and p4d.24xlarge. On average the copy services take less than 1s longer than the overlay mounts. This is on a custom AMI which suffers from cold EBS hydration, so I would assume it would be insignificant on an actual public AMI.
  • Functional: Sanity nvidia as well as SELinux label tests passed. Also tested updating systemd and reboot.

@kummatty
kummatty requested a review from a team as a code owner October 1, 2026 19:18

@mselim00 mselim00 left a comment

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.

lgtm, some minor notes

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/bin/bash -c 'shopt -s dotglob; cp -a --reflink=auto /opt/nvidia/current/usr/%i/* /usr/%i/'

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.

I tried using a simple /usr/bin/cp command for this instead of a shell, but doing cp src/. desc/ carries the execution mode of src into dest. The exec mode for /opt/$TREE/usr/lib64 gets copied over to /usr/lib64

@@ -0,0 +1,18 @@
[Unit]

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.

Can we add coverage in validate.sh for this and the other new units?

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.

I don't think there is anything meaningful we can add to validate, besides what's already defined within the units. We are planning to add build validations, for the exact files we copy outside of validate. Please let me know if you have a specific validations in mind?

@kummatty
kummatty merged commit c087c7f into awslabs:main Oct 2, 2026
2 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.

3 participants