1

I'm building a Linux system that doesn't have a /usr directory. Getting the toolchain to work was surprisingly easy, but I'm hitting this irritation with a lot of auto* scripts: configure, etc. often seem to assume env is in /usr/bin.

A workaround is to do ln -sv .. /usr during the build, but obviously that's aesthetically unappealing and runs the risk of a path with /usr in it leaking into the final system. (There will be a network mounted /usr in production, and I don't want the base system to even know it exists.)

Did I install my autotools wrong, or is this just an irritating assumption configure often makes? Am I breaking FHS by not putting env in /usr/bin? (That's not a deal breaker for me; I'm already breaking it by having /inc and /share.)

  • 1
    as @xx4h says: you are not, strictly speaking, breaking FHS by not putting env in /usr/bin. that's not a big deal: everyone breaks FHS. really. people vaguely care about it, but not really. what you are breaking, though, is decades of convention. and that is much more important. – strugee Jun 12 '14 at 7:00
2

You may find /usr unaesthetic, but that is the way the universe works. Almost every Unix out there has /usr/bin/env — as far as I know, the only extant Unix that doesn't is SCO OpenServer, and it's not a big extant. By not having /usr/bin/env, you aren't just violating the FHS, you're violating an extremely widespread convention. /usr/bin/env is a standard location, even if that standard isn't written. It is not meant to be a configurable location: /usr/bin/env is the one location that everybody can assume to exist.

Whether you like it or not, the solution is to arrange to have /usr/bin/env. Removing the /usr hierarchy is fine, but if you do that, make /usr a symbolic link to /.

If you're going to mount a /usr over the network, then:

  • Make /usr a directory that contains a symbolic link bin -> ../bin.
  • Make sure that on the filesystem that you mount on /usr, the file bin/env is either a symbolic link to /bin/env or a working env program.
1

/usr/bin is THE location for env on nearly every linux and some unixes including OpenBSD. Many scripts use this shebang to respect the in the users PATH set locations for bash, sh, python, perl, ...


Further information for

Did I install my autotools wrong, ...

needs some more information on "the toolchain", i think.

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.