-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
podman: trying to support running podman as non-root user on OpenWrt #10713
Comments
Somewhat similar to #9219. |
With the mount proc issue, are you running podman within podman? You could try to add |
Most of the maintainers here are probably not familiar with OpenWRT (I can say for certain I am not). More details on the environment Podman is being run in will help if you can give them, particularly ways it differs from a standard Linux distro |
OpenWrt is a distribution that aims to provide firmware for routers and "small" network devices. One way that it differs from most other distributions is that it does not use systemd. OpenWrt relies on busybox, but things like shadow-utils are available too. OpenWrt is a bit niche, and I do not expect most people would have a deep understanding of it. This is why I expect to do most of the engineering to get this to work. For example, if there is a privileged agent that is missing, then I would be happy to package it for OpenWrt or write a replacement. As I indicated, I have already made some progress with this type of work. What I am really looking for is an explanation of how some parts of rootless podman work. (I also welcome suggestions for further reading.) My two questions above highlight what I think are the gaps in my knowledge, namely (1) how does non-root mount arbitrary things when mounting arbitrary things usually requires root access? and (2) how does non-root manipulate /sys/fs/cgroup/* when the permissions on those pseudo-files seem to prohibit write access to non-root? Focusing on point (1), running
Working through the surrounding evidence, I think PID 2524 is crun as executed by podman. I also think the above system calls take place in src/libcrun/linux.c's do_mount(). To be clear, I am not asking why this fails on my system (OpenWrt), I am asking why it succeeds on yours! What special circumstance allows crun, running as non-root, to mount proc on RHEL, CentOS, Fedora, Ubuntu, and so on? |
For the first one - we use a user namespace to allow (limited) access to the mount syscall. The kernel has been patched to allow non-root users the ability to mount a few types of filesystem within a user namespace, most notably tmpfs and fuse, with full overlayfs being available in very recent kernels. Very old kernels (I don't have a precise version, but I think it was 2017-ish that the patch allowing it landed) may not have FUSE in user namespace support, which is a problem for Podman. For cgroups - we should not be doing anything with cgroups as rootless on cgroupsv1 systems. I believe we attempt to do a few things as holdovers from root, some of those printing warnings, but none of these are essential. |
an unprivileged user can mount proc if it is in a user namespace and it owns the mount and the pid namespace. An additional requirement from the kernel is that there is already a Can you show the list of mounts on your system ( |
@mheon, it seems that podman is trying to mount proc without the use of fuse-overlayfs, right? At least this is how I interpret the strace fragment above. Is this expected? @giuseppe, proc is mounted elsewhere; see below. When you say, "if it is in a user namespace and it owns the mount and the pid namespace," how can I determine if podman has satisfied these conditions? OpenWrt uses the musl C library. Could that cause a problem?
Perhaps something is missing from the kernel configuration?
|
please try the following command: Does it work for you? |
The command you suggested fails, even when run as root:
Here is a portion of the output from
I am able to mount procfs elsewhere as root:
My build of OpenWrt is not running SELinux or anything else I can think of that would restrict processes beyond the standard Unix permissions model. Do the kernel configuration fragments in my earlier comment shed any light? Is there anything else that I need to activate when I build my kernel? |
I found there're some diffs between normal debian and openwrt as below:
debian
openwrt
|
A friendly reminder that this issue had no activity for 30 days. |
@giuseppe Any update? |
if Can you please share the output of Does it make any difference if you try to umount
|
|
thanks, what do you see with If |
It looks like /proc is private. How does one mount /proc in a way that is not private? This is new to me. The
I did try to run |
can you try unmounting |
|
that is strange, the mount of What do you see with |
I ran the command you requested with /proc private and then shared:
|
Thanks. I can't spot anything wrong in your configuration now. It is something else blocking the mount. Do you see any error message in your system logs? Is the kernel using any custom patch? |
@giuseppe, it might be the kernel. I have been trying to figure out the compile-time kernel settings that running podman as non-root user depends on. Can you suggest where I could find this information? For what it is worth, I went through a similar process as a part of the effort to bring SELinux to OpenWrt. (In this case, SELinux is not on.) |
I am not aware of such documentation. Would it be possible to use the same source (no additional patches) and configuration that is used on other distros like Fedora? |
A friendly reminder that this issue had no activity for 30 days. |
Seems to be some activity on the OpenWrt end. |
@rhatdan, we have indeed made progress on some of the surrounding bugs as documented in openwrt/packages#15096. However, we have not yet figured out the (suspected) kernel differences that prevent mounting /proc within containers on OpenWrt as documented above. |
Feel free to add more comments, I am closing this issue since there is nothing we can do in Podman. |
/kind feature
I am trying to modify OpenWrt and its podman package to allow users other than root to manage containers on that system. @rhatdan suggested I create a GitHub issue after I brought this up on the podman mailing list.
I have made some progress, including working through some "bugs" in podman and the OpenWrt packages:
A summary of my work so far exists at openwrt/packages#15096.
There are two things I do not yet understand, so I am looking for a summary of how these things work or some recommended reading regarding them:
proc
to/proc
: Operation not permitted: OCI permission denied." Again, I am not sure what performs these privileged operations on other distributions. I did try to package fuse-overlayfs for OpenWrt, and I setmount_program = "/usr/bin/fuse-overlayfs"
in/etc/containers/storage.conf
, but this did not helpSteps to reproduce the issue:
podman build --tar containers .
.podman run containers
Describe the results you received:
Output of
podman version
:Output of
podman info --debug
:Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes/Yes
The text was updated successfully, but these errors were encountered: