#724585 proot: Do not bind-mount the host system when giving the -q option

Package:
proot
Source:
proot
Description:
emulate chroot, bind mount and binfmt_misc for non-root users
Submitter:
Johannes Schauer
Date:
2015-02-04 09:52:06 UTC
Severity:
normal
#724585#5
Date:
2013-09-25 11:26:27 UTC
From:
To:
Hi,

when giving the -q option, proot currently automatically bind-mounts the
host rootfs into /host-rootfs. This functionality only exists for the
convenience of being able to also execute binaries of the host system at
the same time. But it is otherwise completely unnecessary for qemu-user
mode operation to have the host rootfs bind-mounted into /host-rootfs.

Attached, find a patch which moves this functionality from the -q option
into the -t option and which lets the -Q option be an alias for -t as
well.

cheers, josch

#724585#10
Date:
2013-10-08 07:39:07 UTC
From:
To:
Hello Josh,

Actually QEMU is a binary from the host system, so the "/host-rootfs"
binding is required when QEMU is dynamically linked.  I guess you
didn't notice this because you are using a statically linked QEMU.

I'd prefer not to introduce a new command-line option for this
purpose.  Instead, the "/:/host-rootfs" binding could be added to the
list of recommended bindings (-Q/-B options) and PRoot could detect
automatically where the host rootfs is bound, no matter where it is.
That way, the "/:/host-rootfs" is not forced anymore, and it possible
to bind the rootfs anywhere, for instance:

    proot -q qemu-arm -b /:/tmp/host-rootfs ...

Josh, do you think this could be an acceptable fix?  I could implement
this feature in the next release of PRoot if you wish (v3.2).  Also I
wonder why the forced "/host-rootfs" is an issue in your case?

Cheers,
Cédric.

#724585#15
Date:
2013-10-08 07:51:40 UTC
From:
To:
Hi Cédric,

Quoting Cédric VINCENT (2013-10-08 09:39:07)

Correct. Using a statically linked qemu does not require me to have
/host-rootfs bind mounted which is why I prefer static qemu over dynamic qemu.

You didnt make it explicit but if your proposal includes removing the implicit
bind mounting of /host-rootfs when qemu user mode emulation is activated, then
it completely solves my problem.

There is no need to rush :)

I was trying to use proot to create a foreign architecture rootfs while I used
fakeroot/fakechroot before. My only problem with proot was that it
fake-bind-mounted /host-rootfs into the foreign system. This led to tools like
find, tar, du, grep etc (everything that recursively walks a directory tree)
which were supposed to work on the whole foreign rootfs also work on my host
fs. While some of the tools like find and tar allow me to exclude certain
subdirectories, it is harder to work around this issue with other tools. So
while before the tools could assume that everything within that foreign rootfs
directory is indeed only the foreign rootfs, I now have to manually exclude
/host-rootfs *somehow*.  And before I start implementing the required
workarounds I wanted to see if this could not be changed in proot instead.

Thanks!

cheers, josch

#724585#20
Date:
2013-10-08 10:42:30 UTC
From:
To:
Yes, this implicit binding will be removed from the -q option, but it
will be enabled by the -Q option (same behavior as with your patch).

In this case PRoot is not as transparent as it should be, so this is
clearly an issue to be fixed in PRoot.  Thanks for the bug report and
for the patch.

Cheers,
Cédric.