Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rootless libpod.conf should fill in an appropriate tmp_dir #2408

Closed
llchan opened this issue Feb 21, 2019 · 9 comments
Closed

Rootless libpod.conf should fill in an appropriate tmp_dir #2408

llchan opened this issue Feb 21, 2019 · 9 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. rootless

Comments

@llchan
Copy link
Contributor

llchan commented Feb 21, 2019

/kind bug

Description

When a libpod.conf is specified via --config, an omitted tmp_dir does not fall back to the default ($XDG_RUNTIME_DIR/libpod/tmp) like it does when --config is not specified. It remains at the empty string, which leads to a fairly obvious but not very user-friendly error downstream.

Steps to reproduce the issue:

  1. Copy the default libpod.conf (which has tmp_dir commented out)

  2. podman --config libpod.conf info

Describe the results you received:

DEBU[0000] Using tmp dir                                
DEBU[0000] Set libpod namespace to ""                   
DEBU[0000] [graphdriver] trying provided driver "vfs"   
ERRO[0000] could not get runtime: error creating tmpdir : mkdir : no such file or directory 

Describe the results you expected:

DEBU[0000] Using tmp dir /run/user/XXXXX/libpod/tmp     
DEBU[0000] Set libpod namespace to ""                   
DEBU[0000] [graphdriver] trying provided driver "vfs"

Output of podman version:

RemoteAPI Version:  1
Go Version:         go1.11
Git Commit:         eb6243226a08254f15657c3728bb4dd8949ee6cd
Built:              Thu Feb 21 17:13:21 2019
OS/Arch:            linux/amd64
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 21, 2019
@llchan
Copy link
Contributor Author

llchan commented Feb 21, 2019

This diff fixes things (awaiting approval to submit PRs, but pasting this here since it's small and harmless):

diff --git a/libpod/runtime.go b/libpod/runtime.go
index 94dbf37d..a8bb4b9f 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -472,6 +472,12 @@ func NewRuntimeFromConfig(configPath string, options ...RuntimeOption) (runtime
    runtime.config.OCIRuntime = defaultRuntimeConfig.OCIRuntime
    runtime.config.StorageConfig = storage.StoreOptions{}

+   tmpDir, err := getDefaultTmpDir()
+   if err != nil {
+       return nil, err
+   }
+   runtime.config.TmpDir = tmpDir
+
    // Check to see if the given configuration file exists
    if _, err := os.Stat(configPath); err != nil {
        return nil, errors.Wrapf(err, "error checking existence of configuration file %s", configPath)

On a more general note, is there a reason why we don't initialize with defaultRuntimeConfig, and let the user-supplied config overwrite (i.e. more similar to what NewRuntime does)?

@giuseppe
Copy link
Member

the patch LGTM

@rhatdan
Copy link
Member

rhatdan commented Feb 22, 2019

Could someone open this as a PR?

@rhatdan
Copy link
Member

rhatdan commented Feb 23, 2019

This seems to be working for me in current podman?

$ podman --log-level debug --config ~/.config/containers/libpod.conf info  2>&1 | grep -i "Using tmp"
time="2019-02-23T06:11:43-05:00" level=debug msg="Using tmp dir /run/user/3267/libpod/tmp" 
$ grep tmp ~/.config/containers/libpod.conf

@llchan
Copy link
Contributor Author

llchan commented Feb 25, 2019

@rhatdan maybe you need to remove your existing db config?

@giuseppe
Copy link
Member

I see the same problem with a fresh storage. I confirm the patch above fixes the problem.

@llchan could you open a PR?

@llchan
Copy link
Contributor Author

llchan commented Feb 27, 2019

I unfortunately cannot yet, still pending approval from manager and he's out of town for the week. Will do as soon as I can. If you'd like to file it on my behalf feel free to.

@rhatdan
Copy link
Member

rhatdan commented Feb 27, 2019

Ok, @llchan We would love to have you to contribute, once you get permission.. @giuseppe Can you open a PR.

giuseppe added a commit to giuseppe/libpod that referenced this issue Mar 4, 2019
Closes: containers#2408

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Member

giuseppe commented Mar 4, 2019

I've opened a PR here: #2515

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. rootless
Projects
None yet
Development

No branches or pull requests

4 participants