Table of Contents

Upgrading All FreeBSD Ports via portupgrade

portupgrade is a tool that allows you to upgrade ports on your FreeBSD system. It has its faults, and it doesn't always work (see below), but its about as close as you can get on FreeBSD to a 'one-click' upgrade.

There are other tools for doing upgrades, and several (including portupgrade are outlined in the FreeBSD handbook.

Before the Upgrade

Think about updating the base system. See the FreeBSD - Stable Upgrade page, or do a binary update.

Prepare to Upgrade

First, make sure the ports tree and index file are up-to-date. You can do this either via portsnap, or via cvsup.

CVSup Method

portsnap Method

Once the ports are up to do, you should backup the package database:

Run an audit:

Then, update the package database:

If the database is corrupted, fix it:

Look at the packages that need to be updated (note that portversion uses the ports index file, so you need to make sure you ran portsdb -Fu earlier to get the latest file):

To see the full list, do:

If you would prefer to check your ports against an actual can of the ports tree, you can use pkg_version instead of portsversion:

Doing it this way is a lot slower than using portversion

Doing the Upgrade

First, figure out if any packages need to be upgraded manually. There isn't really any good way of doing this that I've figured out, but I've made a list of packages I've had problems with below. Feel free to add to it.

Next, do the actual update. You can do this one of two ways: either do a fully automatic upgrade, or do the upgrade bit-by-bit. The latter is STRONGLY recommended, as it allows you to go slowly and test things. The fully automatic upgrade will break things, and may take a lot of time to fix.

After the Upgrade

Run portsclean -PCDL to clean up old ports, libraries, distfiles and packages.

Then, reboot and then check /var/log/messages for any errors. Also check that all expected services are working on the box.

Updating Multiple Servers

On the first server you do the upgrade on, do:

Notes on the Special Snowflakes

Some software doesn't behave well with the portupgrade process. Sometimes it's because you need to run a certain command after the upgrade and portupgrade doesn't know about it, or because you've installed the software with custom configuration options (although there are ways to mitigate that).

Other Notes

* WARNING: If you have a lot of ports installed (who doesn't?), start this process EARLY in the day, because the whole thing takes several hours to run, and there are usually a few things that have to be fixed manually at the end.

make -DDISABLE_VULNERABILITIES Of course, make sure you actually know what you're getting yourself into when you're installing a port with known vulnerabilities.