Published : 2013-01-01

Migrate from 7 or 8 to 9.0

FreeBSD 9 brings its share of new features. It improves performance, general stability, and security, and adds new drivers. In some cases, updating the system can introduce incompatibilities in services that depend on removed or renamed libraries. Do not forget to update and rebuild your ports to keep the system consistent.

Here is the full changelog (original version):

  • A new cpuset(2) API has been added for thread to CPU binding and CPU resource grouping and assignment. The cpuset(1) userland utility has been added to allow manipulation of processor sets.
  • The ddb(4) kernel debugger now has an output capture facility. Input and output from ddb(4) can now be captured to a memory buffer for later inspection using sysctl(8) or a textdump. The new capture command controls this feature. [MERGED]
  • The ddb(4) debugger now supports a simple scripting facility, which supports a set of named scripts consisting of a set of ddb(4) commands. These commands can be managed from within ddb(4) or with the use of the new ddb(8) utility. More details can be found in the ddb(4) manual page. [MERGED]
  • The kernel now supports a new textdump format of kernel dumps. A textdump provides higher-level information via mechanically generated/extracted debugging output, rather than a simple memory dump. This facility can be used to generate brief kernel bug reports that are rich in debugging information, but are not dependent on kernel symbol tables or precisely synchronized source code. More information can be found in the textdump(4) manual page. [MERGED]
  • Kernel support for M:N threading has been removed. While the KSE (Kernel Scheduled Entities) project was quite successful in bringing threading to FreeBSD, the M:N approach taken by the KSE library was never developed to its full potential. Backwards compatibility for applications using KSE threading will be provided via libmap.conf(5) for dynamically linked binaries. The FreeBSD Project greatly appreciates the work of Julian Elischer <[julian@FreeBSD.org](mailto:julian@FreeBSD.org)>, Daniel Eischen <[deischen@FreeBSD.org](mailto:deischen@FreeBSD.org)>, and David Xu <[davidxu@FreeBSD.org](mailto:davidxu@FreeBSD.org)> on KSE support.
  • The FreeBSD kernel now exports information about certain kernel features via the kern.features sysctl tree. The feature_present(3) library call provides a convenient interface for user applications to test the presence of features.
  • [amd64] The FreeBSD kernel now has support for large memory page mappings (“superpages”).
  • [amd64, i386, ia64, powerpc] The ULE scheduler is now the default process scheduler in GENERIC kernels. [MERGED]

Boot Loader Changes

  • [amd64, i386] The BTX kernel used by the boot loader has been changed to invoke BIOS routines from real mode. This change makes it possible to boot FreeBSD from USB devices. [MERGED]
  • [amd64, i386] A new gptboot boot loader has been added to support booting from a GPT labeled disk. A new boot command has been added to gpt(8), which makes a GPT disk bootable by writing the required bits of the boot loader, creating a new boot partition if required.

Hardware Support

  • The cmx(4) driver, a driver for Omnikey CardMan 4040 PCMCIA smartcard readers, has been added. [MERGED]
  • The syscons(4) driver now supports Colemak keyboard layout.
  • The uslcom(4) driver, a driver for Silicon Laboratories CP2101/CP2102-based USB serial adapters, has been imported from OpenBSD. [MERGED]

Network Interfaces

  • The ale(4) driver has been added to provide support for Atheros AR8121/AR8113/AR8114 Gigabit/Fast Ethernet controllers.
  • The em(4) driver has been split into two drivers with some common parts. The em(4) driver will continue to support adapters up to the 82575, as well as new client/desktop adapters. A new igb(4) driver will support new server adapters.
  • The jme(4) driver has been added to provide support for PCIe network adapters based on JMicron JMC250 Gigabit Ethernet and JMC260 Fast Ethernet controllers.
  • The malo(4) driver has been added to provide support for Marvell Libertas 88W8335 based PCI network adapters.
  • The firmware for the mxge(4) driver has been updated from 1.4.25 to 1.4.29.
  • The sf(4) driver has been overhauled to improve its performance and to add support for checksum offloading. It should also work on all architectures.
  • The re(4) driver has been overhauled to fix a number of issues. This driver now has Wake On LAN (WOL) support.
  • The vr(4) driver has been overhauled to fix a number of outstanding issues. It also now works on all architectures.
  • [amd64, i386] The wpi(4) driver has been updated to include a number of stability fixes.

