Things look quiet here. But I've been doing a lot of blogging at
dan.langille.org because I prefer WordPress now.
Not all my posts there are FreeBSD related.
I am in the midst of migrating The FreeBSD Diary over to WordPress
(and you can read about that here).
Once the migration is completed, I'll move the FreeBSD posts into the
new FreeBSD Diary website.
Build world on your fast box, install on your slow box6 February 2001
The build world process is used to upgrade FreeBSD from one version to
another (e.g. 4.2-RELEASE to 4.2-STABLE). This process involves downloading source
code, compiling it, installing it, and resolving any configuration file issues,
although not necessarily in that order. The best place to read about this process is
the FreeBSD Handbook
(just search for NFS).
In my case, I have a fast dual Xeon box,
and a much slower 486 box (see "my first" at the bottom right of this page). When I first did a build world, it took
57 hours on my 486 with 16MB of RAM. That's not something I'm likely to do very
often. Fortunately, the build world process is divided up nicely into distinct
sections which will me to build world on the Xeon, and then install to the 486.
This process uses NFS, so we'll assume you have NFS configured
on both boxes. I've configured my Xeon box as an NFS server and my 486 as an NFS client.
Full instructions on how to do these configurations are included in the NFS link
13 March 2000 - I updated the script file and modified this article
accordingly. Things have changed in the kernel building arena, so I've added
KERNCONF to the makefile. For more information on KERNCONF, see
the man page for
I also added three new options to the makefile:
I also changed the format of the log files:
The value of <action> depends on what you did:
build and install kernel
You can also delete the logs with make cleanlogs.
A few warnings
You must ensure that you use the same settings for building as for
installing . If you don't, you could be asking for trouble.
Any -D variables defined in the buildworld must also be supplied in the installworld
just like the makeworld handbook
page says. In short, any options you use on the make buildworld must also be used on
the make installworld. There will be tears if you don't.
Don't set CPU specific optimization flags and then do the installworld on a other-than
Read /usr/src/UPDATING. It contains the latest information about
building. The information on build world can quickly become dated.
Those are the primary things you should consider. But some recent talk has been
about /etc/make.conf on each box contain similar settings. Remember to
take into account /etc/defaults/make.conf. Most people will not have
to worry about this. If you have no idea what I'm talking about, then you probably
don't need to be concerned.
The other thing to note is that I am using a custom makefile for this process.
You don't have to use this makefile, but I've found it quite useful. See the Resources section for details on this makefile. As much as is
possible, I will give both sets of commands: the command for my makefile and the command
the makefile actually issues. I use this makefile because it is easy, convenient,
saves typing, and automatically creates logs for me. I normally put this makefile in
/root/make but it can reside anywhere. I merely find that location
convenient so I can easily do this:
[dan@xeon:~] $ su -l
[root@xeon:~] # cd make
From there, I can issue all the commands which appear in the following
sections...unless otherwise stated.
NOTE: I put this makefile on both boxes, the XEON and the 486. I configured each
on the XEON box, I put MYKERNEL=XEON
on the 486, I put MYKERNEL=DUCKY
If you don't set them correctly on each box, you might wind up installing the wrong
kernel. That's no big deal. Just follow the instructions in the handbook for
booting from an alternative kernel. Here's the short version: press space at the
booting countdown, then enter unload, then enter boot kernel.old (or
whatever kernel you want; type ls for a list).
I'm using my make world script
(originally from Jim Mock), which isn't necessary, but keeps the commands handy and keeps
nice logs. I will assume you have already downloaded this script, installed it, and
I found out how to do this type of install by reading the FreeBSD
Handbook (available both online and in book form). In the handbook, I found this section on make world.
Search the page for a reference to NFS (it's under 126.96.36.199. Version
2.2.5 and above).
NFS exports - on the Xeon (server)
Here are the NFS exports I put on my Xeon box. 10.0.0.45 is the IP
address of my 486.
[root@xeon:~] # more /etc/exports
/usr/src /usr/obj 192.168.0.20
Note that all exported directories within the same file system must appear on one line.
By default, /usr/src and /usr/obj are on the same file
NFS imports - on the 486 (client)
My 486 already had a /usr/src and a /usr/obj.
But I didn't worry about that. These commands will not overwrite these files.
You may have to create these directories before issuing the following mounts.
are the NFS mounts which I issued on the 486. These will allow the 486 to see the
files on the Xeon.
# mount -v xeon:/usr/src /usr/src
xeon:/usr/src on /usr/src (nfs)
# mount -v xeon:/usr/obj /usr/obj
xeon:/usr/obj on /usr/obj (nfs)
Instead of xeon, you could use the IP address of the server or the name of
the box. Use whatever works and what you normally use.
The quick and easy guide
This section outlines the steps which are detailed below. This
intended to be a quick reference for those who are familiar with the steps and just need a
quick reminder of what to do. Again, this assumes you have installed the makefile in
~/make when you were su'd to root.
Remember to create your kernel
configuration file first and set the name of this file within the Makefile (see MYKERNEL).
su to root
make update (updates your sources)
make build - does a build world.
make kernelbuild MYKERNEL=DUCKY on the fast box
make kernelinstall MYKERNEL=DUCKY on the slow box
/usr/src/UPDATING recommends a reboot here just to make sure the kernel you
just built is operational. If it is not you can still reboot to kernel.old and still
have your world and kernel in sync. For what it's worth, I don't usually do this
make install - installs the results of the above builds
make merge - merges the configuration file changes
update sources and build world - on the XEON
The build world is always done on the fast box. This involves
# make update
# make world
These two steps update your source code and does a make world (compiles the base
system). If you were issuing these commands manually, this is what you would type:
# cd /usr/src
# cvsup -g -z -L2 supfile
# make buildworld
where supfile is the name of your cvsup configuration file.
My elapsed time: 2.5 hours.
I suspect it's my disks which are slowing me down. I know it takes only about an
hour on a Pentium III (compared to the dual XEON I have) box a client has. But I
know they have faster disks.
Build the 486 kernel on the XEON
I upgraded the XEON first to 4.2-stable first. Mostly so I could use
it to build the kernel for the 486. I didn't want to do anything on the 486 which I
didn't have to do. I copied the 486 kernel configuration file to /usr/src/sys/i386/conf
on the Xeon.
# make kernelbuild MYKERNEL=DUCKY
This assumes the kernel configuration file for the 486 is named DUCKY and has been
copied to the XEON box (i.e. /usr/src/sys/i386/conf).
These are the commands you would type manually:
# make buildkernel KERNCONF=DUCKY
Now that doesn't look like much saving on keystrokes, but the script does create a log
Note that I did not do an install. The above commands were issued on the Xeon,
not the 486. The install will be done on the 486.
My elapsed time: 18 minutes.
kernel install on the 486
I've already built the 486 kernel on the Xeon. I copied the
configuration file from the 486 to the XEON via FTP. Then I moved it into /usr/src/sys/i386/conf/and
build a kernel as normal. Remember: I had my custom makefile on both boxes!
This time, I'm issuing the commands on the 486.
# make kernelinstall MYKERNEL=DUCKY
Remember: this directory actually resides on the XEON, because of the NFS mount.
But it will install the kernel on the 486.
The manual command for this is:
# cd /usr/src
# make installkernel
My elapsed time: 2 minutes.
This is where you can reboot to make sure you have a working kernel.
If the box doesn't reboot, follow the instructions in the handbook for booking an
old kernel. Basically, you press the space bar during the boot countdown, then type unload,
then boot kernel.old.
install world on the 486
In a previous section, I set up the NFS mounts on the 486. This
allows me to install the files from the Xeon onto the 486. This will still take
quite some time (the 486 isn't very fast, but at least it's not compiling world).
# make install
Actually, I had the make world script on the 486,
so all I did, as root, was cd ~/make ; make install.
The manual commands would be:
# cd /usr/src
# make installworld
My elapsed time: 30 minutes.
Since this was a production box, I actually did a nice 15 make install so
that it ran at a lower priority.
The next step was do to the mergemaster
run on the 486. mergemaster I used my script for that:
# cd ~/make
# make merge
If you're not using my script, I suggest you follow the normal mergemaster instructions
for upgrading. But here's the extract from my makefile:
# mergemaster -w 120 -t
My elapsed time: 10 minutes.
After a shutdown -r now on the 486, it came up with FreeBSD
Note: I do remember a problem with /etc/pam.conf. This
may have been my fault, but I didn't get the new file during the upgrade. I may have
screwed up with my merge. The symptoms turned up when I tried to used SSH.
Sorry, but I didn't record the details. I think it had to do with system keys being
in a different format.
Errors I have known15 August 2003
I got this error when I forgot to mount the NFS volumes on the slow box.
>>> Installing everything..
cd /usr/src; make -f Makefile.inc1 install
creating osreldate.h from newvers.sh
setvar PARAMFILE /usr/src/include/../sys/sys/param.h; . /usr/src/include/../sys/conf/newvers.sh; echo "$COPYRIGHT" > osreldate.h;
echo "#ifdef _KERNEL" >> osreldate.h; echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; echo "#else"
>> osreldate.h; echo \#'undef __FreeBSD_version' >> osreldate.h; echo \#'define __FreeBSD_version' $RELDATE >> osreldate.h; echo "#endif"
touch: not found
*** Error code 127
Stop in /usr/src/include.
*** Error code 1
Stop in /usr/src.
*** Error code 1
I solved the problem by mounting the NFS volumes and trying again. On the slow box, I actually had a fully
populated /usr/src and /usr/obj from a previous build world.
When I first saw this error, I thought it was
caused by the clocks on the two boxes not being set to the same time. After fixing that issue, the problem
still occurred. It wasn't until later that I noticed I had not remounted the NFS volumes.
After the upgrade is completed, you may wish to disable NFS on the client