Pass ldconfig.real instead of ldconfig to nvidia-container-cli when available.

Compare nvidia-container-toolkit:internal/config/config.go:getLdConfigPath().

Updates #9083

PiperOrigin-RevId: 540009997
This commit is contained in:
Jamie Liu
2023-06-13 10:50:10 -07:00
committed by gVisor bot
parent 084a502256
commit a0ed98b45d
+6 -3
View File
@@ -1702,9 +1702,12 @@ func nvproxyUpdateAppRootFilesystem(spec *specs.Spec, conf *config.Config) error
if err != nil {
return fmt.Errorf("failed to locate nvidia-container-cli in PATH: %w", err)
}
ldconfigPath, err := exec.LookPath("ldconfig")
if err != nil {
return fmt.Errorf("failed to locate ldconfig in PATH: %w", err)
// On Ubuntu, ldconfig is a wrapper around ldconfig.real, and we need the latter.
var ldconfigPath string
if _, err := os.Stat("/sbin/ldconfig.real"); err == nil {
ldconfigPath = "/sbin/ldconfig.real"
} else {
ldconfigPath = "/sbin/ldconfig"
}
// nvidia-container-cli does not create this directory.