From: Colin Walters <walters@verbum.org>
To: John Stoffel <john@stoffel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: chroot(2) and bind mounts as non-root
Date: Thu, 08 Dec 2011 11:10:52 -0500 [thread overview]
Message-ID: <1323360655.10724.35.camel@lenny> (raw)
In-Reply-To: <20191.49202.793643.397028@quad.stoffel.home>
On Wed, 2011-12-07 at 14:36 -0500, John Stoffel wrote:
> >>>>> "Colin" == Colin Walters <walters@verbum.org> writes:
>
> Colin> I've recently been doing some work in software compilation, and it'd be
> Colin> really handy if I could call chroot(2) as a non-root user. The reason
> Colin> to chroot is to help avoid "host contamination" - I can set up a build
> Colin> root and then chroot in. The reason to do it as non-root is, well,
> Colin> requiring root to build software sucks for multiple obvious reasons.
>
> What's wrong with using 'fakeroot' or tools like that instead?
I assume you mean
"fakechroot" ( https://github.com/fakechroot/fakechroot/wiki )
The answer is twofold:
1) It's a pile of gross hacks that can easily be buggy, and will be
permanently trying to keep up with newer system calls.
2) It's slower. My edit-compile-debug cycle REALLY matters to me. If
you're a developer, it should matter to you - it directly impacts your
productivity.
How much slower? Okay, well I tried "fakechroot" from Fedora 15. It
appears to break parallel make. Which obviously already disqualifies it
from being a core part of my edit-compile-debug cycle.
But here's an example of a small autotools (~6000 significant lines of
C) project, of which running configure is by far the slowest part. Note
'metabuild' is a trivial script which wraps the
'autogen.sh;configure;make' dance:
$ metabuild # to prime the caches
...
$ git clean -dfx
...
$ time ostbuild-user-chroot --unshare-ipc --unshare-pid --unshare-net
--mount-bind /src /src --mount-proc /proc
--mount-bind /dev /dev / /bin/sh -c 'cd /src/test-project; metabuild'
...
real 0m17.627s
user 0m9.397s
sys 0m5.074s
$ git clean -dfx
...
$ time fakeroot fakechroot chroot / /bin/sh -c 'cd /src/test-project;
metabuild -j 1'
real 0m35.327s
user 0m13.118s
sys 0m10.639s
So it almost exactly doubles...Oh, crap, I just remembered I have
ccache, so we're really only timing configure runs here. Anyways, you
get the point. Doubling my compile time is bad. And this is a
relatively small project.
One of the best parts of Linux is the filesystem and VFS - it's really
amazingly fast compared to other OSes, especially if you know how to use
it. Adding in layers of emulation and crap in between the program and
the filesystem takes that away.
next prev parent reply other threads:[~2011-12-08 16:11 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 17:54 chroot(2) and bind mounts as non-root Colin Walters
2011-12-07 19:36 ` John Stoffel
2011-12-08 16:10 ` Colin Walters [this message]
2011-12-08 18:14 ` John Stoffel
2011-12-08 18:26 ` Colin Walters
2011-12-09 0:49 ` Sven-Haegar Koch
2011-12-09 14:55 ` John Stoffel
2011-12-09 15:06 ` Colin Walters
2011-12-08 17:04 ` Arnd Bergmann
2011-12-08 17:15 ` Colin Walters
2011-12-07 19:40 ` Andy Lutomirski
2011-12-08 16:58 ` Colin Walters
2011-12-07 20:34 ` H. Peter Anvin
2011-12-07 20:54 ` Alan Cox
2011-12-15 18:55 ` Andrew G. Morgan
2011-12-16 15:44 ` Colin Walters
2011-12-18 1:22 ` Andrew G. Morgan
2011-12-18 15:19 ` Colin Walters
2011-12-10 5:29 ` Serge E. Hallyn
2011-12-12 16:41 ` Colin Walters
2011-12-12 23:11 ` Serge E. Hallyn
2011-12-15 20:56 ` Colin Walters
2011-12-16 6:14 ` Eric W. Biederman
2011-12-18 16:01 ` Colin Walters
2011-12-19 0:55 ` Eric W. Biederman
2011-12-19 4:06 ` Serge E. Hallyn
2011-12-19 9:22 ` Eric W. Biederman
2011-12-20 16:49 ` Colin Walters
2011-12-20 21:23 ` Colin Walters
2011-12-21 18:15 ` Steve Grubb
2012-01-03 23:13 ` Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1323360655.10724.35.camel@lenny \
--to=walters@verbum.org \
--cc=john@stoffel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox