Skip to content

Commit a95232d

Browse files
author
Evan Lezar
committed
Merge branch 'CNT-4144/non-ldcache' into 'main'
Only update ldcache if it exists See merge request nvidia/container-toolkit/container-toolkit!369
2 parents cd6fcb5 + 29c6288 commit a95232d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## v1.13.1
44

5-
* Bump version to 1.13.1
5+
* Update `update-ldcache` hook to only update ldcache if it exists.
6+
* Update `update-ldcache` hook to create `/etc/ld.so.conf.d` folder if it doesn't exist.
67

78
## v1.13.0
89

cmd/nvidia-ctk/hook/update-ldcache/update-ldcache.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ func (m command) run(c *cli.Context, cfg *config) error {
8484
return fmt.Errorf("failed to determined container root: %v", err)
8585
}
8686

87+
_, err = os.Stat(filepath.Join(containerRoot, "/etc/ld.so.cache"))
88+
if err != nil && os.IsNotExist(err) {
89+
m.logger.Debugf("No ld.so.cache found, skipping update")
90+
return nil
91+
}
92+
8793
err = m.createConfig(containerRoot, cfg.folders.Value())
8894
if err != nil {
8995
return fmt.Errorf("failed to update ld.so.conf: %v", err)
@@ -105,6 +111,10 @@ func (m command) createConfig(root string, folders []string) error {
105111
return nil
106112
}
107113

114+
if err := os.MkdirAll(filepath.Join(root, "/etc/ld.so.conf.d"), 0755); err != nil {
115+
return fmt.Errorf("failed to create ld.so.conf.d: %v", err)
116+
}
117+
108118
configFile, err := os.CreateTemp(filepath.Join(root, "/etc/ld.so.conf.d"), "nvcr-*.conf")
109119
if err != nil {
110120
return fmt.Errorf("failed to create config file: %v", err)

0 commit comments

Comments
 (0)