Skip to content

Cannot access proc sys fs binfmt_misc under Ubuntu

Alistair Young edited this page Apr 17, 2021 · 1 revision

Attempting to access binfmts_misc under Ubuntu, inside the bottle, may produce the following error:

$ ls /proc/sys/fs/binfmt_misc
ls: cannot open directory '/proc/sys/fs/binfmt_misc': Too many levels of symbolic links

This appears to be a problem specific to Ubuntu distributions that results in either binfmt_misc not being mounted properly, or else the mount breaking somehow when systemd starts under Ubuntu. Unfortunately, I don't have much more than that to go on, as there doesn't appear to be anything obviously wrong with the startup sequence.

I do, however, have a workaround. Simply remounting binfmt_misc over the top of the existing mount with:

sudo mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc

restores access. If this works for you, you can automate it by adding:

ls /proc/sys/fs/binfmt_misc > /dev/null 2>&1 || \
  mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc

to your /etc/rc.local script, creating it if it does not exist.