From 8a3d8497e39c5b542ad76b3aba47c4b2353ebc13 Mon Sep 17 00:00:00 2001 From: Paul Kulchenko <paul@kulchenko.com> Date: Sun, 4 Sep 2022 00:09:24 -0700 Subject: [PATCH] Update README to add a note about binfmt-related errors (#587) --- 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:-.}}`