Network Protocols

  • The bpf(4) packet filter and capture facility now supports a zero-copy mode of operation, in which buffers are loaned from a user process to the kernel. This feature can be enabled by setting the net.bpf.zerocopy_enable sysctl variable to 1.
  • ISDN4BSD(I4B), netatm, and all related subsystems have been removed due to lack of multi-processor support.
  • A bug in TCP options padding, where the wrong padding bytes were used, has been fixed.

Disks and Storage

  • The aac(4) driver now supports volumes larger than 2TB in size.
  • The ata(4) driver now supports a spindown command for disks; after a configurable amount of time, if no requests have been received for a disk, the disk will be spun down until the next request. The atacontrol(8) utility now supports a spindown command to configure this feature.
  • The hptrr(4) driver has been updated to version 1.2 from Highpoint.

Filesystems

  • A problem with using mmap(2) on ZFS filesystems has been fixed.
  • A new kernel-mode NFS lock manager has been added, improving performance and behavior of NFS locking. A new clear_locks(8) command has been added to clear locks held on behalf of an NFS client.
  • The ZFS file system has been upgraded to version 28. Changes include Data Deduplication, Triple parity RAIDZ, and zfs diff.

Userland Changes

  • The adduser(8) utility now supports a -M option to set the mode of a new user’s home directory. [MERGED]
  • BSD-licensed versions of ar(1) and ranlib(1), based on libarchive, have replaced the GNU Binutils versions of these utilities.
  • BSD-licensed versions of bc(1) and dc(1) have replaced their GNU counterparts.
  • chflags(1) now supports a -v flag for verbose output and a -f flag to ignore errors with the same semantics as (for example) chmod(1). [MERGED]
  • For compatibility with other implementations, cp(1) now supports a -a flag, which is equivalent to specifying the -RrP flags.
  • BSD-licensed version of cpio(1) based on libarchive, has replaced the GNU cpio. Note that the GNU cpio is still installed as gcpio.
  • The env(1) program now supports -u _name_ which will completely unset the given variable name by removing it from the environment, instead of just setting it to a null value.
  • The fdopendir(3) library function has been added.
  • The fetch(3) library now support HTTP 1.1 If-Modified-Since behavior. The fetch(1) program now supports -i _filename_ which will only download the specified HTTP URL if the content is newer than filename. [MERGED]
  • find(1) has been enhanced by the addition of a number of primaries that were present in GNU find but not FreeBSD find(1).
  • kgdb(1) now supports a new add-kld command to make it easier to debug crash dumps with kernel modules.
  • The ls(1) program now supports a -D option to specify a date format string to be used with the long format (-l) output.
  • nc(1) now supports a -O switch to disable the use of TCP options.
  • nc(1)’s -o switch has been deprecated. It will be removed in a future release.
  • The ping6(8) utility now returns 2 when the packet transmission was successful but no responses were received (this is the same behavior as ping(8)). It returned a non-zero value before this change.
  • The procstat(1) utility has been added to display detailed information about processes.
  • The realpath(1) utility now supports a -q flag to suppress warnings; it now also accepts multiple paths on its command line.
  • sh(1) has been fixed and gains new features, and now refuses to interpret malformed scripts. Auto-completion has also been implemented in emacs style.
  • The split(1) utility now supports the -n option to split a file into a given number of chunks.
  • The tar(1) utility supports the -Z option to enable compress(1)-style compression.
  • The tar(1) utility supports the --numeric-owner option to ignore user/group names on creation and extraction.
  • The tar(1) utility now supports the -S option to sparse-extract files.
  • The tar(1) utility supports the -s flag to substitute file names based on a regular expression.
  • The tcgetsid(3) library function has been added to return the PGID of the terminal’s user session. This is defined in the IEEE Std 1003.1-2001 (POSIX) standard.
  • top(1) supports the -P option to display per-CPU statistics.
  • zdump(8) now works correctly on 64-bit architectures.
  • traceroute(8) can now display the AS number for each hop with the -a option. A new -A option lets you pick the whois server.
  • traceroute6(8) now supports the -U option to send probe packets without an upper-layer protocol, instead of UDP packets.

