From a0ed98b45de0397e75144b0664f45a9a56bc918f Mon Sep 17 00:00:00 2001 From: Jamie Liu Date: Tue, 13 Jun 2023 10:47:04 -0700 Subject: [PATCH] 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 --- runsc/container/container.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runsc/container/container.go b/runsc/container/container.go index a2d6c91a3..34e2f65fa 100644 --- a/runsc/container/container.go +++ b/runsc/container/container.go @@ -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.