Updating Installed Packages

Packages run reliably only on the version of OpenBSD for which they’re compiled. If you’re using packages, then updating your third-party software is very easy. (If you build your own software from the ports collection, you can still update but it won’t be as easy.)

First, check the Upgrade Guide again. It describes any intrusive changes to major software. Take any actions it recommends before continuing.

Updating the Package Repository

Before upgrading your packages, check your $PKG_PATH environment variable. It almost certainly references the package directory for your previous version of OpenBSD.

# echo $PKG_PATH
ftp://ftp11.usa.openbsd.org/pub/OpenBSD/5.2/packages/i386/

Find the package repository for your new version of OpenBSD. You can probably just update the release number in your shell’s dotfile, but go to the mirror site and make sure that the packages for that release are present.

If you upgrade from release to release, you can use the uname(1) command to set your PKG_PATH in your dotfile. For example, if ftp11.usa.openbsd.org is your favorite mirror site, use a line like this for sh-based dotfiles.

export PKG_PATH=ftp://ftp11.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`uname -m'/

Using the Upgrade Command

To upgrade your installed packages, use pkg_add with the -i and -u flags.

# pkg_add -iu
quirks-1.73->1.77: ok
apr-1.4.6->1.4.6p0: ok
apr-util-1.4.1-ldap:cyrus-sasl-2.1.25p3->2.1.25p3: ok
apr-util-1.4.1-ldap:openldap-client-2.4.31->2.4.31: ok
apr-util-1.4.1-ldap:libiconv-1.14->1.14: ok
…

The -i flag tells pkg_add to work in interactive mode and ask you about any ambiguities. The -u flag means “update.”

This upgrader recurses through each of your add-on software packages and its dependencies, uninstalling the old version and installing the new. If you want to see more verbose and detailed messages about the package-updating process, add the -v flag.

Package Options

If the dependencies for a package have changed and you now have multiple options, pkg_add presents your choices.

Ambiguous: choose dependency for foomatic-db-engine-4.0.8p2:
 a       0: curl-7.26.0
         1: wget-1.13.4
Your choice: 1

The package foomatic-db-engine can use either curl or wget. Of the two, I prefer wget, so I enter 1. Pressing ENTER tells pkg_add to use the default.

Package Messages

Once all of the packages have been updated, pkg_add displays any messages from the upgraded packages.

Read shared items: ok
You may wish to update your font path for /usr/local/share/ghostscript/fonts
Look in /usr/local/share/doc/pkg-readmes for extra documentation.
…

Some of the installation instructions will tell you to clear out cached files from the older version of the software, as in this CUPS example.

--- -cups-1.5.3p4 -------------------
You should also run rm -rf /var/log/cups/*
You should also run rm -rf /var/cache/cups
You should also run rm -rf /var/spool/cups
…

Other times, software might jump versions. For example, OpenBSD lets you install multiple versions of PHP, Python, and other scripting languages, but after upgrading, you must decide which is your preferred default.

--- +python-2.7.3p1 -------------------
If you want to use this package as your default system python, as root
create symbolic links like so (overwriting any previous default):
 ln -sf /usr/local/bin/python2.7 /usr/local/bin/python
 ln -sf /usr/local/bin/python2.7-2to3 /usr/local/bin/2to3
 ln -sf /usr/local/bin/python2.7-config /usr/local/bin/python-config
 ln -sf /usr/local/bin/pydoc2.7  /usr/local/bin/pydoc
…

You may also need to change some system configuration after an upgrade.

--- +tk-8.5.12 -------------------
You may wish to add /usr/local/lib/tcl/tk8.5/man to /etc/man.conf
…

The package maintainers put these messages into the package for your benefit. Read them, and if you’re in doubt, follow their instructions.

If all of your software is installed via packages, the upgrade process should be painless and transparent. I would like to tell you about all the problems and edge cases, except I’ve never been able to trigger any. Upgrading packages from the official release media just works. Packages built from the ports tree, however, are more complicated to upgrade, as I discuss in Upgrading Ports.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.188.238