How to Upgrade FreeBSD from 8 to 9

Upgrading FreeBSD is very easy. Thanks for the simple architecture design and the disconnection between the kernel and the applications (ports), the whole process takes around 15 to 45 minutes. The coolest thing is that the system down time is very short. In my case, the down time was only about 3 minutes.

This table will help you to estimate the whole process and system down time:

Action Down Time? Approximate Duration
Download the update files None 5 to 15 minutes
Installing the update None 5 to 15 minutes
Helping FreeBSD to set up the system configurations None 1 to 3 minutes
Reboot Yes 1 to 3 minutes
Installing the update None 1 to 2 minutes
Reboot (Optional) Yes 1 to 3 minutes

Notice that this tutorial only works for i386 or amd64. For other CPU architectures such as Sparc, you will either reinstall the whole thing or rebuild the whole world (i.e., make buildworld). One way or the other, that’s a very time-consuming process.

First, I am assuming that your FreeBSD is up-to-date in your current version. You can do it by running the following command:

First, make sure that your ports are up to date.

#Download the latest ports
sudo portsnap fetch update

#Upgrade the old ports:
sudo portmaster -Da

Next, we want to upgrade the FreeBSD. Currently, the latest version is 9.1:

sudo freebsd-update upgrade -r 9.1-RELEASE

FreeBSD will try to download files for you. Just say yes.

Looking up mirrors... 4 mirrors found.
Fetching metadata signature for 8.2-RELEASE from done.
Fetching metadata index... done.
Fetching 1 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic world/base world/manpages

The following components of FreeBSD do not seem to be installed:
src/base src/bin src/cddl src/contrib src/crypto src/etc src/games
src/gnu src/include src/krb5 src/lib src/libexec src/release src/rescue
src/sbin src/secure src/share src/sys src/tools src/ubin src/usbin
world/catpages world/dict world/doc world/games world/info world/lib32

Does this look reasonable (y/n)? y

Next, it will download the patches. Depending on your internet connection speed, it may take 1 to 10 minutes:

Applying patches... done.
Fetching 1962 files... done.
Attempting to automatically merge changes in files... done.

Now, FreeBSD will try to check whether your configuration is compatible with the new version or not. It may need your help to merge the configuration files manually. Notice that it uses VI, a standard (and very old, not really user-friendly) editor in Unix. If you’ve never used vi before, here are some simple commands:

#By default, a document is opened in read-only mode. To switch to a wrote mode:

#To set the mode to read only
Press the ESC key

#Delete a character

#Delete the whole line

#Save a file

#To quite vi

#To save and quite

After some file editing, FreeBSD will give you a summary of what files will be changed. Just hit either ESC or q to end the list.


At this point, FreeBSD finish the upgrade plan. (It hasn’t made any change to your system.) Now we need to give a green light to FreeBSD to start upgrade the system.

sudo freebsd-update install
...Please reboot and run "/usr/sbin/freebsd-update install" again to finish installing updates.

After the reboot, run the command again to update the userland components:

sudo freebsd-update install

Installing updates...
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 "/usr/sbin/freebsd-update install"
again to finish installing updates.

Reboot the computer again to finish the upgrade.

sudo reboot

Now, we need to upgrade all of the ports. Notice that this step is optional. You don’t need to do it unless you found any problem after the upgrade.

#Upgrade all the installed ports
sudo portmaster -fa

Reboot the computer again to finish the upgrade.

sudo reboot

Make sure that FreeBSD is running on the latest version:

# uname -a
FreeBSD 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64

Have fun with FreeBSD.


Our sponsors:

3 Replies to “How to Upgrade FreeBSD from 8 to 9”

  1. Mr_Smith

    Thank you Derrick for this very informative and helpful blog.

    I started doing the update 5 hours ago, and it is still not completed. Got many issues along the way.

    First, the portmaster -Da failed with this error message “=> SHA256 Checksum OK for libpng-1.5.16.tar.xz.
    => SHA256 Checksum OK for libpng-1.5.16-apng.patch.gz.
    tar: Unrecognized archive format
    tar: Error exit delayed from previous errors.
    *** Error code 1

    Stop in /usr/ports/graphics/png.
    *** Error code 1

    I didn’t complete portmaster -Da and proceeded to run the upgrade.

    Running freebsd-update upgrade -r 9.1-RELEASE produced this error message:
    “The update metadata is correctly signed, but
    failed an integrity check.
    Cowardly refusing to proceed any further.”

    Found the fix here:

    Also, along the way, I was prompted for Yes, No or Ignore or Try many times. Also had to manually resolve some conflicts.

    Worst of all is this:

    /usr/sbin/freebsd-update install
    Installing updates…
    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 “/usr/sbin/freebsd-update install”
    again to finish installing updates.”

    Doesn’t give me much confidence. Do I have to re-installed all the software I previously installed from ports? That’s too much. A fresh install of Freebsd 9.1 looks much more efficient and safer than doing a freebsd-update.

    Don’t know how you get the update to complete between 15 – 45 mins. The update on my machine took a few hours. Are you using a supercomputer?

    Thank you very much once again.

    • Derrick Post author

      It shouldn’t take that long. Basically freebsd-update is nothing more than downloading the new files from the server and copy to your computer. It does not involve compiling from the source. It should take no more than half an hour. For example, it only take around 5 minutes on my server (Intel Quad Core Q6700 + 4GB ram).

      Are you upgrading to FreeBSD 9 from 8 or earlier version? If it is not hard to reinstall the apps, it may be a good idea to install everything from scratch (Using FreeBSD 9 instead of 9.1 DVD). FreeBSD 9 has introduction some fundamental changes, such as single partition (/) instead of multiple partitions (/tmp, /usr, /var, / etc). I found that the system is more stable.

      Good luck!

  2. Mr_Smith

    Thank Derrick for the reply. I’m upgrading from 8.2 to 9.1.
    The /usr/sbin/freebsd-update install is still running.

    It’s been 7 hours and it’s still not completed.

    It isn’t just about downloading files from
    It’s about rebuilding the ports. Resolving conflicts. Etc., etc.

    This is what I am seeing on my screen now. It just keeps going on and on.

    “checking for Mac OS KeyChain Services… no
    checking whether APR has support for DSOs… yes
    checking for D-Bus .pc file… no
    checking whether to support GPG-Agent… yes
    checking whether to look for GNOME Keyring… no
    checking for msgfmt… /usr/local/bin/msgfmt
    checking for msgmerge… /usr/local/bin/msgmerge
    checking for xgettext… /usr/local/bin/xgettext
    checking for library containing bindtextdomain… -lintl
    checking for bind_textdomain_codeset… yes
    checking if we are using GNU gettext… yes
    checking magic.h usability… yes
    checking magic.h presence… yes
    checking for magic.h… yes
    checking for magic_open in -lmagic… yes
    checking whether to look for KWallet… no
    checking for ANSI C header files… (cached) yes
    checking for an ANSI C-conforming const… yes
    checking for size_t… (cached) yes
    checking for working memcmp… yes
    checking for vprintf… yes
    checking for _doprnt… no
    checking for symlink… (cached) yes
    checking for readlink… (cached) yes
    checking sys/utsname.h usability… yes
    checking sys/utsname.h presence… yes
    checking for sys/utsname.h… yes
    checking for uname… yes
    checking termios.h usability… yes
    checking termios.h presence… yes
    checking for termios.h… yes
    checking for tcgetattr… yes


Leave a Reply

Your email address will not be published. Required fields are marked *