drakkar-lig / debootstick

Generate a bootable live image from any Debian/Ubuntu filesystem tree.
62 stars 18 forks source link

Fails to copy "qemu-binfmt-P" to raspberry pi image #37

Open ghost opened 3 years ago

ghost commented 3 years ago

I updated to the latest Ubuntu Hirsute to see if it would include performance fixes for qemu-user, since I was having trouble with very slow builds. This brought a new problem, which manifests as a fail to copy qemu-binfmt-P to the target raspberry pi image.

The underlying problem is that newer Ubuntu releases started pointing binfmt_misc at a layer of symlinks rather than the qemu binaries themselves. I haven't written a clean solution for this, but as a workaround you can add a readlink to interpreter_path in prepare_rootfs_for_emulation:

 # vim: filetype=sh

 ARM_BINFMT_DEF=/proc/sys/fs/binfmt_misc/qemu-arm
 ERR_CPU_EMULATION="E: Cannot continue because host OS does not provide ARM cpu emulation."

 prepare_rootfs_for_emulation()
 {
     if [ ! -f $ARM_BINFMT_DEF ]
     then
         echo "$ERR_CPU_EMULATION" >&2
         return 1
     fi
     set -- $(cat $ARM_BINFMT_DEF | grep interpreter)
     interpreter_path="$2"
+    interpreter_path=`readlink -f "$interpreter_path"`
     if [ ! -f "./$interpreter_path" ]
     then
eduble commented 3 years ago

Hi, thanks for reporting. If you want to have your name associated with the fix, you can commit this change and do a pull request.