Home > Net >  binfmt_misc kernel module not used
binfmt_misc kernel module not used

Time:05-11

I am evaluating an NXP iMX.8 based (which is arm64v8) board. The eval kit came with a 5.10.72 Linux kernel but did not have binfmt_misc kernel module. After contacting the vendor, they provided the needed module which matches the kernel version. I placed it into /lib/modules/$(uname -r)/kernel/drivers/fs/binfmt_misc.ko then echo binfmt_misc >> /etc/modules && /sbin/depmod && systemctl reboot.

After reboot, lsmod | grep binfmt shows that the module is now loaded, but "Use By 0". Furthermore, journalctl -u proc-sys-fs-binfmt_misc.mount errors out with mount: /proc/sys/fs/binfmt_misc: mount point does not exist. which I confirm doesn't exist via ls -al /proc/sys/fs/binfmt_misc.

Since I cannot create any dirs in /proc, what is the missing magic to get this to work?

CodePudding user response:

It seems that the module was compiled separately and kernel itself was not built with CONFIG_BINFMT_MISC enabled, therefore the code that should create this mountpoint is still excluded: https://elixir.bootlin.com/linux/v5.10.72/source/kernel/sysctl.c#L3304

Maybe it is feasible to mount binfmt_misc to some other location and use it from there? Or ask Teh Vendor for updated kernel image?

CodePudding user response:

If CONFIG_BINFMT_MISC is not defined, kernel/sysctl.c will not create a mountpoint in procfs. Having the module does not help, since it doesn't create the mount point. You will need to rebuild the kernel with CONFIG_BINFMT_MISC=m (or Y).

See: https://elixir.bootlin.com/linux/v5.16.18/source/kernel/sysctl.c#L3367

  • Related