I want to be able to run clr (>NET/mono) exes on my redhat machines, so I add the following to /etc/rc.local:

echo ':CLR:M::MZ::/opt/mono-head/bin/mono:' > /proc/sys/fs/binfmt_misc/register

This works fine, but is there a more appropriate config file specifically intended for configuring binfmt as opposed to the kitchen sink rc.local?


This seems like an appropriate use of /etc/rc.local to me. The running of this is a system wide need, so that takes a single user environment off the table, and it isn't a service that warrants the creation of something under /etc/init.d or some such similar place where services are kept.

  • Its appropiate if theres nothing specialized. I would think that a slightly over-engineered solution where there was a separate rc script would make it easier to automatically configure binfmt associations via RPMs etc. – Justin Dearing Sep 13 '13 at 17:46
  • @JustinDearing - this is a bit of a gray area, I would go with the rc.local option, mainly because over the course of my career, I've seen things similar to this done in that same way. So if anything, it's consistent to rationalize it this way, as to how others would do it. – slm Sep 13 '13 at 17:48
  • agreed. as just a sysadmin this is the right answer. If I made a distro and sat on the LSB committiee I'd argue for overengineering. – Justin Dearing Sep 13 '13 at 18:23
  • @JustinDearing - yes it's often safer to do things as others would expect them sometimes rather than what might seem right to just you. Hence why this site is great, lots of others to bounce your ideas off of before doing them 8-). – slm Sep 13 '13 at 18:27
  • Debian and derivatives do set up binfmt through a script in /etc/init.d, but that's generic support for all installed handlers. Bringing that (pseudo-)service up re-reads the handler descriptions from /var/lib/binfmts. Stopping the service deregisters all binfmt handlers from the kernel. However, for a local one-off thing, /etc/rc.local is perfectly appropriate. – Gilles 'SO- stop being evil' Sep 13 '13 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.