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

buildFHSChrootEnv requires root, possibly unnecessarily #11559

Closed
copumpkin opened this issue Dec 8, 2015 · 7 comments
Closed

buildFHSChrootEnv requires root, possibly unnecessarily #11559

copumpkin opened this issue Dec 8, 2015 · 7 comments

Comments

@copumpkin
Copy link
Member

It seems like we could have buildFHSChrootEnv work without root by using user namespaces.

@Mathnerd314
Copy link
Contributor

See buildFHSUserEnv and https://nixos.org/wiki/FHS_environments.

Steam uses buildFHSUserEnv, nothing uses buildFHSChrootEnv; maybe we should just remove buildFHSChrootEnv?

@zimbatm
Copy link
Member

zimbatm commented Dec 9, 2015

It might be possible to use unshare --mount --map-root-user and then run chroot in it

@abbradar
Copy link
Member

I've tried to implement buildFHSUserEnv in bash first before moving on to Ruby. I can't remember exact problems, but it seemed impossible to get proper user and filesystem namespace with mounts and user map using bash. It was something to do with unshare and mount and friends being separate forked processes.

@zimbatm
Copy link
Member

zimbatm commented Dec 10, 2015

buildFHSUserEnv basically does the unshare + chroot that I was talking about, not sure if the ChrootEnv is even needed anymore.
The only drawback of using ruby is that it probably leaks file descriptors (here would be a potential fix: #11602 )

@abbradar
Copy link
Member

I've left buildFHSChrootEnv because it has somewhat different semantics -- its sandboxes persist between runs and may be entered multiple times simultaneously. I don't know if anyone has a usecase for this, though.

@abbradar
Copy link
Member

abbradar commented Feb 1, 2016

Is this still relevant? buildFHSChrootEnv is somewhat "meant" to work as root because of its "simultaneous multiple users" usage. On the other hand, buildFHSUserEnv gained support for running as root some time ago.

@copumpkin
Copy link
Member Author

Yeah, probably not. I guess I'd mostly just want a better name for it that paints the distinction better, but I don't have a real proposal for what that name should be.

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

4 participants