1

I am trying to set up a foreign chroot environment with QEMU, mostly as described at https://www.hellion.org.uk/blog/posts/foreign-chroots-with-schroot-and-qemu/.

The host system is Ubuntu x86_64 (on Github Actions), the foreign chroot runs Debian for arm.

Now I am trying to set up OCaml by installing opam via apt, then running opam init. That fails because /proc/sys/kernel/overflowuid is not found.

Digging a bit deeper, I found /proc inside the chroot jail is completely empty. I tried adding sudo mount -B /proc $CROSS_ROOT/proc to the script right after running debootstrap, still to no avail – /proc is still empty. Same with sudo mount -t proc /proc $CROSS_ROOT/proc.

Also, when I run mount | grep proc outside the chroot jail, I see /proc but not CROSS_ROOT/proc.

Another oddity I notice is that when I run mount inside the chroot jail to list mounts, I get an error saying mtab was not found – is that normal, or does that indicate something else is wrong here?

To rule out trivial errors – I use $CROSS_ROOT multiple times in my CI script, also in the call to debootstrap. If that var were empty, I suppose I’d be having a bunch of other errors.

Why am I not seeing /proc inside my chroot jail?

1 Answer 1

1

debootstrap runs in two stages:

sudo debootstrap --variant=buildd --include=fakeroot,build-essential,sudo --arch=armhf --foreign buster $CROSS_ROOT $CROSS_MIRROR
sudo chroot $CROSS_ROOT ./debootstrap/debootstrap --second-stage

Mounting /proc must be done after the second stage, not between the two stages – the second stage will unmount /proc again. (The source mentioned in the question does some extra magic to provide qemu-arm-static inside the chroot, which must indeed happen between the two stages. Any other customizations to the file system, especially of the kind that involve central system components, may break things or get undone by the second stage.)

After moving the mount commands behind the second stage of debootstrap, my chroot jail is seeing /proc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .