Upgrading from FreeBSD 5.X to FreeBSD 6.X ========================================= Author: Ralf S. Engelschall Version: 1.5 Modified: 2007-05-24 Created: 2006-01-11 ATTENTION: THIS UPGRADE PROCEDURE MIGHT NOT WORK FOR YOU AS YOUR ENVIRONMENT IS DIFFERENT. ALSO, THIS UPGRADE PROCEDURES MIGHT DESTROY YOUR SYSTEM AND YOU POTENTIALLY MIGHT LOOSE DATA. NO WARRANTY AT ALL. USE IT AT YOUR OWN RISK! The following is a step-by-step procedure for upgrading a server from FreeBSD 5.[45]-STABLE to a FreeBSD 6.2-STABLE. It is able to upgrade the server completely remotely with neither console access nor single-user mode requirements. It was successfully tested on about 20 servers in February 2007. ---- PREPARE ---------------------------------------------------------------- o # reboot once to make sure OLD system is at least # able to still successfully reboot at all ;-) # SORRY, THIS IS NOT A JOKE -- THIS IS A VERY SERIOUS ISSUE! $ shutdown -r now ---- BUILD ------------------------------------------------------------------ o # switch to a reasonable run-time environment $ cd /; exec `/usr/bin/which bash sh | head -1` $ PATH=/bin:/usr/bin:/sbin:/usr/sbin; umask 022; unset TMOUT o # install backward compatibility files # (locale data to /usr/local/share/compat/, libraries to /usr/local/lib/compat/) # notice: via binary packages as ports cannot be installed under FreeBSD 5.X $ url="ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/All" $ ( cd /tmp; for pkg in localedata-5.4.tbz compat5x-i386-5.4.0.8_7.tbz; do \ fetch -p $url/$pkg; pkg_add $pkg; rm -f $pkg; \ done ) o # install latest FreeBSD Upgrade Toolkit $ cd /usr; \ fetch http://people.freebsd.org/~rse/dist/freebsd-adm-1.2.2.tar.gz; \ rm -rf adm; gunzip > options COMPAT_FREEBSD5 o # prepare the upgrade # (mainly create "_dhcp" and "audit" user/group) $ mergemaster -p o # build new system $ cd /usr/adm && make world-build kernel-build ---- INSTALL ---------------------------------------------------------------- o # upgrade system $ make world-install kernel-install o # cleanup system (part 1) $ rm -f /etc/rc.d/gbde_swap /etc/rc.d/initdiskless /etc/rc.d/ppp-user $ rm -f /etc/rc.d/preseedrandom /etc/rc.d/rcconf.sh /etc/rc.d/vinum $ make etc $ make clean o # reboot into upgraded system $ shutdown -r now ---- CLEANUP ---------------------------------------------------------------- o # switch to a reasonable run-time environment $ cd /; exec `/usr/bin/which bash bash sh | head -1` $ PATH=/bin:/usr/bin:/sbin:/usr/sbin; umask 022; unset TMOUT o # cleanup system (part 2) $ ( for dir in /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/libdata; do \ find $dir -mtime +2 -type f -xdev -print; \ find $dir -mtime +2 -type l -xdev -print; \ done ) >/tmp/remove $ vi /tmp/remove # REVIEW FILES TO REMOVE MANUALLY $ cat /tmp/remove | xargs rm -f $ ( for dir in /lib /usr/lib; do \ find $dir -mtime +2 -type f -xdev -print; \ find $dir -mtime +2 -type l -xdev -print; \ done ) | grep -v /usr/lib/compat >/tmp/move $ vi /tmp/move # REVIEW FILES TO MOVE MANUALLY $ for x in `cat /tmp/move`; do chflags noschg $x; mv $x /usr/lib/compat/; done $ cd /usr/src; make BATCH_DELETE_OLD_FILES=YES delete-old delete-old-libs o # reboot into cleaned system # (mainly to reload the shared library cache and to # make sure everything really still works fine) $ shutdown -r now