Skip to content

Commit

Permalink
Merge pull request #527 from elezar/increase-priority-of-injected-libs
Browse files Browse the repository at this point in the history
Increase priority of ld.so.conf.d config file
  • Loading branch information
elezar committed Jun 17, 2024
2 parents ae074e7 + 4f0de9f commit fe5a44c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/nvidia-cdi-hook/update-ldcache/update-ldcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ func (m command) resolveLDConfigPath(path string) string {
return strings.TrimPrefix(config.NormalizeLDConfigPath("@"+path), "@")
}

// createConfig creates (or updates) /etc/ld.so.conf.d/nvcr-<RANDOM_STRING>.conf in the container
// createConfig creates (or updates) /etc/ld.so.conf.d/00-nvcr-<RANDOM_STRING>.conf in the container
// to include the required paths.
// Note that the 00-nvcr prefix is chosen to ensure that these libraries have
// a higher precedence than other libraries on the system but are applied AFTER
// 00-cuda-compat.conf.
func (m command) createConfig(root string, folders []string) error {
if len(folders) == 0 {
m.logger.Debugf("No folders to add to /etc/ld.so.conf")
Expand All @@ -165,7 +168,7 @@ func (m command) createConfig(root string, folders []string) error {
return fmt.Errorf("failed to create ld.so.conf.d: %v", err)
}

configFile, err := os.CreateTemp(filepath.Join(root, "/etc/ld.so.conf.d"), "nvcr-*.conf")
configFile, err := os.CreateTemp(filepath.Join(root, "/etc/ld.so.conf.d"), "00-nvcr-*.conf")
if err != nil {
return fmt.Errorf("failed to create config file: %v", err)
}
Expand Down

0 comments on commit fe5a44c

Please sign in to comment.