System Upgrade

Preliminary Update

Before moving to FreeBSD 9.0, you need to update the current system. Changes have been made to freebsd-update that make it incompatible with 9.x.

freebsd-update fetch install

The command will inspect your system, determine how to perform the update, and notify you of any changes to make. Then reboot the machine to load the new kernel (in our case 8.2-p6).

Now you can run the migration:

freebsd-update -r 9.0-RELEASE upgrade
Looking up update.FreeBSD.org mirrors... 4 mirrors found.
Fetching metadata signature for 8.2-RELEASE from update5.FreeBSD.org... done.
Fetching metadata index... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic world/base world/dict world/doc 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/games world/info world/proflibs

Does this look reasonable (y/n)? y

The system asks whether it seems reasonable to install only the listed components. This mostly depends on the initial install you performed. Type y to validate and proceed to download.

Fetching metadata signature for 9.0-RELEASE from update3.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 8.2-RELEASE for merging... done.
Preparing to download files... done.
Fetching 8581 patches.....10...[output omitted]
Applying patches... done.
Fetching 1915 files...
Attempting to automatically merge changes in files... done.

The following changes, which occurred between FreeBSD 8.2-RELEASE and
FreeBSD 9.0-RELEASE have been merged into /etc/crontab:
--- current version
+++ new version
@@ -1,8 +1,8 @@
 # /etc/crontab - root's crontab for FreeBSD
 #
-# $FreeBSD: src/etc/crontab,v 1.33.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $
+# $FreeBSD: release/9.0.0/etc/crontab 194170 2009-06-14 06:37:19Z brian $
 #
 SHELL=/bin/sh
 PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
 #
 #minute        hour    mday    month   wday    who     command
Does this look reasonable (y/n)? y

The tool will then ask whether the changes it shows to the files are correct. In general yes, but it’s worth checking, and finally it will show you the list of files it will modify.

The following files will be removed as part of updating to 9.0-RELEASE-p0:
/boot/kernel
/boot/kernel/acpi.ko
/boot/kernel/acpi.ko.symbols
/boot/kernel/acpi_aiboost.ko
/boot/kernel/acpi_aiboost.ko.symbols
/etc/manpath.config
[output omitted]
--More--(byte 810)
The following files will be added as part of updating to 9.0-RELEASE-p0:
/boot/brand.4th
/boot/check-password.4th
/boot/color.4th
/boot/delay.4th
/boot/kernel/beastie_saver.4th
[output omitted]
--More--(byte 891)
The following files will be updated as part of updating to 9.0-RELEASE-p0:
/.cshrc
/.profile
/COPYRIGHT
/bin/[
/bin/cat
/bin/chflags
[output omitted]

Everything should be fine, so you can quit — or check the list of changes if you modified the system. Apply the upgrade:

freebsd-update -r 9.0-RELEASE install
Installing updates...rmdir: ///boot/kernel: Directory not empty

Kernel updates have been installed.  Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.

You can then reboot to load the 9.0 kernel. Now install userspace, run the command again. We can also see that the kernel is indeed 9.0-RELEASE:

# uname -a
FreeBSD SquidBSD.bc1.groupe-ppa.local 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012
    root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
# 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.

Now that userspace is up to date, it’s a good idea to reinstall the services you enabled so they match the system. Once that’s done, run freebsd-update install again to finish the upgrade.

Note: this migration was performed on a system running squid, havp, and clamd, and recompiling those services was not required.

That’s it! You now know how to migrate from FreeBSD 8.x or 7.x to 9.0. I strongly recommend upgrading, especially if you virtualize FreeBSD machines, because there are significant performance improvements that save CPU and RAM on your virtualization host.