#1153997 debootstrap: unmounting /proc causes Rosetta-translated amd64 binaries to fail during second stage

#1153997#5
Date:
2026-11-14 20:17:11 UTC
From:
To:
Dear Maintainer,

This occurs when creating an amd64 rootfs on an arm64 Debian VM
running under Apple Virtualization with Rosetta enabled.

The bootstrap is performed with:

    debootstrap --foreign --arch=amd64 ...

followed by:

    chroot <target> /debootstrap/debootstrap --second-stage

During second stage, setup_proc() temporarily unmounts /proc before
remounting it.

Rosetta appears to require /proc/self/exe in order to launch translated
amd64 binaries. Once /proc is unmounted, subsequent amd64 binaries fail
with:

    rosetta error: Unable to open /proc/self/exe: 2
    Trace/breakpoint trap

This creates a deadlock because debootstrap can no longer execute the
translated amd64 mount binary needed to restore /proc.

A local workaround is to replace setup_proc() with a no-op in cases
where /proc, /sys, /dev and /dev/pts have already been mounted by the
caller. With this change, second stage completes successfully.

This appears similar in spirit to bug #921815, where debootstrap's
handling of /proc caused problems in containerized environments, but in
this case the affected environment is Apple Rosetta rather than Docker.