Upgrading a FreeBSD System with csup
  Aug 01, 2009

Upgrading a FreeBSD system is not all that hard. The FreeBSD Handbook obviously has a more verbose look at the whole process, but the following is basically what you will need to do on most systems.

If csup is new to you, man csup for more information. It is a C rewrite of cvsup.

/etc/csup.conf

This is the file that tells csup what to do and how to do it. It probably does not exist on your system, so create it and edit in the following:

Notice that I am using RELENG_8! This will sync our new source tree to FreeBSD 8.0-STABLE. If you just want the 8.0-RELEASE tree, change it to RELENG_8_0

RELEASE Code that has spent extended periods of time in STABLE and has been problem free in the wild.
STABLE Code that has been polished, tested for stability, and in the running to make it into RELEASE. Usually this codebase is quite stable and offers some goodies usually missing in RELEASE.
CURRENT Code that is often a test-bed for new features or current works in progress. Obviously, stability is an issue here, but the FreeBSD team always needs testers to submit bug reports to fix up the codebase.
  1. # vi /etc/csup.conf
  2. *default host=cvsup.freebsd.org
  3. *default base=/var/db
  4. *default prefix=/usr
  5. *default release=cvs tag=RELENG_8
  6. *delete use-rel-suffix
  7. *default compress
  8. src-all

Running csup

Now that we have a config for csup, we can sync our source tree with the one specified in /etc/supfile by running csup with a few arguments.

  • # csup -g -L2 /etc/cvsup.conf
  • Parsing supfile "/etc/cvsup.conf"
  • *Connecting to cvsup.freebsd.org
  • Connected to 72.233.193.64
  • Server software version: SNAP_16_1h
  • Negotiating file attribute support
  • Exchanging collection information
  • Establishing multiplexed-mode data connection
  • Running
  • Updating collection src-all/cvs
  • ... snip ... .... snip ...

Compile World and the Kernel

I would recommend doing an upgrade using the GENERIC kernel for safety reasons, but you can dive right in to using your new kernel if you please. Just replace GENERIC with YOURKERNELNAME that resides in /usr/src/sys/i386/conf.

If you plan to use GENERIC, you can actually leave out KERNCONF=GENERIC. I just put that in there so you can see what is going on and to make it easier to change if you want to use a custom kernel config.

  1. # cd /usr/src
  2. # make clean
  3. # make buildkernel KERNCONF=GENERIC
  4. # make buildworld
  5. # make installkernel KERNCONF=GENERIC

The worst is over. Before we slip into our new system, we have to boot into single-user mode and finish up the install and merge the new installation files.

Reboot into single user Mode

To get into single-user mode, reboot and press 4 at the boot menu

FreeBSD Boot Menu

In single-user mode, you have to manually set up the FreeBSD boot process to get a usable file system. Accept /bin/sh as your shell and when you get to a prompt do the following to get the system mounted:

  1. # mount -a -t ufs
  2. # swapon -a
  3. # ls /usr/src

Now that we can see /usr/src, we are ready to install the new installation files into their new home.

Running mergemaster may take some patience if you have not upgraded in a while, but pay attention to what you are doing. For example, you certainly do not want to install the new /etc/passwd or /etc/rc.conf!

Here is a short list of some of the config files that you will want to keep (by deleting the temporary). Keep an eye out for others and back up /etc!

  • /etc/passwd
  • /etc/group
  • /etc/hosts
  • /etc/rc.conf
  • /etc/master.passwd
  • /etc/shells
  1. # cd /usr/src
  2. # cp -R /etc /etc.bak
  3. # mergemaster -p
  4. # make installworld
  5. # mergemaster -iFU
  6. # reboot

Reboot and verify that the new kernel version has been updated.

  1. $ uname -a
  2. FreeBSD bakmon.ls.local 8.1-PRERELEASE FreeBSD 8.1-PRERELEASE #0: Sun Jul   4 00:39:14 UTC 2010 root@bakmon.ls.local:/usr/obj/usr/src/sys/GENERIC   amd64



Post a New Comment

Name

Message

Security
Code

        (case insensitive & space between words)