Slashdot Mirror


/bin And /sbin Now Dynamically Linked In FreeBSD

Dan writes "Gordon Tetlow just committed a patch in FreeBSD current to change /bin and /sbin from statically to dynamically linked. The reason to do this is two-fold. This feature brings support for loadable PAM and NSS modules to base system utilities located in those directories. It also reduces the storage requirements for the root filesystem due to the use of shared libraries. This feature can be disabled in a buildworld by defining the Makefile (make.conf) variable WITHOUT_DYNAMICROOT. Note that statically-linked, crunched executables are available in the /rescue directory for use during system repair and recovery operations."

14 of 172 comments (clear)

  1. Cool by __past__ · · Score: 4, Insightful
    Even with having statically linked versions of the tools needed for system repair in /rescue, the whole stuff still takes less place then before. So you really get the best of both worlds: The base system is smaller, more flexible and potentially even faster (has anybody measured it yet?), but static binaries are still around when you hosed you linker or libs.

    I'm still somewhat surprised that this got committed now, shouldn't 5.2 be released Really Soon Now? This looks like something that ought to be tested in -CURRENT for a good while.

    1. Re:Cool by rtaylor · · Score: 4, Informative

      Indeed.. According to the schedule the tree is to be frozen today.

      --
      Rod Taylor
    2. Re:Cool by __past__ · · Score: 4, Informative

      Because size is not the only reason for the dynamic /bin. One big reason was better support for dynamically loadable PAM/nsswitch modules in the base utilities - so there is a good reason to have multiple versions of some binaries, one that always works and one that can do more fancy stuff.

    3. Re:Cool by shlong · · Score: 4, Informative

      I'm still somewhat surprised that this got committed now, shouldn't 5.2 be released Really Soon Now? This looks like something that ought to be tested in -CURRENT for a good while.

      This is of course a very valid concern. It should be noted, however, that this was the last phase in the overall change. The 'heavy lifting' parts were done months ago (creating /rescue, moving libraries to /lib and /libexec). It also had been extensively tested by many developers, and was already an optional switch when building world.
      In the end, we decided that a dynamic root filesystem was the future of 5.x, and that the 5.3 cycle was already overbooked with significant changes. We still have nearly a month before the release date of 5.2 to iron out any bugs. So after some final testing for a few days last week, I asked Gordon to Throw The Switch.

      --
      Cat, the other, tastier white meat.
    4. Re:Cool by gnu-sucks · · Score: 5, Insightful

      if anything, there should be a /static. You see, 99% of all users will not see ANY improvement in this new scheme. It would be better to 'tack on' this idea as an option to the 2% user base that would actually use this to their advantage.

      Do I really want to set my default shell to /rescue/sh and set all my important tools similarly? Heck no.

      I want those users using PAM and whatnot to specify /static for THEIR SPECIFIC needs, and let the rest of the FreeBSD users maintain /bin and /sbin as they are, and should be.

      This is sort of like an isp optomizing all connections for SNMP, because two users said it would be a good idea for what they do all day. And the isp tells all the other users, "well, we have an alternative dialup connection you can use, though its only at 9600, for better web browsing"

      So sure, you can either 1) recompile FreeBSD, or 2) suffer the slings and arrows of /rescue.

      Or, FreeBSD could just NOT BE STUPID OUT OF THE BOX.

  2. Re:Bad if not included with non-dyn executables by __past__ · · Score: 4, Informative
    But I don't understand this myself. /sbin means "static /bin" and it's that way for recovery purposes.
    Wrong. man 7 hier:
    /sbin/
    system programs and administration utilities fundamental to both single-user and multi-user environments
    Think "system administration", not "static". After all, /bin was static too, so the distinction doesn't much sense (and I think /sbin has been part of Unix earlier than dynamic linking anyway)
  3. Re:Ant this news is ... by torpor · · Score: 5, Insightful

    Of course it is.

    How the /bin && /sbin binaries are treated in a release as significant as FreeBSD, is definitely news for nerds, stuff that matters.

    The static nature of /sbin has been a significant issue in Unix-user/-admin land for many, many years. This change now sets in place a new scheme for administrators to understand and work around - with the new linking flag, admins can set up systems in new and interesting ways.

    Any FreeBSD admin who now doesn't understand the reasoning and potential problems of this new linking scheme will *definitely* need to learn it and understand it if they want to continue doing a good admin job in the future.

    One good way to learn about this and use it is to read the comments from slashdot readers about this issue ... and thus, this *IS* important news for slashdot.

    Just because SCO/MICROSOFT/LINUX isn't in the article, doesn't mean its not important ...

    --
    ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
  4. Security advantage by ebcdic · · Score: 4, Insightful

    One of the main advantages of this is that you can replace libraries with security loopholes without having to rebuild everything. There have been several cases of bugs in the standard libraries that have required the statically compiled programs in /bin to be rebuilt.

  5. Purpose of / by martycombs · · Score: 3, Interesting

    I thought *nix was designed as:

    / - minimum required to boot and repair system

    /usr - other binaries included on default distro

    /usr/local or /opt - packages added above and beyond the distro

    If your system ever became damaged, you booted to / and fixed it. If / is too large, then audit what's in there and make sure it contains the bare minimum required.

    Adding /rescue is unnecessarily cluttering up the system.

    1. Re:Purpose of / by Brandybuck · · Score: 4, Informative

      / - minimum required to boot and repair system

      It still is. /rescue is for repairing the system. /bin and /sbin are a comfortable but minimal set needed for booting.

      While there may be stuff in /bin and /sbin you might never use, all of it is used by someone or another at boot, single or rescue time.

      --
      Don't blame me, I didn't vote for either of them!
  6. Re:The Editor war is over : Vim won! by fsmunoz · · Score: 3, Funny

    ...With less and less distrobutions shipping emacs...

    M-x ispell-buffer

  7. Re:Bad if not included with non-dyn executables by Brandybuck · · Score: 3, Funny

    How often do you have a libc upgrade fail, though

    In FreeBSD, never. In Linuxland, everytime GNU bumps the minor version of glibc. To be fair, the upgrade works fine. It's just that everything else on the system breaks.

    --
    Don't blame me, I didn't vote for either of them!
  8. Re:Amiga by cant_get_a_good_nick · · Score: 3, Informative

    You don't understand the post. The point is not that FreeBSD is going boldly into the 80s with dynamic linking, it's that the default world now has binaries living in /bin and /sbin as dynamic instead of static. For a long time they were all static linked because of recovery issues. Now they are dynamically linked (with an option to be static if you're paranoid). They probably link against only stuff in /lib which will be on the root partition. Anything in /usr/lib would be dangerous if /usr was toasted - your shell would go bye bye.

  9. Did you actually try it? by siobHan · · Score: 4, Insightful

    I wonder if anyone screaming about what a HORRIBLE idea this is and how it will cause cancer in kittens, has actually tried it? Obviously the FreeBSD developers are not dumb, and root will always be able to get on to use /rescue, and the advantages are a lot more sophisticated than just saving some space on the root partition.

    It's pretty knee-jerk to scream about it if you don't actually know how it's been implemented.

    J