Upgrading FreeBSD via freebsd-update

I've been building FreeBSD from source for a number of years. I've had to abandon this practice, as the clean upgrade of 13.0 to 13.1-RC1 took 32 hours. I didn't think that the machine's CPU was too slow (Intel Core 2 Duo E7500 (2 x 2.93GHz)), but I was clearly wrong.

So, freebsd-update will be used for upgrades. freebsd-update is well documented in the handbook, so I'll just note the key steps as a reminder.

  # freebsd-update -r 13.1-RC1 upgrade
  # freebsd-update install # installs new kernel
  # shutdown -r now # boot into single user mode?
  # freebsd-update install # this will also update /etc files

For a major upgrade, the packages need to be updated to cater for ABI changes.

  # pkg-static update -f
  # freebsd-update install

The freebsd-update process stores a lot of files in /var/db/freebsd-update/files (about 2G on opal after upgrade to 13.1-RC2). According to the web, these can safely deleted once an upgrade is completed and rollback is not required. Use (as root):

  # find /var/db/freebsd-update/files -type f -mtime +10d | xargs rm

I guess one can nuke the entire /var/db/freebsd-update directory prior to an upgrade instead.

Note that freebsd-update also backs-up to a maximum of 9 old kernel directories in /boot (kernel.old, kernel.old1, kernel.old2 etc). The latest is the highest numbered. One should check available free space in / before running freebsd-update; if necessary, delete everything but the latest, renaming it to kernel.old.

Sendmail with AUTH

One reason I had been sticking with a source update was that base sendmail needed to be rebuilt to offer authentication. Turns out the packaged version of sendmail includes authentication, so now I've installed that.

To use the packaged version of sendmail the following changes must be made (as described in the package install README):

  1. Don't change <host>.submit.mc (e.g. crimson.submit.mc) - it is not necessary
  2. Add this line to /etc/make.conf
          SENDMAIL_CF_DIR=/usr/local/share/sendmail/cf
        
  3. Add these lines to the <host>.mc file (e.g. crimson.mc) before any mailer or feature definition:
          define(`confEBINDIR', `/usr/local/libexec')dnl
          define(`UUCP_MAILER_PATH', `/usr/local/bin/uux')dnl
        
  4. Install the changes:
          # cd /etc/mail
          # make && make install
        
  5. To activate package sendmail as the default mailer, execute:
          # cd /usr/local/etc/mail && cp mailer.conf.sendmail mailer.conf
        

Stop and restart sendmail. The packaged version should now be running.