Marius van Witzenburg We fight for our survival, we fight!

10Jul/110

How to update your FreeBSD kernel and World system

Posted by mariusvw

Auto install using freebsd-update

See: How to use freebsd-update to update your FreeBSD kernel and world system

Manual Update World / Kernel

Its advised to run this in Screen, you can install it from /usr/ports/sysutils/screen.

First you have to update the SRC and Ports tree, follow the manual on this page to complete this step.

Next is to configure the make.conf so it won't install things we don't want.
Be sure you check out man make.conf for some make optimalisation settings.

Here is an example that I use:

WITHOUT_X11=yes
NO_GAMES=yes
NO_X=yes
 
# make optimalization (-j4, 4 = optimal for 1 cpu)
MAKEOPTS="-j4 -B"

In case you have edited (which is a 100% chance you did) files of the world installation you might need to edit the mergemaster.rc file and add some settings before running mergemaster.

Check this page to view an example: How to configure mergemaster to merge configurations on FreeBSD.

These are the steps to install a fresh kernel and world system. The TMPDIR that I use is because I disabled the ability to execute files on the standard /tmp mount.

mkdir /tmp_world
setenv TMPDIR /tmp_world
cd /usr/src
make clean
make buildworld
make buildkernel
make installkernel
make installworld

Merge the world system:

mergemaster

Be sure you check out man mergemaster. For example people use the -p argument. This can be handy in some situations.

Remove temp dir:

unsetenv TMPDIR
rm -r /tmp_world

Short versions (might be unsafe):

# Kernel & World
mkdir /tmp_world ; setenv TMPDIR /tmp_world; cd /usr/src; make clean
make buildworld && make buildkernel && make installkernel && make installworld
mergemaster
unsetenv TMPDIR; rm -r /tmp_world
 
# Kernel-only
mkdir /tmp_world ; setenv TMPDIR /tmp_world; cd /usr/src; make clean
make buildkernel; make installkernel
unsetenv TMPDIR; rm -r /tmp_world

Remove builded objects, only after a release upgrade:

cd /usr/obj
chflags -R noschg *
rm -rf *

Custom KERNEL

cd /usr/src/sys/i386/conf/
cp GENERIC YOURKERNEL
echo "# Kernel configuration" >> /etc/make.conf
echo "KERNCONF=YOURKERNEL" >> /etc/make.conf

Compile the same as above, only leave out the buildworld and installworld.

10Jul/110

How to use freebsd-update to update your FreeBSD kernel and world system

Posted by mariusvw

Information

http://www.freebsd.org/doc/en/books/handbook/updating-upgrading-freebsdupdate.html

Keep in mind, if you have a custom kernel that you need to upgrade your kernel manually!!!

Usage

The freebsd-update(8) utility supports binary upgrades of i386 and amd64 systems running earlier FreeBSD releases. Systems running 7.[01234]-RELEASE, 8.[01]-RELEASE, 8.2-BETA1, or 8.2-RC[123] can upgrade as follows:

# freebsd-update upgrade -r 8.2-RELEASE

During this process, FreeBSD Update may ask the user to help by merging some configuration files or by confirming that the automatically performed merging was done correctly.

# freebsd-update install

The system must be rebooted with the newly installed kernel before continuing.

# shutdown -r now

After rebooting, freebsd-update needs to be run again to install the new userland components:

# freebsd-update install

At this point, users of systems being upgraded from FreeBSD 7.4-RELEASE or earlier will be prompted by freebsd-update to rebuild all third-party applications (e.g., ports installed from the ports tree) due to updates in system libraries.

After updating installed third-party applications (and again, only if freebsd-update printed a message indicating that this was necessary), run freebsd-update again so that it can delete the old (no longer used) system libraries:

# freebsd-update install

Finally, reboot into 8.2-RELEASE:

# shutdown -r now