Skip to main content

Upgrade From 12.1- to 12.2-RELEASE

Did we get a choice to include /usr/src when setting up this droplet?  I don't remember, but I don't think so.  Well, let's just ignore that for the moment and proceed with the upgrade process.

Pro Tips

  1. Before proceeding - even though nothing will go wrong, right? - stop the droplet and take a snapshot.
  2. You did the snapshot?  Maybe you want to "resize" while you're at it.  With 1 CPU and 2gb of RAM, this'll be slow!
  3. If you're working with a $5/mo droplet, plan on this taking 1-2 hours... or more.
  4. Consider tmux or similar.

Such Quick!  Very Upgrade!

freebsd-update fetch
freebsd-update install
freebsd-update upgrade -r 12.2-RELEASE

Not so fast!

This is a DO droplet.  Maybe your droplet has FreeBSD source on it, but mine doesn't.  Let's get it.

fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.1-RELEASE/src.txz

And then we must extract it (feel free to pipe stdout to /dev/null or something).

tar -xzvf src.txz -C /

Start over!

freebsd-update fetch
freebsd-update install
freebsd-update upgrade -r 12.2-RELEASE
freebsd-update install

Success!  Reboot!

shutdown -r now

Not done!  Upgrade userland!

freebsd-update install
shutdown -r now

Done!

But are you, really?

A tale of hurried-ness.

I started the process at 11pm.  I went to bed a bit after midnight, and I let it just do its thing.  When I woke up, I was presented with a few questions, and I skipped through them too quickly.  One of them was to the effect of "there are changes to /etc/ssh/sshd_config that cannot be automatically merged. Please edit it vi."

I stared at the message for a few seconds, thought about how I needed to walk and feed the dog, and decided I would deal with it later.  I just saved it with the diffs (you know, >>>>>>>>>>>>> and <<<<<<<<<<<<) still in it. I answered 'yes' to the remaining questions of "does this look right?" and it proceeded to finish the system upgrade.

I then handled my dog duties and came back to finish up.  I rebooted, and then upgraded userland.  I had forgotten all about the sshd_config deal. Well, after the second reboot (first one after kernel/system, and second one after userland), I was rejected at port 22.  Ah - no big deal -  I'll just access the console using the DO web interface.  Just need to enter username and password.  Wait.  I didn't set up a user, and I didn't set up a root password.  So that won't work!

I couldn't figure out how to proceed, so I popped into #freebsd on Freenode, and they were like "can't you boot into single user mode?"  Hm.  Let's see.

You can boot into single user mode one of two ways.  First, you can just tell the system to do that on next boot with nextboot -o "-s" -k kernel, but I had no shell.  The other way is to power cycle the system from the DO web interface, and then open up the console and choose option '2' to boot into single user mode.

Perfect, I have no idea what I need to fix, but at least I'm in.  Let's check .ssh/authorized_keys.  Yeah, looks fine.  Hmm.  Wait a minute.  Yes, I remember now.  I didn't bother to do anything about the sshd_config diffs that I was bugged about first thing in the morning.  Wow, I'm lucky I remembered.  Okay, so I'll just open up vi and at least comment out the offending rows. 

Uh, no, I won't.  It's mounted as read-only.  But wait, yes I can.  I just need to mount it as read-write.  I mounted the root file system like so: mount -u -o rw /, but others later said mount -u / is enough (see reference).  Anyhoo, I was then able to fix up sshd_config and service sshd restart which worked great.  Of course, I was in single user mode, so I had to reboot.  A minute later and I was able to ssh into the server again.  Sweet.  Finally done.

Still Not Done!

Well, maybe it is done.  But now is a good time to review the changes.  Also, do you have any jails?  I do, and they have not been upgraded.  If you use a jail manager to create and manage your jails, you should also use it to upgrade them.  In the Bastille docs (below, in References), they mention how to upgrade individual jails or simply every jail at once by upgrading the release.

References

Release notes: https://www.freebsd.org/releases/12.2R/relnotes.html#upgrade

Updates per the handbook: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-freebsdupdate.html

Info reworded from a... Linux... website: https://www.fosslinux.com/44135/freebsd-12-2-review-what-you-need-to-know-and-how-to-upgrade.htm

Downloading source: https://www.jan0sch.de/post/install-freebsd-sources/

Change mount in place: https://unix.stackexchange.com/questions/65523/unable-to-write-to-file-on-freebsd-read-only-filesystem

BastilleBSD jail upgrades: https://github.com/BastilleBSD/bastille