Upgrading FreeBSD 7.2 to 8.0 using freebsd-update
Written by jlgaddis on December 6, 2009 – 12:57 am -A month or so ago, I decided to replace my trusty, reliable but aging Sun Netra T1 (500 MHz, 1GB, 2×18.2GB RAID1) box running Debian 5.0.3 (Sparc) at home. The box doesn’t really do a whole lot, but does provide the following services:
- DNS (via ISC’s BIND) for the home network,
- Web server (Apache) for a few “internal-only” webapps (cacti, etc.),
- Asterisk (for VoIP services) — configured but hardly used,
- TFTP server for storing my IOS images,
- AAA (via FreeRADIUS) for my home router and switch,
- syslog (via syslog-ng) for my home servers and network devices,
- MySQL for the few webapps that require it,
- “smarthost” (via postfix) for SMTP for the other home servers, and
- running irssi to chat on IRC (Freenode and a private network)
Interesting… I actually forgot it was doing so much until I just reviewed dpkg -l to see what all was installed. =)
There’s a lot running on that box, but since it’s just on my home network it’s not like resource utilization is high or anything. I’m nowhere near taxing the 500 MHz CPU and 1GB of RAM that it has. I was introduced to Linux (Slackware, ugh!) circa 1996 and Debian shortly thereafter. Once I switched to Debian, I rarely run anything else as far as Linux is concerned. The exception is at ${work}, where most of the production Linux boxes I’m responsible for run Red Hat Enterprise Linux. Years ago, I “tried” FreeBSD (4.2, I believe) and fell in love with it. It’s a rock-solid platform and extremely reliable. The amount of work involved in maintaining it (at the time) was a bit of a turn-off, however, especially for someone used to only having to run the occasional apt-get update && apt-get upgrade to ensure his boxes were up-to-date. My home servers are typically old, as I have no need for a powerful (and more expensive) box at home and rebuilding the world on an old server can be an exercise in patience (which I am already short of)!
My two top choices (for a non-Windows server) have long been Debian and FreeBSD, in that order. Anyone who has followed Debian over the years is surely aware of the politics involved in the project and it eventually became too much for me for stand. So when I recently decided to replace the Sun Netra T1 with a (still old, but not quite as much) IBM xSeries x330 server that I had sitting around unused. This box still isn’t a powerhouse, though it is much more powerful than the Netra. I actually have two of the x330’s, both with 2×1.13GHz processors and 2×36GB SCSI HDDs. Both originally (I picked ‘em up on eBay for $40/each) came with 2GB of RAM, but I swapped it around a bit — one has 3GB, the other 1GB. The 3GB one is what I’m running FreeBSD on.
Anyway, a month or so ago when I decided to replace the Netra (I actually have three of them, with various specs) I decided to go back to my old love, FreeBSD. Installing 7.2 was a breeze and I was up and running in no time. While I’ve still yet to get all of the services that the Netra (“bart”) is providing up and running on the x330 (“homer”), I’m probably halfway there. I hope to get the rest of the services moved over in the next week or so or, worst case, over my two weeks of vacation around Christmas. Fast forward to today, when I’m checking up on Facebook and noticed a friend (who manages several FreeBSD boxes at a local ISP) had posted a status update mentioning that he was “upgrading his workstation from FreeBSD 7.2 to FreeBSD 8.” I thought, “FreeBSD 8!?” and headed over to freebsd.org to verify. Somehow, I missed the 8.0-RELEASE announcement (and accompanying press release). Since I wasn’t really doing anything else, I decided to go ahead and upgrade to 8.0-RELEASE.
A utility called freebsd-update was released a while ago (around 6.2, I think — not exactly sure) that made it possible to do binary diff upgrades as opposed to upgrading via sources. Since I’ve always ran FreeBSD on older hardware and, as I mentioned, upgrading can take a long time (to put it mildly), this was great news to me. I’d still prefer to do upgrades via source, but I haven’t done it for years and remember clearly how long it took, so freebsd-update seemed to be a nice easy way to upgrade. It worked out quite well, and saved me many hours of downloading and compiling source code. Downloading doesn’t take very long anymore, but it sure did back when my first FreeBSD boxes were connected over dial-up.
I took the time to record the commands that I used (and the associated) to update my 7.2-RELEASE system to 8.0-RELEASE and the (now) out-of-date ports that I have installed. Like most things I post here, it’s primarily for my own benefit and future reference, but I decided to go ahead and post the details in the event it might be useful to others.
NOTE: The following steps could, potentially, completely and irreversible hose your system. Always make sure to completely back up your system and all data before performing any major upgrades such as these. In addition, I did my upgrade over a serial console (this is a headless box) instead of through an SSH session. Your mileage may vary, offer void where prohibited.
My FreeBSD box, homer, is running 7.2 i386:
[root@homer ~]# uname -rm 7.2-RELEASE-p4 i386
The “tag” for the version that I want to upgrade to is “8.0-RELEASE”. Invoke freebsd-update with the -r option, specifying the tag and the command “upgrade”. freebsd-update will immediately begin doing its job:
[root@homer ~]# freebsd-update -r 8.0-RELEASE upgrade Looking up update.FreeBSD.org mirrors... 3 mirrors found. Fetching metadata signature for 7.2-RELEASE from update5.FreeBSD.org... done. Fetching metadata index... done. Fetching 1 metadata files... done. Inspecting system... done. The following components of FreeBSD seem to be installed: kernel/generic world/base world/dict world/doc world/games world/info 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/proflibs Does this look reasonable (y/n)? y Fetching metadata signature for 8.0-RELEASE from update5.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 7.2-RELEASE for merging... done. Preparing to download files... done. Fetching 9311 patches.....10....20....30....40....50....60....70....80.... [snip] ....9240....9250....9260....9270....9280....9290....9300....9310 done. Applying patches... done. Fetching 771 files... done. Attempting to automatically merge changes in files... done.
At this point, I was prompted to manually edit and merge changes to my (BIND) named.conf file, due to the extensive changes I had made to the default version. No biggie, a few minutes later and I had it the way I wanted. I was asked to “approve” changes to a number of other files, all of which were simply changes to the header lines, the ones that identify the filename, version, date, time, and author, such as this one (what’re these called anyways?):
# $FreeBSD: src/etc/master.passwd,v 1.40.22.1.2.1 2009/10/25 01:10:29 kensmith Exp $
freebsd-update then continued on with its business, letting me know what it was doing each step of the way:
The following files will be removed as part of updating to 8.0-RELEASE-p1: [snip] The following files will be added as part of updating to 8.0-RELEASE-p1: [snip] The following files will be updated as part of updating to 8.0-RELEASE-p1: [snip]
After the freebsd-update upgrade run was done, I was returned to the shell. The next step is to tell freebsd-update to actually install all the files that were updated (they are kept separate from the real files until this is done):
[root@homer ~]# freebsd-update install Installing updates... Kernel updates have been installed. Please reboot and run "/usr/sbin/freebsd-update install" again to finish installing updates.
Do what it says and give your machine a good ol’ reboot.
[root@homer ~]# reboot
When the machine boots back up, log back in and invoke the last command again, like you were told:
[root@homer ~]# 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.
At this point, I went ahead and rebooted my server again, just for good measure. It may not be required, but I figured it couldn’t hurt.
[root@homer ~]# reboot
Checking the output of uname again, we can see that the system has been successfully upgraded to 8.0-RELEASE.
[root@homer ~]# uname -rm 8.0-RELEASE i386
Now, we can upgrade our installed software (“Please rebuild all installed 3rd party software …”). I don’t have a lot of software installed at this point (it is a relatively new installation), but I have installed a handful of ports. There are a number of tools that can be used to upgrade them, but I prefer portupgrade. Supplying the “-a” option tells portupgrade to “do with all the installed packages” (in other words, upgrade them all). Let’s fetch and extract the latest copy of the ports collection, then run portupgrade.
[root@homer ~]# portsnap fetch extract Looking up portsnap.FreeBSD.org mirrors... 2 mirrors found. Fetching snapshot tag from portsnap1.FreeBSD.org... done. Fetching snapshot metadata... done. Updating from Thu Dec 3 18:36:48 EST 2009 to Sat Dec 5 16:53:42 EST 2009. Fetching 4 metadata patches... done. Applying metadata patches... done. Fetching 0 metadata files... done. Fetching 104 patches.....10....20....30....40....50....60....70....80....90....100.. done. Applying patches... done. Fetching 4 new ports or files... done. [snip] Building new INDEX files... done. [root@homer ~]# portupgrade -a
When that finishes, which may take anywhere from a few minutes to several hours, depending on the speed of your network connection and (more importantly) your CPUs, you’re system should pretty much be up to date.
Now that we’re all done, we need to run freebsd-update install one more time to finish up. I followed it up with a reboot, but, again, I’m not sure if it was necessary.
[root@homer ~]# freebsd-update install Installing updates... done. [root@homer ~]# reboot
Enjoy!
Tags: networking, open-source, software | No Comments »



