Question about the installation directory of programs

Laurent Bercot ska-dietlibc at skarnet.org
Thu Nov 7 19:43:05 UTC 2013


> Yeah. That's why I'm somewhat confused, as busybox is installing more programs into /bin and /sbin directories than what are specified in FHS.
>
> Take /bin as an example, the FHS only specifies a few commands to be there.
> http://www.pathname.com/fhs/pub/fhs-2.3.html#BINESSENTIALUSERCOMMANDBINARIES
> http://www.linuxbase.org/betaspecs/fhs/fhs/ch03s04.html
>
> But we can see that busybox is installing more programs. I get the list with the following commands.
> 1. make allyesconfig
> 2. make busybox.links
> 3. grep '^/bin/' busybox.links

  Don't look too much into it.

  The FHS has been established more for historical reasons than anything else; and it's
a set of general guidelines that aren't necessary relevant to all systems.
  For a modern, embedded system, the kind of which you'd want to use Busybox on, the
distinction between / and /usr is largely irrelevant. Most of the time, the only
relevant distinction on an embedded system is between read-only (the "firmware") and
read-write (the "config data" and "user data").
  Nowadays, the only systems that actually make a real distinction between / and /usr
are, ironically, the BSDs, where /bin binaries are statically linked to provide a
failsafe recovery system. GNU certainly can't do that. Alternative libc Linux users
could, but AFAIK nobody bothers; people who like static linking link *everything*
statically.

  It doesn't really matter where you place your binaries. Executing a binary should
be done with PATH search anyway, and PATH will always contain /usr/bin and /bin at
least. If it bothers you, there's a busybox configuration option to entirely forget
about /usr, which is the cleaner and IMHO sensible choice.

  The only case where this matters is when you have to provide absolute pathnames,
for instance in shebang lines. #!/bin/sh, but #!/usr/bin/perl. When you have a
script interpreter, it's important for it to be accessible via a well-known
absolute path.
  Unfortunately, when it comes to guaranteeing absolute paths, the FHS sucks. There
were initiatives to provide such guarantees, and cover the major FHS weaknesses
*cough* slashpackage *cough* but unfortunately, nobody caught on, and we're still
in 1970 as far as shebang lines are concerned.

  So yeah. Let Busybox install its binaries wherever it wants, and use PATH searches.

-- 
  Laurent



More information about the busybox mailing list