how to upgrade from FreeBSD 6.1 to 6.4-RELEASE
February 10th, 2010

Below is an abridged/tweaked version of the instructions found here: http://www.daemonology.net/blog/2007-11-10-freebsd-minor-version-upgrade.html

  1. Login as root (single-user mode not necessary)

    Note: this procedure may be performed via an SSH session - but if your sshd_config needs manual merge (see below), and you screw it up, this could be problematic.

  2. Prepare, and grab the freebsd-update tarball:
    mkdir /var/db/freebsd-update
    mkdir /usr/upgrade
    cd /usr/upgrade
    fetch http://www.daemonology.net/freebsd-update/freebsd-update-upgrade.tgz 
    fetch http://www.daemonology.net/freebsd-update/freebsd-update-upgrade.tgz.asc 
    gpg --verify freebsd-update-upgrade.tgz.asc freebsd-update-upgrade.tgz
    

    Check the signature - do not continue if the signature does not verify. GPG must be installed to do this.

  3. Extract the tarball, and start freebsd-update:
    tar -xf freebsd-update-upgrade.tgz
    sh freebsd-update.sh -f freebsd-update.conf -r 6.4-RELEASE upgrade
    

    Note the -r parameter - this determines the distribution to upgrade to. It must exactly match the name of the target distribution (as seen on the FreeBSD website).

  4. If the output from freebsd-update looks reasonable, press Y and Enter to continue. Diffs will be calculated, magic will be performed, and updates downloaded.

    If the merge needs manual assistance, you'll end up in vi. This will happen for each file requiring a manual merge. For each set of conflicts in each file (there may be more than one set), the old and new versions are shown. The lines between the "<<<<<<< current version" line and the line consisting of "=======" are the existing lines in the file which are in conflict; the proposed replacement for these lines is below the ======= line. Delete everything except those lines you wish to keep. Delete the "current version" line, the ======= line, and the ending ">>>>>>> 6.4-RELEASE" line. Ensure to locate and resolve every conflict. Failing to remove the "current version" line and other bits will leave them in the file, which may or may not affect things, depending on the file.

    In the example below, the line "#VersionAddendum FreeBSD-20050903" is in conflict with the line "#VersionAddendum FreeBSD-20061110":

    <<<<<<<  current version
    #VersionAddendum FreeBSD-20050903
    =======
    #VersionAddendum FreeBSD-20061110
    >>>>>>> 6.4-RELEASE
    

    To resolve this conflict, delete everything except the correct line:

    #VersionAddendum FreeBSD-20061110
    
  5. Install kernel updates (don't skip the reboot):
    sh freebsd-update.sh -f freebsd-update.conf install
    reboot
    
  6. Install userland updates:
    cd /usr/upgrade
    sh freebsd-update.sh -f freebsd-update.conf install
    

    If a message appears, "Completing this upgrade requires removing old shared object files. Please rebuild all installed 3rd party software (e.g., programs installed from the ports tree) and then run "freebsd-update.sh install" again to finish installing updates.", then do the following:

    cd /usr/ports/ports-mgmt/portupgrade
    make deinstall
    make install clean
    rehash
    portupgrade -af
    cd /usr/upgrade
    sh freebsd-update.sh -f freebsd-update.conf install
    
  7. Reboot to finish (don't skip this):
    reboot
    

Notes: