HowTo: Upgrade FreeBSD 7.2 To FreeBSD 8 Using csup

by on November 23, 2009 · 7 comments· LAST UPDATED December 15, 2009

in , ,

How do I upgrade FreeBSD 7.2 to FreeBSD 8 stable using csup source code method including all ports?

csup is a general-purpose network file updating package. It is extremely fast program. Make sure you backup all data, MySQL / PGSQL database, and configuration file before attempting upgrade procedure.

Source-based upgrades from previous versions are well supported and recommend to gain full control of your FreeBSD 8 kernel and base systems. I'm going to assume that the:

[a] You are root user

[b] You are using portsnap and portmaster to manage FreeBSD ports .

[c] You made a backup of existing data.

Step # 1: Edit supfile

Make a copy of existing supfile, enter:
# cp /usr/share/examples/cvsup/standard-supfile /root/supfile.8
# vi /root/supfile.8

Set host name which specifies the server host which will supply the file updates to your computer. You must set it to one of the CVSup mirror sites listed in the FreeBSD page

*default host=cvsup1.us.FreeBSD.org

Set release tag to stable 8:

*default release=cvs tag=RELENG_8_0

Save and close the file.

Step # 2: Grab FreeBSD 8 Base System

Type the following command:
# csup /root/supfile.8
Read all last minute updating information for FreeBSD 8, enter:
# vi /usr/src/UPDATING

Step # 3: Build FreeBSD 8 Base System

You can enable or disable certain features such as NIS, ATM, BLUETOOTH and much more (see src.conf(5) man page). Edit /etc/src.conf and disable required features from base system:

WITHOUT_ATM=yes
WITHOUT_CALENDAR=yes
WITHOUT_GAMES=yes
WITHOUT_I4B=yes
WITHOUT_IPFILTER=yes
WITHOUT_IPX=yes
WITHOUT_LPR=yes
WITHOUT_NETCAT=yes
WITHOUT_NIS=yes
WITHOUT_RCMDS=yes
WITHOUT_SENDMAIL=yes
WITHOUT_WPA_SUPPLICANT_EAPOL=yes
WITHOUT_ZFS=yes
WITHOUT_BLUETOOTH=yes

Note you can skip /etc/src.conf and build the entire system. To build FreeBSD 8 system, enter:
# cd /usr/src
# make cleanworld && make cleandir
# make buildworld

Step # 4: Build FreeBSD 8 Kernel

You need to edit your kernel config file which is located at /usr/src/sys/`uname -p`/conf, enter:
# cd /usr/src/sys/`uname -p`/conf
# ls -l

The default file name is GENERIC. Edit GENERIC or your own custom kernel file (e.g., NIXCRAFT), enter:
# vi GENERIC
OR
# vi NIXCRAFT
My sample kernel config file:

include GENERIC
ident www303
options SMP
nodevice ugen
nodevice uhid
nodevice ulpt
nodevice umass
nodevice ums
nodevice ural
nodevice urio
nodevice uscanner
nodevice aue
nodevice axe
nodevice cdce
nodevice cue
nodevice kue
nodevice rue
options CONSPEED=19200
options QUOTA
# pf firewall specific
device pf
device pflog
device pfsync
options         ALTQ
options         ALTQ_CBQ        # Class Bases Queuing (CBQ)
options         ALTQ_RED        # Random Early Detection (RED)
options         ALTQ_RIO        # RED In/Out
options         ALTQ_HFSC       # Hierarchical Packet Scheduler (HFSC)
options         ALTQ_PRIQ       # Priority Queuing (PRIQ)
options         ALTQ_NOPCC      # Required for SMP build
# Turn on device polling for em driver
options DEVICE_POLLING
options HZ=1000

Make changes as per your setup. Finally, build and install the FreeBSD 8 kernel, run:
# make buildkernel
# make installkernel

OR use your custom kernel config name (e.g., NIXCRAFT), run:
# make buildkernel KERNCONF=NIXCRAFT
# make installkernel KERNCONF=NIXCRAFT

Step # 5: Reboot And Boot Into A Single User Mode

To reboot the system, enter:
# reboot
To boot into a single user hit 4 key at boot loader prompt:

Fig.01: FreeBSD Boot Loader Menu

Fig.01: FreeBSD Boot Loader Menu

