Gracefully handle missing /proc/sys/fs/binfmt_misc
Created by: ollieparanoid
From the wiki:
sh: can't create /proc/sys/fs/binfmt_misc/register: nonexistent directory
This issue is known to happen in Alpine Virthardened. It also happened in Void Linux for one user. These commands should fix it:
sudo modprobe binfmt_misc
sudo mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
If it still does not work, it is probably not supported by your host Linux distribution's kernel (
CONFIG_BINFMT_MISC
). Try to use another kernel.
While this is on the troubleshooting page, it isn't really obvious and people get stuck with this error. It would be nice if we checked if /proc/sys/fs/binfmt_misc
existed, and if it did not, printed a link that points to the right location in the troubleshooting wiki.