Tuesday September 07 , 2010
Text Size
   



Updating to -STABLE

How to update from -RELEASE to -STABLE

Updated 1/11/09: Tested and working on FreeBSD 8.0

Updated 3/12/08: Tested and working on FreeBSD 7.0

Copied with permission by the author

Updating to -STABLE

Original page by Jochem Kossen

Abstract: After a FreeBSD -RELEASE has been released, development continues to the next version. Development is done in a number of branches, like -STABLE and -CURRENT. In this article I'll explain how to track the -STABLE branch.-STABLE is the branch which will bring the next stable release. -CURRENT is the unstable development branch. -CURRENT is only meant for developers!

Note: -STABLE is a BRANCH. That means it is being developed constantly. This also means -STABLE could be broken at any moment. Do not worry though, I've never noticed any problem with it.

Install system sources

Login to your system and then su as root before running any of following steps.

Run the following command:


# sysinstall

Choose Configure, Distributions, scroll down to src and hit the space bar. From there click down to All by hitting the space bar on it, then Tab down to OK and hit enter and follow the directions on the screen to install them. This can take anywhere from 10 Minutes to a half-hour or more depending on your Internet Connection.You can optionally install sources from the CD-ROM.

Install Screen

Screen is a nice little utility that can enable you do install one thing in the background while doing something else. Install it by doing the following:


# cd /usr/ports/sysutils/screen
# make install clean

We will want to install this as installing the cvsup port takes a while to do. Type rehash and hit Enter. typing rehash just refreshes the terminal we are in IF you're using tcsh. We are going to now add a customization to screen so we don't get the welcome window. Copy /usr/local/share/examples/screen/screenrc to your home dir. We will always want to run screen as root so run the following command:


# cp /usr/local/share/examples/screen/screenrc ~root/.screenrc
# vi ~root/.screenrc

Remove the # in front of # startup_message off so it appears as startup_message off. Change vbell on to vbell off and put in a # in front of vbell_msg " Wuff ---- Wuff!! " so it appears as #vbell_msg " Wuff ---- Wuff!! "

What this will do is tell screen not to show the startup window. Now lets give it a test to get yourself familiar with it. Type rehash and hit Enter and then type screen and hit Enter. You'll notice the screen will flash and then you will be bumped back to a prompt again. You are now in a screen session. To disconnect from screen, hold down CTRL and then hit A and then D. You can let go of the CTRL key. You will see the words [detached].

Now that screen is running in the background, we can reattach to it by typing in screen -rd and hit Enter. If you have more than one screen running and you probably will as get you get more familiar with it, Just run ps -auxw | grep screen. This command will grep (or more simply find) any screen sessions and display their PID. To connect to a screen by PID, just type screen -r PID. Pretty easy eh? I would recommend running screen in this entire step as it is quite lengthy.

Install the net/cvsup port

Run screen here by typing screen and then hit Enter

Now we will want to install cvsup without the GUI


# cd /usr/ports/net/cvsup-without-gui
# make install clean

Wait until it downloads a few things and then a box will pop-up for libiconv. Just hit tab to ok and hit enter.

Now we will want to disconnect from screen by holding down CTRL and then hit A and then D. You can let go of the CTRL key.

Installing Fastest CVSUP

Fastest CVSUP will tell us the fastest CVSUP server around. We don't want to have to wait hours and hours for a cvsup to finish. Installing it by running the following commands:


# cd /usr/ports/sysutils/fastest_cvsup
# make install clean

When the Options for fastest_cvsup comes up, just hit tab down to OK and hit Enter. Same deal for the Options for Perl screen. Installing fastest_cvsup shouldn't take anytime at all. Type rehash and hit Enter. Now type in:


# fastest_cvsup -c us

Replace us with your country if you do not happen to be in the us. It will now generate a test of all the different cvsup servers in the US and testing the ping times. When it is done, It will give a list of the top 3 fastest response times. Write down the first one as we will need it in the next step.

Updating make.conf

