binfmt-dispatcher is a simple dispatcher for binfmt_misc that dynamically picks the best interpreter to use at runtime.
binfmt-dispatcher is packaged in Fedora as of Fedora Linux 40. It can be installed with:
$ sudo dnf install binfmt-dispatcher
which will automatically register it as a binfmt_misc handler via systemd and installer a basic configuration.
binfmt-dispatcher should be registered as a binfmt_misc handler. If using systemd, this is accomplished via binfmt.d (sample configs are provided for x86 and x86-64). It is recommended to prefix the config with zz-
or something akin to ensure it's parsed last, as systemd processes these in lexicographic order. After installing the config, remember to restart systemd-binfmt.service for it to take effect.
binfmt-dispatcher parses configuration from several sources:
- drop-in configs in
/usr/lib/binfmt-dispatcher.d/*.toml
/etc/binfmt-dispatcher.toml
- the running user XDG config (usually
$HOME/.config/binfmt-dispatcher/binfmt-dispatcher.toml
)
Configs are parsed in order and later settings win. A fully commented config is provided and should be fairly self-explanatory.
When run as an interpreter, binfmt-dispatcher will parse the configs, pick the best interpreter to use based on it and the binary being run, and then run it. If enabled (via the use_muvm
config setting), binfmt-dispatcher will use muvm to execute the interpreter in a microVM if the system page-size is not 4k. If the interpreter or any of its dependencies are missing, binfmt-dispatcher will attempt to install them by invoking the package manager.
If run outside of a terminal session, binfmt-dispatcher will assume it's being run as part of a desktop environment (e.g. because a user double clicked on an x86-64 binary in a file manager). If zenity is installed, dialog boxes will be displayed to provide feedback to the user when necessary. If it's necessary to install any missing dependencies, the package manager will be run inside a terminal emulator via xdg-terminal-exec.
This project is MIT licensed. See the LICENSE file for the full text of the license.