|Front | Info | Lists | Newsfeeds | Study Guide | What is BSD?|
NetBSD to have dynamic /bin and /sbin
By Jeremy C. Reed
NetBSD -current is in the process of switching to using dynamically linked programs under /bin and /sbin.
This was proposed back in December by Luke Mewburn to NetBSD's tech-userlevel mailing list, because of the inability to call dlopen(3) from libc and other libraries. For example, this is needed for use with pluggable locales, PAM, and nsswitch using proprietary LDAP modules.
A lot of discussion covering the different ideas and issues was discussed in December and January. And now it is being discussed a lot today.
The ELF dynamic linker is moved to /lib/ld.elf_so and the shared libraries needed by dynamic /bin and /sbin programs are also in /lib.
Also, a /rescue directory is now available that contains a program made up of the these /bin and /sbin programs linked together into a single executable. (This is made by the crunchgen(1) utility.) Plus the kernel now can prompt for init's path (so you can use /rescue/init if needed).
The space savings goes from 15 MB down to around 6 MB. But that is not the primary reason.
Also, the change causes a performance drop due to symlinks (for example, /usr/libexec/ld.elf_so linked to real /lib/ld.elf_so) and running the dynamic linker.
Some proposed ideas include having build options for keeping just the /bin and /sbin static again, and improving dlopen() so it will work with static binaries.
And other ideas include improving locale and creating new daemons for nsswitch-type and user authentication work; and keeping /bin and /sbin static and placing the dynamic versions under /usr/bin and /usr/sbin -- which could be confusing.
BSD/OS also has /bin and /sbin utilities that use shared libraries. According to the BSD/OS shlib(8) manual page, both memory in running processes and disk space can be conserved, because the library binary is loaded on demand and is shared between all processes that use it. This BSDI-developed system doesn't support dlopen(3) dynamic linking routines.
Also, some Solaris systems include a /usr/sbin/static directory with a few statically-built tools available for recovery (if you can mount /usr/sbin).
Again, the changes are in the development version of NetBSD. The upcoming 1.6 release will not include these changes.
DiscussionDiscuss this article below.
I think you're better... - Donn
I think you're better...
"Making dlopen() "work" in static binaries is basically asking the ELF spec to bend itself over a table...."
While I don't know about the exact technical issues with
this, try reading the thread at mail-index.netbsd.org. I
got the impression that implementing dlopen() for static
binaries would be really hard and definitely the result
would not be a clean one.
In case of /bin and /sbin the static programs in the
root file systems could as well be superseded by dynamic
ones in /usr/bin and /usr/sbin. Of course, you must
make sure that the order in $PATH is always the one you
really want. Or else. Why not dicard the whole differentiation
between /usr and root, the wohle historic reasons for
that being fully obsolete now?
Seeing those figures, I suppose the root fs need not be
larger as before :)
BSD Links· Advocacy
· User Groups