Some of my servers are running a fairly old version of FreeBSD/i386. I began researching how to upgrade them from stable/8 to stable/10 via stable/9. It’s pretty straightforward, but there are some pitfalls you should avoid.

  • Make sure you have good backups of anything precious!
  • Make sure you have good backups of anything precious!
  • Make sure you have good backups of anything precious!
  • Make sure the / (root) filesystem has at least 600 MiB of space, preferably close to 1 GiB.
  • Make sure the /usr filesystem has at least 6 GiB of free space, preferably more.
  • In case the Subversion client should be unable to run for some reason, update /usr/ports before proceeding.
  • When you go from stable/8 to stable/9:
    • Make an extra copy of /etc/rc.conf before running mergemaster and make installworld.
    • Make sure the terminal type is set to xterm in /etc/ttys.
    • Compare /etc/rc.conf and /etc/rc.conf.mine, and make the necessary changes to /etc/rc.conf.
    • If you intend on using vt(9) as the console driver, disable any font and cursor related variables in /etc/rc.conf.
  • When you go from stable/9 to stable/10:
    • Make an extra copy of /etc/rc.conf before running mergemaster and make installworld.
    • Make sure the terminal type is set to xterm in /etc/ttys.
    • Compare /etc/rc.conf and /etc/rc.conf.mine, and make the necessary changes to /etc/rc.conf.
    • If you intend on using vt(9) as the console driver, disable any font and cursor related variables in /etc/rc.conf.
    • If you previously used BIND in base as your local DNS resolver, add the line local_unbound_enable="YES" to /etc/rc.conf, start the local_unbound service, and examine the contents of /etc/resolvconf.conf and /etc/resolv.conf. As an alternative, consider the use of dns/bind99 from the ports collection.
    • ifconfig(8) and friends will not work properly until the stable/10 userland is in place.
  • Make sure you have good backups of anything precious!

Upgrading to the latest stable/8

svn up /usr/src /usr/ports
cd /usr/src
rm /usr/obj/usr/src/sys/${KERNEL}/vers*
rm /usr/obj/usr/src/sys/boot/i386/loader/vers.?
make -D NO_CLEAN buildworld buildkernel
make installkernel
mergemaster -p
mergemaster -Fi
shutdown -r now Upgrading to base/stable/8 rXXXXXX.
# reboot into singleuser mode
swapon -a
fsck -p
mount -u /
mount -al
/etc/netstart
/etc/rc.d/syscons start
csh # or some other preferred shell
cd /usr/src
make installworld
reboot # into multiuser mode

Upgrading to the latest stable/9

cd /usr
mv src src-8
svn co svn://some.svn.mirror/base/stable/9 src
# migrate any kernel configuration files
rm -Rf /usr/obj/*
cd /usr/src
make buildworld buildkernel
make installkernel
# make an extra copy of /etc/rc.conf
cp -p /etc/rc.conf /etc/rc.conf.mine
mergemaster -p
mergemaster -Fi
# make sure the terminal type is set to xterm in /etc/ttys
# compare /etc/rc.conf and /etc/rc.conf.mine, and make the necessary changes to /etc/rc.conf
# if you intend on using vt(9) as the console driver, disable any font and cursor related variables in /etc/rc.conf
shutdown -r now Upgrading to base/stable/9 rXXXXXY.
# reboot into singleuser mode
swapon -a
fsck -p
mount -u /
mount -al
/etc/netstart
/etc/rc.d/syscons start
csh # or some other preferred shell
cd /usr/src
make installworld
# compare /etc/rc.conf and /etc/rc.conf.mine, and make the necessary changes to /etc/rc.conf
reboot # into multiuser mode

Upgrading to the latest stable/10

cd /usr
mv src src-9
svn co svn://some.svn.mirror/base/stable/10 src
# migrate any kernel configuration files
rm -Rf /usr/obj/*
cd /usr/src
make buildworld buildkernel
make installkernel
# make an extra copy of /etc/rc.conf
cp -p /etc/rc.conf /etc/rc.conf.mine
mergemaster -p
mergemaster -Fi
# compare /etc/rc.conf and /etc/rc.conf.mine, and make the necessary changes to /etc/rc.conf
# make sure the terminal type is set to xterm in /etc/ttys
# if you intend on using vt(9) as the console driver, disable any font and cursor related variables in /etc/rc.conf
shutdown -r now Upgrading to base/stable/10 rXXXXXZ.
# reboot into singleuser mode
swapon -a
fsck -p
mount -u /
mount -al
/etc/netstart
# ifconfig(8) and friends will not work properly until the stable/10 userland is in place
/etc/rc.d/syscons start
csh # or some other preferred shell
cd /usr/src
make installworld
# compare /etc/rc.conf and /etc/rc.conf.mine, and make the necessary changes to /etc/rc.conf
reboot # into multiuser mode

Finishing touches

  • Upgrade all installed ports.
  • Run make -C /usr/src delete-old
  • Run make -C /usr/src delete-old-libs
  • Remove the old source trees
    • rm -Rf /usr/src-8
    • rm -Rf /usr/src-9