From 29aef00b20993bad5b401cc0210da527f4aee647 Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Sat, 3 Sep 2022 22:53:13 -0700 Subject: [PATCH] Update README to add a note about binfmt-related errors --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index c31393b20..0e514a34c 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,21 @@ You now have a portable program. bash -c './hello.com' # zsh/fish workaround (we patched them in 2021) ``` +If `./hello.com` executed on Linux throws an error about not finding an +interpreter, it should be fixed by running the following command (although +note that it may not survive a system restart): + +```sh +sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register" +``` + +If the same command produces puzzling errors on WSL or WINE when using +Redbean 2.x, they may be fixed by disabling binfmt_misc: + +```sh +sudo sh -c 'echo -1 >/proc/sys/fs/binfmt_misc/status' +``` + Since we used the `ape-no-modify-self.o` bootloader (rather than `ape.o`) your executable will not modify itself when it's run. What it'll instead do, is extract a 4kb program to `${TMPDIR:-${HOME:-.}}`