Create account Login Webmail Contact Us

How to rebuild world and rebuild kernel
Posted by Mike C. on 11 September 2009 09:43 PM
This can be a tricky subject considering the fact that mergemaster can be a bit complicated at first glance. To those of you already familiar with linux you might get through it a bit easier. The first thing you need to do is upgrade your src. Your src should be located in /usr/src and if you already have a kernel that you are using you will need to back it up in the /root dir. Once you have cp'd the kernel to the /root dir you can now delete the src tree completely. Do NOT do this if you have an admin that has customized the src in any way or if you don't know what you were doing. Once you have deleted the /usr/src dir you can also delete /usr/obj (this will be replaced in the rebuilding). After you have deleted both of these dir's (by typing rm -rf /usr/src and rm -rf /usr/obj) you need to make the dir's again. Type "mkdir /usr/src ; mkdir /usr/obj ; mkdir /usr/obj/usr ; mkdir /usr/obj/usr/src". Now on to updating the src tree with your new src. This really depends on what you want to upgrade the system to. If you are using a 4.x system you should not upgrade to a 5.x system or a 6.x system. Likewise for 5.x and 6.x. Do not attempt to upgrade out of the tree. If you would like to be safe you will want to upgrade to RELENG_X where X = 4, 5, or 6. You will create a new file called "stable-supfile" and place it in /root with the following:

*default base=/usr
*default prefix=/usr
# The following line is for 4-stable. If you want 5-stable or 6-stable,
# change "RELENG_4" to "RELENG_5" or "RELENG_6" respectively.
*default release=cvs tag=RELENG_4
*default delete use-rel-suffix
*default compress

After you have saved the file type "cvsup -g -L 2 /root/stable-supfile" and the new src will find its way in /usr/src.

Once this is completed you will need to upgrade your /etc/make.conf with the following:

COMPAT20= yes
COMPAT21= yes
COMPAT22= yes

Be aware that you will not always have the above settings. You will need to change KERNCONF=KERNEL to whatever you set your Kernel name to. We will get in to the kernel in a minute. I put IPFW2=TRUE assuming that you would like to have IPFW2 enabled. I recommend this. The CPUTYPE=p4 will change to whatever type of CPU it is. FreeBSD has listed different examples in a files named /usr/src/etc/defaults/make.conf
Also, be sure to make sure the COMPAT's apply to you as well as the USA_RESIDENT.

Now it is time to get a kernel working for you. If you do not know how to do this I would strongly suggest getting help in making a kernel. This is the area where most people screw up and I can't explain it in detail in this article. I might cover it in a seperate article. For arguements sake lets say you got a kernel and its named DONKEY. cp DONKEY to /usr/src/sys/i386/conf/ and be sure to update your make.conf. Once this is done you are pretty much ready to start the makeworld process but you want to make sure your hostname is changed to what you want it. If it isn't be sure to update it in rc.conf and type "hostname" or whatever you are using for a hostname. As you can see the kernel name is the same as the box name. This is a good way of naming your server.

INSTALL SCREEN!!!!! Type "cd /usr/ports/sysutils/screen ; make install" and wait until its done. This is so important so if your SSH connection to the server fails the install process won't stop or be disconnected from your viewing.

Lets start the process. Type "/usr/local/bin/screen" and then the space bar when that appears. Type the following to complete the buildworld waiting for each step to complete before typing anything else:

cd /usr/src
make buildworld
make buildkernel
mergemaster -p
make installkernel
make installworld

Mergemaster can be a bit trickly so listen up closely. If you don't know how the basic unix system works maybe you shouldn't be doing this buildworld. The basic rule of thumb is to type "i" for install for EVERYTHING. This will ensure that your system is up to date. There are a few things that you won't need to type I for and you can actually totally disregard by typing "d". The only time you would type "d" is if you, yourself, edited the file and you don't want mergemaster to change it to the default. For instance /etc/motd, /var/named/etc/namedb/named.conf, etc... Be sure and understand the files in /etc as this will help you through the process. Chances are the suggestions mergemaster makes are needed. There are a few times where it will erase work you have done on specific /etc files which in that case you will just type "d" so it doesn't make changes. AGAIN, do NOT do this if you don't feel comfortable with it. I recommend you do this on a system you have console access to so if you mess up you can easily fix it by reinstalling etc. Do it a few times to get the feel for it then you can do it on a remote system.

After this you will reboot the server. First make sure that rc.conf contains the correct information and that sshd is set to startup. Make sure you don't change anything in sshd_config to make it not work. If this is a new system and you followed my instructions to the T things should come right up.
(413 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name: