fsquillace / junest

The lightweight Arch Linux based distro that runs, without root privileges, on top of any other Linux distro.
GNU General Public License v3.0
2.08k stars 111 forks source link

Use QEMU with namespace backend #260

Open fsquillace opened 3 years ago

fsquillace commented 3 years ago

If binfmt-user-static is installed in the native OS (say x86_64 arch), it is possible to run JuNest on a different architecture (say ARM) using the namespace more. More information here

To achieve this on a JuNest ARM architecture with x86_64 arch native system:

bwrap <all_common_bwrap_options_to_bind> /tmp/qemu-arm-static /bin/sh

where bwrap and qemu-arm-static are x86_64 compiled binaries. qemu-arm-static must be within the JuNest env in order for this to work.

The biggest challenge is how to set binfmt as unprivileged user. There are attempt to have binfmt for unprivileged containers. Some references here:

Reference about the need to use binfmt for making is working:

fsquillace commented 3 years ago

Modified the line in namespace.sh in this way:

JUNEST_ENV=1 ~/.junest/usr/bin/bwrap $COMMON_BWRAP_OPTION $backend_args /usr/bin/qemu-arm-static -L ~/.junest-arm ~/.junest-arm/lib/ld-linux-armhf.so.3 "${DEFAULT_SH[@]}" "${args[@]}"

/usr/bin/qemu-arm-static has to be within the junest image.