diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/libpodruntime/runtime.go | 15 | ||||
-rw-r--r-- | cmd/podman/main.go | 4 |
2 files changed, 15 insertions, 4 deletions
diff --git a/cmd/podman/libpodruntime/runtime.go b/cmd/podman/libpodruntime/runtime.go index b48667653..098864810 100644 --- a/cmd/podman/libpodruntime/runtime.go +++ b/cmd/podman/libpodruntime/runtime.go @@ -6,6 +6,7 @@ import ( "path/filepath" "github.com/containers/storage" + "github.com/pkg/errors" "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/pkg/rootless" "github.com/urfave/cli" @@ -23,7 +24,11 @@ func GetRuntime(c *cli.Context) (*libpod.Runtime, error) { func GetRootlessStorageOpts() (storage.StoreOptions, error) { var opts storage.StoreOptions - opts.RunRoot = filepath.Join(libpod.GetRootlessRuntimeDir(), "run") + rootlessRuntime, err := libpod.GetRootlessRuntimeDir() + if err != nil { + return opts, err + } + opts.RunRoot = filepath.Join(rootlessRuntime, "run") dataDir := os.Getenv("XDG_DATA_HOME") if dataDir == "" { @@ -31,7 +36,13 @@ func GetRootlessStorageOpts() (storage.StoreOptions, error) { if home == "" { return opts, fmt.Errorf("neither XDG_DATA_HOME nor HOME was set non-empty") } - dataDir = filepath.Join(home, ".local", "share") + // runc doesn't like symlinks in the rootfs path, and at least + // on CoreOS /home is a symlink to /var/home, so resolve any symlink. + resolvedHome, err := filepath.EvalSymlinks(home) + if err != nil { + return opts, errors.Wrapf(err, "cannot resolve %s", home) + } + dataDir = filepath.Join(resolvedHome, ".local", "share") } opts.GraphRoot = filepath.Join(dataDir, "containers", "storage") opts.GraphDriverName = "vfs" diff --git a/cmd/podman/main.go b/cmd/podman/main.go index a83dc5fb4..3dbf196c2 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -29,13 +29,13 @@ func main() { debug := false cpuProfile := false - became, err := rootless.BecomeRootInUserNS() + became, ret, err := rootless.BecomeRootInUserNS() if err != nil { logrus.Errorf(err.Error()) os.Exit(1) } if became { - os.Exit(0) + os.Exit(ret) } if reexec.Init() { |