FreeBSD: Upgrade from 8.2 to 9.0

If you use this command to upgrade to latest release FreeBSD 9.0:

$ freebsd-update -r 9.0-RELEASE upgrade

You might see following error:

The update metadata is correctly signed, but
failed an integrity check.
Cowardly refusing to proceed any further.

This error indicate that it cannot accept % and @ characters which appear in FreeBSD 9 . To overcome this, run following command:

$ sed -i '' -e 's/=_/=%@_/' /usr/sbin/freebsd-update

Now start the upgrade process:

$ freebsd-update -r 9.0-RELEASE upgrade

Accept all prompted values and follow the wizard. This process downloads all files and patches required for upgrade so it takes time. You might need to press ‘Enter’ once to check /etc/hosts file. Once complete, run following command to start installing the updates:

$ freebsd-update install

After a while, you should see the system will prompt something as below:

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.

Reboot the server:

$ init 6

Once up, it will boot to FreeBSD 9. Run again the installation command:

$ freebsd-update install

After the process completed, the system will ask you to build back all your application which installed using ports. Once done, you need to rerun again the above command to complete the upgrade process and you should something like below:

$ freebsd-update install
Installing updates... Done

Your update should be completed now. To check the new version, run following command:

$ uname -r
9.0-RELEASE

Source: http://lists.freebsd.org/pipermail/freebsd-stable/2011-October/064321.html