A Note About Remote FreeBSD Server Using KVM

You need to boot into a single user mode using KVM to finish entire upgrade procedure. KVM will not work in a single user mode. However, you can load usb.ko and other modules to get kvm support under single user mode. Press [Enter] key at the boot loader. Connect to your remote FreeBSD box using KVM client and issue reboot command. At FreeBSD boot menu press [Spacebar] key to pause default booting. Press 6 to boot to loader prompt. Type the following commands to load KVM support and boot into a single user mode:

load usb.ko
set boot_serial=NO
set boot_multicons=NO
set console=vidconsole
boot -s

Once logged into a single user mode, mount all your ufs partitions, enter:
# mount -a -t ufs

Step # 6: Merge Configuration Files

The mergemaster utility is designed to aid you in updating the various configuration and other files associated with FreeBSD. To install sys configuration files that are required by the new base system. To compare only files known to be essential to the success of install world, enter:
# mergemaster -p

Step # 7: Install FreeBSD 8 Base System

Type the following commands:
# cd /usr/src
# make installworld

Finally merge your configuration files, enter:
# mergemaster -i

WARNING! Be careful with /etc/passwd, /etc/group and other files in base system. Verify each file before installing new version or merging exiting configuration files.

Finally, reboot the box:
# reboot

Step # 8: Verify New Installation

Type the following command:
# uname -a
# tail -f /var/log/messages
# grep 'something' /path/to/log/file

Step # 9: Upgrade Ports (Applications)

Type the following command:
# portsnap fetch update
# vi /usr/ports/UPDATING
# portmaster -Da

Reboot the box again and make sure everything is working fine, enter:
# reboot
Finally, delete old libraries, enter:
# cd /usr/src
# make delete-old

References:

  • Read /usr/src/Makefile, /usr/src/UPDATING, and /usr/ports/UPDATING.
  • man pages: portsnap, make, mergemaster, and src.conf
  • FreeBSD handbook - Rebuilding "world" chapter.
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 7 comments… read them below or add one }

1 tangram November 24, 2009 at 1:37 pm

Nice article.

Notice a small snag in the supfile section:
*default release=cvs tag=RELENG_8_0
means that you are following the errata branch not stable.

To follow Stable:
*default release=cvs tag=RELENG_8

Take care.

Reply

2 Andrew Terekhov November 24, 2009 at 11:09 pm

In single user mode run:
/sbin/adjkerntzl -i
to set system time correctly before running “make installworld”. Source – the Handbook.

Reply

3 tangram November 25, 2009 at 11:04 am

Also don’t edit the GENERIC configuration file. Copy it over and then edit or else next time you fetch the source code you’ll loose your customizations.

Reply

4 Aaron Toponce November 27, 2009 at 8:37 pm

Nevermind that this will take several, several hours to run through completion. I love FreeBSD, but managing ports is a royal PITA.

Reply

5 xer December 5, 2009 at 11:23 am

Yes Vivek, fix your how to, RELENG_8_0 is for RELEASE and not for STABLE, infact for RELEASE is better to use freebsd-update, see this table:
http://www.freebsd.org/releng/index.html

I read always your blog, and i like too much your how tos
Cheers

Reply

6 Rex January 22, 2010 at 2:37 pm

I think you should go through and correct this post after reading the comments.

One other thing you should add is that make buildkernel needs to be done in /usr/src, not in /usr/src/sys/`uname -p`/conf like your directions imply.

thanks for the outline, though, it’s handy.

Reply

7 bill December 8, 2011 at 9:10 pm

options SCHED_ULE ULE scheduler
options PREEMPTION Enable kernel thread preemption
options INET InterNETworking
options INET6 IPv6 communications protocols
options SCTP Stream Control Transmission Protocol
options FFS Berkeley Fast Filesystem
options SOFTUPDATES Enable FFS soft updates support
options UFS_ACL # Support for access control lists
options UFS_DIRHASH Improve performance on big directories
options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options MD_ROOT # MD is a potential root device
options NFSCLIENT Network Filesystem Client
GENERIC: 334 lines, 13004 characters.
192# make buildkernel
make: don’t know how to make buildkernel. Stop
192# make installkernel
Please Help

this is what I am getting… It will not build!

Reply

Leave a Comment

Tagged as: , , , , , , , ,

Previous Faq:

Next Faq: