shubham1172/unshare

using unshare with unshare.CLONE_NEWUSER gets me a Invalid argument

Closed this issue · 2 comments

I am working on a build tool and my goal is to setup overlayfs as a non-root user following this page for advice: https://mostlyuseful.tech/posts/overlay-mounting/

Now, when I specify

unshare.unshare(unshare.CLONE_NEWUSER)

I get a Invalid argument...

When I used

unsahare.unshare(unshare.CLONE_NEWNS)

I get permission denied, so somehow the CLONE_NEWUSER doesn't appear to work, I am on Ubuntu 22.04LTS and I am doing the above within a docker container for development (devcontainer) which has privilege flags set.

If I simply type in the shell of my container the command "unshare -r", no error appears, same for unshare -m, only when using the Python unshare module I get the error.

I am wondering if the binary value used by the Python Unshare for NEWUSER is the correct one. Looking at the util-linux/unshare their value is

#define CLONE_NEWUSER 0x10000000

https://github.com/search?q=repo%3Autil-linux%2Futil-linux%20CLONE_NEWUSER&type=code

I think this was due to the kernel returning an error so not related to this project, closing.

Great, @hpe-ykoehler please feel free to add notes on the error for future reference by anyone else.