Table of Contents
Please remember to check src/UPDATING for the latest changes.
If you are running a stable NetBSD release (such as NetBSD 5.0), in a production environment, you should occasionally update your sources and rebuild the system or the kernel, in order to incorporate any security fixes that have been applied to the branch since its release.
The update process is the same for NetBSD-current, therefore the following steps apply to -current systems as well.
Most of the following steps can be done as ordinary user.
Only the installation of a new kernel and the userland will require
root privileges.
Although /usr is choosen as the working
directory in the following examples, the procedure can also
take place in a user's home directory. Ordinary users have normally not
the permissions to make changes in /usr,
but this can be changed by root.
Having up-to-date sources is a prerequisite for the following steps. Section 30.4, “Fetching by CVS” informs about the ways to retrieve or update the sources for a release, stable or current branch (using CVS).
Please always refer to the output of build.sh -h
and the files UPDATING and
BUILDING for details - it's worth
it, there are many options that can
be set on the command line or in
/etc/mk.conf
The first step is to build the userland:
$cd /usr/src$./build.sh -O ../obj -T ../tools -U distribution
The next step will build the kernel:
$cd /usr/src$./build.sh -O ../obj -T ../tools kernel=<KERNEL>
Installing the new kernel, rebooting (to ensure that the new kernel works) and installing the new userland are the final steps of the updating procedure:
$cd /usr/src$su#mv /netbsd /netbsd.old#mv /usr/obj/sys/arch/<ARCH>/compile/<KERNEL>/netbsd /#shutdown -r now...$cd /usr/src$su#./build.sh -O ../obj -T ../tools -U install=/
If the new kernel netbsd does not boot
successfully, you can fall back on booting the
netbsd.old kernel.
Run the etcupdate script (etcupdate(8)) and follow the instructions in the output for fixing obsolete files:
#/usr/sbin/etcupdate -s /usr/src
Optionally reboot to ensure all running services are using the new binaries:
#shutdown -r now
From the root of the source tree:
$cd /usr/src
Build the userland:
$./build.sh -O ../obj -T ../tools -U -u distribution
Build the kernel:
$./build.sh -O ../obj -T ../tools -U -u kernel=GENERIC
Install the kernel:
$cd ../obj/sys/arch/<ARCH>/compile/GENERIC$su#mv /netbsd /netbsd.old#cp netbsd /netbsd
Reboot into the new kernel:
#shutdown -r now
Install the new userland:
$cd /usr/src$su#./build.sh -O ../obj -T ../tools -U install=/
Update the system and configuration files;:
#/usr/sbin/etcupdate -s /usr/src
In the procedure above, the -u option indicates an update process,
and that a make clean operation should not be run before starting the build. This is
useful when doing an update from a previous build and/or a fresh build. The
-U option allows the entire build by a non-root user
followed with an install by root.
It is also possible to use sysinst to install a freshly
built system. The steps are as follows:
Build a complete release:
$./build.sh -O ../obj -T ../tools -U -u -x release
The resulting install sets will be in the
/usr/obj/releasedir/ directory.
Copy the install kernel to the root directory of your NetBSD system,
reboot from it, and upgrade with sysinst
(see Chapter 4, Upgrading NetBSD ).
etcupdate is a script to help users compare,
merge and install new configuration and startup files (files found in the etc.tgz
distribution set) in /dev, /etc and /root after performing an operating
system upgrade. The upgrade of the operating system could have
been performed either by compiling sources or by extracting
the distribution binaries.
In case where the sources are in /usr/src the following command should be enough:
#etcupdate
But what if your NetBSD sources are in an alternative location, such as
in /home/jdoe/netbsd/src? Don't worry, tell
etcupdate the location of your source tree with -s srcdir and it will work
just fine:
#etcupdate -s /home/jdoe/netbsd/src
Sometimes it's not convenient to have the sources around but you still want to update the configuration and startup files. The solution is to feed etc.tgz (or xetc.tgz) to etcupdate via the -s tgzfile switch.
#etcupdate -s /some/where/etc.tgz
The etcmanage perl script (available from
pkgsrc/sysutils/etcmanage
or as binary package) is an alternative to etcupdate.
It should be used in the following way, in combination with postinstall(8):
#/usr/pkg/bin/etcmanage#/usr/sbin/postinstall