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

pivot_root fails with user namespace used #14

Open
magicyuli opened this issue Apr 3, 2019 · 3 comments
Open

pivot_root fails with user namespace used #14

magicyuli opened this issue Apr 3, 2019 · 3 comments

Comments

@magicyuli
Copy link

pivot_root succeeds if user namespace is not used, but fails with EINVAL (os error 22). Bind mounting the new_root to itself solves it. I think that's a hack used by go example as well. Maybe the CloneCb should include this logic?

Environment: Xenial 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

@magicyuli
Copy link
Author

Or add an after_clone callback? There's currently a before_exec callback, which is called just right before execve.

@tailhook
Copy link
Owner

tailhook commented Apr 3, 2019

Hi!

I'm not sure it's because of user namespace. Isn't it because pivot_root requires both things to be mountpoints not mere directories?

I'm all for adding documentation describing the issue. But I don't think this should be done always. Adding a convenience method may be okay, though.

@magicyuli
Copy link
Author

Thanks for the prompt response!

Yeah, I did make sure the new_root was a mount point, and put_old had nothing mounted to it, and was under new_root. Without using the user namespace it works without any problem, and that's why I think user namespace plays a part here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants