FreeBSD logo

FreeBSD: Upgrading Ports

[2010/11]

IMPORTANT: ARCHIVE BEFORE UPGRADING PORTS!
DISCLAIMER: AUTHOR WILL NOT BE HELD RESPONSIBLE FOR A BROKEN SYSTEM NOR LOST DATA!

I strongly suggest to NOT upgrade ports unless absolutely necessary.
If FreeBSD works, leave it alone.

I've had trouble with other ways of upgrading ports.
Trying to compile new ports with a mess of old ports has often failed.

The way I upgrade ports is to start from scratch.

  1. A pristine archive of /usr/local and /var/db/pkg is required.
  2. Record what packages were installed:
    pkg_info > /installed_packages
  3. Archive BOTH /usr/local -AND- /var/db/pkg
    The installed ports and the ports database are bound together.
    tar cfjv /local/bak/usr_local_var_db_pkg.tar.bz2 usr/local var/db/pkg
  4. Also archive other critical system dirs:
    tar cfjv /local/bak/boot.tar.bz2 boot
    tar cfjv /local/bak/etc.tar.bz2 etc
    tar cfjv /local/bak/usr_ports.tar.bz2 usr/ports
    ...
  5. Remove the old /usr/ports and untar the new ports.tar.gz from freebsd.org.
  6. First trying fetching all the ports you plan to install:
    make fetch
  7. Stop X Windows, login to a text-mode console.
  8. Restore the pristine /usr/local and /var/db/pkg

    The reason is that building new ports with old ports installed
    might cause build problems, but building from a pristine system works better
    (apparently the FreeBSD developers test compiling ports on a pristine system).
  9. Build the new ports.
    There's a possibility a port will fail to compile.
    SO YOU BETTER HAVE AN ARCHIVE OF THE OLD PORTS!

index   home