[Haifux] Announcing a new project - fakeroot-ng
Shachar Shemesh
shachar at shemesh.biz
Mon Dec 31 08:01:41 MSK 2007
alon at 8ln.org wrote:
> That being said, I don't really know why fake a chroot jail within
> fakeroot. I can understand why you'd like a userspace chroot jail, but
> you won't usually need to fake root at the time.
>
Actually, the two really come together. You use the same technology for
both chroot and fakeroot.
The real issue here, however, is testing embedded setups. I have a
script that builds a directory structure (with different owners and
device files), that then gets automatically compressed into a SQUASHFS
image and saved. When you boot from it, it turns into a real
environment. It's real useful, however, to test whether this environment
has all the devices, libraries and mounts that are required to, say, run
a certain program. The obvious solution is to chroot into it, and try
running the program.
With fakeroot I can run the entire build script as a regular user, which
is great because I don't want to compile a whole system as root, I don't
want to leave a passwordless sudo on my machines, the script runs for so
long (ever times compiling of wxWidgets or glibc? They take a LONG time
to compile) that a sudo with password expires, and that's before I start
talking about bugs in the DESTDIR mechanism, which, if run as real root,
may hose your entire system. fakeroot is ideal for those cases. I had to
write a whole set of wrapper scripts around fakeroot to make it store
its state (i.e. - the lies it tells the programs) between runs in a
reliable way (and let me tell you, that stretches fakeroot's abilities
to the limit).
However, once the environment is set up using fakeroot two things
happen. The first is that you don't want to use a real root in order to
chroot into it. You get used to good things :-). The second, and more
important one, is that you cannot use a real root. All the files there
have the wrong owners and none of the device files are actual devices.
Sometimes it doesn't matter. Sometimes it does.
And that, actually, is the real reason fakeroot-ng was written.
Shachar
More information about the Haifux
mailing list