podman: Error creating /run/user/0/containers on podman login
Is this a BUG REPORT or FEATURE REQUEST?:
/kind bug
Description
On a fresh Fedora 27 Cloud Base image, I ran dnf update && dnf install podman buildah, then ran this:
[fedora@buildah-fresh ~]$ sudo su -
[root@buildah-fresh ~]# podman login quay.io
Username: rturk
Password:
error creating directory "/run/user/0/containers": mkdir /run/user/0/containers: no such file or directory
[root@buildah-fresh ~]#
Describe the results you expected:
I expected to successfully log in, but was not able to.
Additional information you deem important (e.g. issue happens only occasionally):
If I run mkdir -p /run/user/0/containers, I am able to successfully log in subsequently.
[root@buildah-fresh ~]# mkdir -p /run/user/0/containers
[root@buildah-fresh ~]# podman login quay.io
Username: rturk
Password:
Login Succeeded!
Asked a colleague, ipbabble, who does not have a /run/user/0 directory and is somehow able to successfully run podman login.
Output of podman version:
Version: 0.2.2
Go Version: go1.9.4
OS/Arch: linux/amd64
Additional environment details (AWS, VirtualBox, physical, etc.):
Fedora Cloud Base 27, running in Red Hat OpenStack Platform:
[root@buildah-fresh ~]# cat /etc/redhat-release
Fedora release 27 (Twenty Seven)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 54 (39 by maintainers)
I suspect the issue is that we did most of our dev/testing under Fedora workstation & similar. If it’s as simple as creating
/run/user/$UIDif it doesn’t exist, we can do that easily. I’d like to read more on XDG_RUNTIME_DIR before putting that in, though.I did bit of googling and read some docs and see that directory in
/run/user/<UID>is created bypam_systemdwhich sets defaultXDG_RUNTIME_DIR.From freedesktop org docs it states, pam_systemd — Register user sessions in the systemd login manager. So below is what I see is happening.
If you login with an user, the corresponding
/run/user/<UID>is created bysystemd-logind.service(pam_systemd).On the other hand if you login with
Xuser and thensutoYuser, then the directory is not created forYuser. Because theYuser has not logged in throughsystemd-login.Re-posting from https://github.com/containers/image/pull/424 to keep the conversation in one place:
I’m not convinced about auto-creating
/run/user/$UID;/run/useris, at least on my system,root:root 755, so any non-root user is not going to benefit.It seems to me that if the real fix for that needs to be in some quite different place.
pam_systemd(8), it removes/run/userwhen “the last concurrent session of a user ends”; so, if we created the directory withoutsystemdknowing about the session, it can delete the directory at an unpredictable time when some other session terminates.pam_systemdconfigured in thesystem-authconfig, which is used bysu. The failure is actuallySo, overall, either
pam_systemdneeds to be taught to handlesu, or we need to move away from/run/user, or we would have to give up onsu/sudo(which seems untenable).FYI, if I follow those commands up with another podman pull without --creds, it does not work: