Subject: HEADS UP: migration to fully dynamic linked "base" system
To: None <current-users@netbsd.org>
From: Luke Mewburn <lukem@netbsd.org>
List: current-users
Date: 08/26/2002 16:20:39
A `heads up'.

I will be switching NetBSD-current to have dynamically linked programs
in /bin and /sbin in the next day or so.

This will be achieved by changing the default definitions of SHLIBDIR,
and SHLINKDIR in <bsd.own.mk>, and removing "LDSTATIC?=-static" in
various Makefiles.

The user visible changes of this include:

    +	/usr/libexec/ld.elf_so is moved to /lib/ld.elf_so.
	A compatibility symlink is provided.

    +	Shared libraries used by programs in /bin and /sbin have been
	moved from /usr/lib to /lib.  Compatibility symbolic links are
	provided.

    +	All programs in /bin and /sbin are now dynamically linked,
	and can take advantage of dlopen(3).

    +	/rescue/* recovery tools provided. These are a statically linked
    	crunchgen(1)-ed copy of the program in /bin, /sbin, and a few
    	others, to allow you to recover a system in the same manner that
    	you can with today's statically linked /bin and /sbin.

	If the system is "hosed" to the point where /sbin/init won't
	start (because /lib/libc.so.* is damaged, for example), boot
	to single user using your machine's method of setting RB_ASKNAME
	(usually "boot -sa"), and enter "/rescue/init" as the path to
	init(8), and recover from there.  You may need to prepend
	/rescue to the path.

    +	Reduction in disk space usage in `/'.
	On a 1.6_BETA3/i386 system:
		5660    /bin
		10322   /sbin
		15982   total

	On a fully dynamic i386 system:
		1506    /bin
		1702    /sbin
		1206    /lib
		4804    /rescue
		9218    total
	(The rescue tools are not strictly necessary, but they are
	recommended and included here to show that even with them,
	there is still a disk space saving).

    +	Static linking of programs is still supported; just set
	LDSTATIC=-static in the Makefile or make(1)'s environment.
	Of course, such programs will not be able to benefit from
	future features such as dynamic modules for nsswitch, locale,
	authentication (PAM ?), etc.


I've tested an upgrade from an existing system to a fully dynamic
system (built with "./build.sh -D /"), as well as building a release
to a DESTDIR and then extracting the resultant sets, and it all works.

It is recommended that you have up to date rescue tools first.
Ensure that you have an up-to-date crunchgen(1), and then build and
install the rescue tools with something like:
	cd /usr/src/rescue
	make dependall install

If you just build & update with a "make" and "make install" in the top
level of /usr/src, you *MUST* install a shared linker into /lib, with
something like:
	cd /usr/src
	make do-ld.elf_so
(build.sh is still the preferred method of updating).

In the unlikely event that the change to fully dynamic fails, you can use
the rescue tools to recover, as described above.


Luke.