Today, we are going to discuss a basic, initial setup for updating a freshly installed FreeBSD 6 Beta 5 system to the latest stable version available at FreeBSD.org and the latest ports for all installed packages. Now, FreeBSD is not our favorite distribution of BSD, that happens to be OpenBSD, but it is the flavor of BSD we have found functional as a desktop platform, although we tend to favor Debian GNU/Linux for this purpose.
(We often refer to the FreeBSD handbook in this post, which provides valuable basics for using FreeBSD.)
The install of FreeBSD 6 is fairly clean on most i386 desktops and laptops, although wireless support on a Dell Inspiron 8500 is, as usual, a problem. (In this case, we are using a Dell similar to the one discussed in the Debian post, except it has a different video card, a larger disk and more RAM, and actually belongs to us.) The install even goes so far as to partition the disk in a traditional FreeBSD way rather than just one lump partition as many installations do by default, although we add partitions and bump up “/var” a bit. There are pre-selected package options for different types of uses for the system (such as for developers), and we can also go in and custom select/deselect other packages. We make sure to install the full src and ports trees. That is pretty much it for install.
So, once the system is up and running, what do we do?
Well, first we get it organized easily for performing updates. This means setting up cvsup for the system (“/usr/src”) and the ports (“/usr/ports”). Information on properly using cvsup can be found here in the FreeBSD handbook.
We make sure “portaudit”, “cvsupport”, and “portupgrade” are installed. If anyone of them is not installed, we install them. More information on using packages can be found here in the FreeBSD handbook.
- pkg_add -r portaudit
- pkg_add -r cvsup
- pkg_add -r portupgrade
We install the full source tree and ports during the installation of the system, but if they are not there, we can perform the following, if the installation FreeBSD CDs are available. Additionally, we can just pull the files down using cvsup.
- sysinstall
- Select Configure
- Select Distributions
- Select src (this results in a selection menu for sources to be installed)
- Under the src selection menu, Select All (you can, of course, whiddle this down)
- Select ports
- Select OK until these things get installed and then exit sysinstall
After this, we copy sample sup files from “/usr/share/doc/cvsup/” to “/usr”.
- cp /usr/share/examples/cvsup/stable-supfile /usr/share/examples/cvsup/ports-supfile /usr/
The example configuration files are fine for our purpose, except for a couple of tweaks.
- In “/usr/stable-supfile”, we change “*default release=cvs tag=RELENG_5″ to “*default release=cvs tag=RELENG_6″ since we were running FreeBSD 6 branch. A list of releases can be found here in the FreeBSD handbook.
- In both “/usr/stable-supfile” and “/usr/ports-supfile”, we change “*default host=CHANGE_THIS.FreeBSD.org” to be one of the mirror servers. A list of mirrors can be found here in the FreeBSD handbook.
Next, we synchronize our source trees with those on a FreeBSD mirror. We are not currently running X windows, although it is installed, and we want to see the most verbose output of what is happening during the update, so we run cvsup with “-g” and “-L 2″.
- cd /usr/src
- cvsup -g -L 2 ../stable-supfile
- cd ../ports
- cvsup -g -L 2 ../ports-supfile
Ok, now that our source tree is synchronized, we are ready to rebuild the kernel and the system binaries, and then our packages.
We start with building a custom kernel and rebuilding the system binaries, since a bunch of these had updates during our synchronization. More information on building a custom kernel can be found here in the FreeBSD handbook.
First we switch to the directory containing the kernel’s build configuration for the i386, copy the GENERIC build configuration to /usr/DKript_Lap1, and symbolically link it in our current directory.
- cd /usr/src/sys/i386/conf
- cp ./GENERIC /usr/DKript_Lap1
- ln -s /usr/DKript_Lap1 ./DKript_Lap1
We then proceed to edit the configuration file using vi. A great resource for what the configuration options mean can be found here in the FreeBSD handbook.
- vi DKript_Lap1
We comment out the “cpu” entries for “I486_CPU” and “i586_CPU”. We change “ident” to “DKript_Lap1″. There are no DOS partitions that take place in our boot, so we comment out “MSDOS_FS”. We are not going to be using Tape drives nor RAID arrays with the laptop, so we comment out “atapist” and “ataraid”. We comment out all SCSI controllers, SCSI devices, and all RAID controllers as none of these are going to be used with the laptop, but we leave the SCSI peripherals enabled as there are cross dependencies with certain USB capabilities (i.e., the build breaks without them). We enable the pcvt console options. We enable power management support. We comment out virtually all of the NIC drivers, with the exception of the MII bus support, the Broadcom BCM440x, and the wireless cards. We comment out “sl”, as SLIP has no use for us. We also add the following entries to handle our wireless security protocols.
-
#Need to statically link into the kernel or manually configure to load
device wlan_wep
device wlan_ccmp
device wlan_tkip
Note: “dmesg | less” and “pciconf -lv” can be useful to figure out what features you need in the kernel.
With that done, we are ready to rebuild the system. This takes a long time.
- make buildworld
- make kernel KERNCONF=DKript_Lap1
- reboot
The FreeBSD 6 code base is evolving quite rapidly as it is still in beta, so we treat our build as an upgrade. We boot the system into single user mode by breaking the boot and typing -s as a boot parameter. We run “mount” to check that “/”, “/usr”, “/var”, and “/tmp” are mounted properly (read/write). Then, we run the following.
- mergemaster -p
- make installworld
- mergemaster
- reboot
When the second mergemaster runs, there are a number of diffs. We install virtually all of the updated versions of files, but we had to go through them closely to make sure they did not break our setup, which is unlikely given this is a fresh install.
The reboot is quite fast when compared to the original boot after install. Perfect.
Since we have already installed all of the ports we want during install, we just want to perform an upgrade of them. We synchronized our ports tree above, so now we just have to build and install. This takes quite a while, especially if X needs to be built. First we make sure the package database is up to date and clean, and then we update all installed packages. More information on using ports can be found here in the FreeBSD manual.
- pkgdb -F
- portupgrade -a
After this completes and all of our packages are updated to the latest version, we run the following to see if there are any known vulnerabilities in the latest versions of the ports.
- portaudit -Fa
Portaudit goes out and downloads the latest vulnerability list from FreeBSD, and then checks our installed ports against this list. If any of the latest versions of the packages we installed are identified as having known vulnerabilities, we assess the risk and potentially uninstall them or look for temporary workarounds until real patches are developed.
That’s about it for our basic update of a freshly installed FreeBSD 6 Beta 5 system.