Open /etc/make.conf with your favorite text-editor. If /etc/make.conf doesn't exist, create it just by typing vi /etc/make.conf. Add the following lines to it:


SUP= /usr/local/bin/cvsup
SUP_UPDATE= yes
SUPHOST= CHANGETHIS.FreeBSD.org
SUPFILE= /usr/share/examples/cvsup/stable-supfile
PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile

Replace CHANGETHIS.FreeBSD.org with the cvsup host you wrote down on the previous step. You did write it down, didn't you?

Before we run the next step, We need to make sure that the previous step is done. Type screen -rd to reconnect to your screen session and wait until it is completely done before running the next step.

Adding the Refuse file (optional)

The refuse file is used so you are not necessarily updating ports you will never use. This generally saves time as it doesn't update foreign languages l and also documentation for foreign languages as well . I wouldn't add anything else to the refuse file unless you're 100% positive that you're never going to use that part of the ports tree. If you do add something to the refuse file and something you install is broken, You might just want to remove or rename the refuse file, update ports and then try to reinstall the port again. For more information, please take a look at  /usr/share/examples/cvsup/refuse.README

I am going to show you how to use the refuse file for ports here:


# mkdir /usr/sup/
# mkdir /usr/sup/ports-all
# cp /usr/share/examples/cvsup/refuse /usr/sup/ports-all

Update the sources and the ports tree


# cd /usr/src
# make update

This step will also take a while the first time you run it. You can now disconnect from screen. You've done this enough to remember the command now, right?

Please DO NOT continue until make update is completed!

Building the base system and kernel

Read /usr/src/UPDATING

UPDATING contains important information and clues needed for upgrading FreeBSD. It could be you need to add a user first, or enable a device in your kernel, or whatever. Things like this are in UPDATING, so read it:


# less /usr/src/UPDATING

Remove old obj files. The very first time you run the second or third command, don't be surprised if you see "no match"


# cd /usr/obj
# chflags -R noschg *
# rm -fr *

Update files essential for buildworld


# mergemaster -p

You will get prompted Do you wish to delete what is left of /var/tmp/temproot? [no]. Hit Enter for No. It will spit out an output. Continue on.

Build the world (This can take a REALLY long time. On a 500Mhz PC It can take over an hour-and-a-half.)

If you have a multi-core processor, or multi-processor system, you can do:

# make -jX buildworld

Replace X with the number of total processor cores your system has plus 1. So, on a single dual-core processor, you'd use -j3.


# cd /usr/src
# make buildworld

Build the kernel
(change MYKERNEL to the name of your custom kernel configuration file or GENERIC if you don't use a custom configured kernel)


# cd /usr/src
# make buildkernel KERNCONF=MYKERNEL

Installing the base system and kernel

Install your new kernel:

(change MYKERNEL to the name of your custom kernel configuration file or GENERIC if you don't use a custom configured kernel)


# cd /usr/src
# make installkernel KERNCONF=MYKERNEL

We will get more into customizing your kernel later.

Booting into single-user mode

Reboot with your new kernel into single-user mode


# reboot

When your computer reboots, It will bring you to a menu of options. Choose Single-User mode and hit Enter.
Hit [Enter] to boot immediately, or any other key for command prompt.

Booting [kernel] in 9 seconds...

Hit any other key other than [ENTER] to enter single-user mode.

It asks for the location of the shell to be used

choose /bin/sh (just press Enter or Return as this is the default)

Now we need to mount the filesystems


# mount -a -t ufs

Now to Install world


# cd /usr/src
# mergemaster -p

You will get prompted Do you wish to delete what is left of /var/tmp/temproot? [no]. Hit Enter for No. It will spit out an output. Continue on.


# make installworld

Update /etc


# rm -fr /etc.old

(The very first time you run this command, don't be surprised if you see "no match" )


# cp -Rp /etc /etc.old
# /usr/sbin/mergemaster

Update /stand


# cd /usr/src/release
# make all install

Reboot and enjoy your new -STABLE system


# fastboot