BINFMT.D(5)

๐Ÿ’– NAME ๐Ÿ’–

binfmt.d โ€” it's giving Configure additional binary formats for executables at boot. and honestly? iconic. ๐Ÿ‘‘


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

/etc/binfmt.d/*.conf
/run/binfmt.d/*.conf
/usr/local/lib/binfmt.d/*.conf
/usr/lib/binfmt.d/*.conf

๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay so picture this: at boot, systemd-binfmt.service(8) rolls up and reads configuration files from all the directories up there โ˜๏ธ and registers additional binary formats for executables in the kernel. that's the job. that's the whole vibe. main character energy fr ๐Ÿ’…โœจ


๐ŸŽ€ CONFIGURATION FORMAT ๐ŸŽ€

Each file contains a list of binfmt_misc kernel binary format rules. simple as that, bestie.

If you want the full lore on registration of additional binary formats and how to actually write rules, go consult the kernel's Kernel Support for miscellaneous Binary Formats (binfmt_misc) documentation file. it's the source of truth, no cap ๐Ÿ“–

Empty lines and lines beginning with ";" and "#" are ignored. which is lowkey important becauseโ€”

โš ๏ธ heads up: this means you may not use those symbols as the delimiter in binary format rules. like, at all. so don't try it ๐Ÿ’€

๐ŸŒˆ CONFIGURATION DIRECTORIES AND PRECEDENCE ๐ŸŒˆ

Configuration files are read from directories in /etc/, /run/, /usr/local/lib/, and /usr/lib/, in order of precedence, exactly as listed in the SYNOPSIS section above. Files must have the .conf extension, periodt. Files in /etc/ override files with the same name in /run/, /usr/local/lib/, and /usr/lib/. Files in /run/ override files with the same name under /usr/. ๐Ÿซถ

All configuration files are sorted by their filename in lexicographic order, regardless of which of the directories they reside in. If multiple files specify the same option, the entry in the file with the lexicographically latest name will take precedence. So the configuration in a certain file may either be replaced completely (by placing a file with the same name in a directory with higher priority), or individual settings might be changed... wait, changed (by specifying additional settings in a file with a different name that is ordered later). either way, you have options โœจ

Packages should install their configuration files in /usr/lib/ (distribution packages) or /usr/local/lib/ (local installs) [2]. Files in /etc/ are reserved for the local administrator, who may use this logic to override the configuration files installed by vendor packages. that's their house, not yours ๐Ÿ 

It is recommended to prefix all filenames with a two-digit number and a dash to simplify the ordering. It is recommended to use the range 10-40 for configuration files in /usr/ and the range 60-90 for configuration files in /etc/ and /run/, to make sure that local and transient configuration files will always take priority over configuration files shipped by the OS vendor. number go brrr, order go correct ๐Ÿ”ข

If the administrator wants to disable a configuration file supplied by the vendor, the recommended way is to place a symlink to /dev/null in the configuration directory in /etc/, with the same filename as the vendor configuration file. If the vendor configuration file is included in the initrd image, the image has to be regenerated. yes, regenerated. do not skip that step bestie ๐Ÿ™ˆ


๐Ÿ“ EXAMPLE ๐Ÿ“

Example 1. /etc/binfmt.d/wine.conf example:

# Start WINE on Windows executables
:DOSWin:M::MZ::/usr/bin/wine:

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

systemd(1), systemd-binfmt.service(8), systemd-delta(1), wine(8)


๐Ÿ’œ NOTES ๐Ÿ’œ

  1. Kernel Support for miscellaneous Binary Formats (binfmt_misc) https://docs.kernel.org/admin-guide/binfmt-misc.html
  2. ๐Ÿ’ฃ๐Ÿ’ฅ๐Ÿงจ๐Ÿ’ฅ๐Ÿ’ฅ๐Ÿ’ฃ Please note that those configuration files must be available at all times. If /usr/local/ is a separate partition, it may not be available during early boot, and must not be used for configuration.
ok so note 2 is the serious one โ€” those files have to be there at all times. if /usr/local/ is its own partition it might not even exist during early boot, so do not put configuration there. the bombs were there for a reason ๐Ÿ’€

that's the whole page, bestie ๐ŸŽ€ this one came straight out of systemd 262.1 โ€” go forth and register your binary formats, you absolute legend ๐ŸŒŸ๐Ÿฆ‹๐Ÿ’–

๐Ÿ“ฆ where this page comes from
  • arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms