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

improve "open /etc/subuid: no such file or directory" error message #1755

Closed
vrothberg opened this issue Nov 4, 2018 · 13 comments
Closed

improve "open /etc/subuid: no such file or directory" error message #1755

vrothberg opened this issue Nov 4, 2018 · 13 comments
Assignees
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@vrothberg
Copy link
Member

Existing openSUSE deployments will run into the issue that /etc/sub{g,u}id are not present as no (base) package added those; useradd and usermod don't create those files. I've fixed this via the shadow package now adding those files so that new installs and new users have proper entries but that doesn't solve the issue for existing users.

In other words, existing users don't have this file and will always run into Podman failing with "open /etc/subuid: no such file or directory". I think Podman should catch those errors and guide the user a bit more, maybe even printing the corresponding section from podman (1).

@rhatdan
Copy link
Member

rhatdan commented Nov 5, 2018

Yes we should give an error that tells the user that those file need to be created and then tell them to read the man page.

@giuseppe
Copy link
Member

giuseppe commented Nov 7, 2018

should we move this issue to containers/storage? The logic for handling /etc/sub{g,u}id is there

@rhatdan
Copy link
Member

rhatdan commented Nov 7, 2018

SGTM

@vrothberg
Copy link
Member Author

I opened containers/storage#231. I suggest keeping the issue here open until containers/storage#231 is merged and vendored.

@rhatdan
Copy link
Member

rhatdan commented Nov 7, 2018

I don't think we should do it at that low of a level, What do you think about something like:

diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go
index 5c45f269..e97bbf05 100644
--- a/pkg/rootless/rootless_linux.go
+++ b/pkg/rootless/rootless_linux.go
@@ -196,6 +196,9 @@ func BecomeRootInUserNS() (bool, int, error) {
        mappings, err := idtools.NewIDMappings(username, username)
        if os.Getenv("PODMAN_ALLOW_SINGLE_ID_MAPPING_IN_USERNS") == "" {
                if err != nil {
+                       if os.NotExist(err) {
+                               return false, 0, errors.Wrapf(err, "/etc/subuid or /etc/subgid does not exist, refer to subuid/subgid man pages for use of these files")
+                       }
                        return false, -1, err
                }

@giuseppe
Copy link
Member

giuseppe commented Nov 8, 2018

@rhatdan SGTM

@vrothberg
Copy link
Member Author

I am okay with both solutions 👍

@afbjorklund
Copy link
Contributor

afbjorklund commented Nov 11, 2018

This is an issue with an Busybox installation as well, I can add the newuidmap newgidmap programs (from shadow-4.6) but there's some other requirements missing that are not fulfilled for this to be fully useful:

tc@box:~$ useradd
-sh: useradd: not found
tc@box:~$ man
-sh: man: not found

So maybe I will just replace it with some text like "permission denied", rather than adding rootless support... There's some extra stuff that needs to be in place first as well, such as slirp4netns and fuse-overlayfs.

Support for "subordinate ids" needs to go here: https://git.busybox.net/busybox/tree/loginutils

Before all that is in place in boot2podman, user would just have to know to run sudo podman instead. Since everything is running inside a VM anyway, it is not a big deal. Just slightly confusing for newcomers.

i.e. maybe it's more like alias docker='sudo podman' right now ? (cf. usermod -aG docker)

@rhatdan
Copy link
Member

rhatdan commented Nov 11, 2018

I think we need more documentation, for different platforms as the evolve. RHEL and Centos also do not fully support podman as non root yet.

@rhatdan
Copy link
Member

rhatdan commented Dec 22, 2018

@vrothberg @TomSweeneyRedHat Any movement on this? Better documentation in man pages?

@vrothberg
Copy link
Member Author

@rhatdan, for me #1795 solved the issue. I am not sure if we could improve the situation besides making that clear in the RHEL docs.

@rhatdan
Copy link
Member

rhatdan commented Dec 23, 2018

Ok closing.

@rhatdan rhatdan closed this as completed Dec 23, 2018
@afbjorklund
Copy link
Contributor

I didn't bother with fixing adduser in busybox, so just hacked /etc/subuid and /etc/subgid.
Only added newuidmap and newgidmap binaries (from shadow), but it seems to be enough...

@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
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

5 participants