Desktop FreeBSD: Upgrading to 6.0

By Ed Hurst | Posted at 4:03 PM
First, let me assure you the recent release of FreeBSD 6.0 is worth it for desktop users. The file system reads a little faster; the networking interface API was overhauled and supports wireless connections better. Powersaving features on some laptops are much better, as well as improved support for PCMCIA cards and touchpad configuration. However, most of the changes are "under the hood" from the desktop user's perspective, and it's all good. It is more of the same "it just works" technology we've come to expect from FreeBSD. You won't notice most of the improvements because they prevent trouble.

There are two ways for current users of FreeBSD to get there. The easiest way is to back up your current data and install from scratch. Because of the significant changes, it's no shame to go this route. Only if you are brave and have some time to fiddle with things should you try a code upgrade using buildworld. For those of you so willing, here are my recommendations.

One of the most important habits to develop is reading the UPDATING files you get with every CVSup download you do. For updating your core system code (see this tutorial for details), the first file replaced is /usr/src/UPDATING. While the jargon can be daunting to the FreeBSD novice, I encourage you to read through it more than once or twice. Sometimes things of that nature just go click after trying again. The various comments are listed in reverse chronological order, latest at the top. For example, the current file has this entry added last:

20051101:
   FreeBSD 6.0-RELEASE

The date is parsed so: year (4 digits), month (2 digits) and date (2 digits) to give us November 1st, 2005. The announcement for that date is the official release of 6.0. Here's another interesting item down a ways:

20050610:
  Major changes to network interface API. All drivers must be
  recompiled. Drivers not in the base system will need to be
  updated to the new APIs.

On June 10th this year, the FreeBSD released a change to the networking APIs. As part of the updating process, the warning tells you if you downloaded any special networking drivers from the ports system previoiusly, you need to reinstall them. The usual method is to navigate to the proper subdirectory in the ports tree where you first installed the driver, run the command make deinstall followed by make install. That should rebuild the package in question from the new code.

We've covered the system rebuild already, and only outline it here:

cd /usr/src
make buildworld
make buildkernel
make installkernel
reboot
shutdown now
cd /usr/src
make installworld
mergemaster
reboot

When the system is running again, we move on to the next step. Within the ports system itself, when you update the ports tree, you'll need to check out /usr/ports/UPDATING for warnings similar to updating the core system. The layout is about the same. Here's the item that caught my attention:

20051105:
  AFFECTS: all users of gnome/glib/gtk
  AUTHOR: gnome@FreeBSD.org

  GNOME has been updated to 2.12 and gtk/glib to 2.8.
  DO NOT USE portupgrade(1) to update your ports. Instead, use
  the gnome_upgrade.sh script from
  http://www.marcuscom.com/downloads/gnome_upgrade212.sh

Notice we have two headings: AFFECTS and AUTHOR. While the second allows you to contact the author of the note if necessary for additional information, the first should be obvious. Indeed, unless you are running on the console alone, this will apply to you, since it's almost impossible to run a desktop system without using the GTK/Glib libraries.

It's simple enough to download the script (linked here for your convenience). I chose to run it from /root, which is root's home directory. Since the script is not a command in the system, and thus not in your PATH, you'll have to let the commandline know where it is. Be sure to put the ./ ("in this directory") in front of the script command:

./gnome_upgrade212.sh < /blockquote>

You will be warned to shut down any application which uses GTK, but it's best simply to drop out of the X server completely. If you are running a graphical login at startup, then you should move to a console by hitting CTRL+ALT+F2, login as root and type in the command init 3. Then when finished, on the same console type init 5 to restart the graphical login. For those not running a graphical login, just log out of your window manager/desktop. Log out of your user account and into the root account.

When running the script, the first thing I ran into was a complaint that /var/temp was not large enough for the script to compile a log. The message was:

"ERROR: Not enough space in /var/tmp to log the upgrade. Please set the MC_TMPDIR variable to a location that has at least 200 MB of free space, then restart the upgrade."

My answer was to make a backup copy of the script, then open it in an editor and scroll down to where the variable MC_TMPDIR was defined. I changed it to /tmp like this:

MC_TMPDIR="/tmp"

and tried again. This worked fine.

The script will procede to indentify all the packages dependent on GTK and Glib. Then, after updating those two, it will rebuild everything identified. It will include all of KDE if you have that. It will also take all day on most machines. The feedback is fairly limited, but it will list each package according to its place in the ports tree, followed by its place in the list order.

Another issue I ran into was with Gnomesword. Something in the upgrade to GNOME 2.12 breaks that package, and it won't rebuild. The script was stopped at that point. I ran the script with the --help flag and got a message with clues how to bypass such things. In this case, the trick was to add the switch -k so the script would keep going after Gnomesword failed. Since I chose to heed the message and restart with the list of completed packages, mine looked like this:

./gnome_upgrade212.sh -k -restart /tmp/gnome_upgrade_lst.AS5jKY

If you get a similar message, just remember the pointer on the FreeBSD console should work perfectly, and looks just like a graphical arrowhead pointer you might find when running X. Simply highlight the portion of the message between the quotation marks (without the quotation marks), then click the middle button to paste back to the command line. You should still be able to navigate up and down the line to make necessary changes before you hit ENTER. Unlike the old DOS days, you also need not run the cursor back to the end of the command to execute. The cursor can be anywhere in the command.

If you have Gnomesword, save yourself the trouble and simply uninstall it before you start. I don't have a list of other packages similarly broken by the upgrade, so pay attention to error messages. If all else fails, you can find instructions on how to get help.

When the script is complete, it will tell you it was successful:

"Congratulations! GNOME has been successfully upgraded. Please refer to http://www.FreeBSD.org/gnome/ for a list of known issues, FAQ, and other useful resources for running GNOME on FreeBSD.

At that point, you should be ready to go. Restart X and get back to work. After all, isn't that why we run FreeBSD?

Ed Hurst is Associate Editor of Open for Business. Ed runs a computer support ministry in Oklahoma City. He loves computers, runs FreeBSD and GNU/Linux and reads all sorts of things. You can reach Ed at ehurst@ofb.biz.