Upgrading from FreeBSD 4
Jump to navigation
Jump to search
Extracted from /usr/src/UPDATING
To upgrade in-place from 4.x-stable to 5.x ---------------------------------------------- # 5.x uses more space than 4.x. Also, the location of kernel # modules has changed. If you are installing 5.x onto a 4.x # system, you'll need about 30MB of free disk space on your / # partition. If you have less than this, you may encounter difficult # to back out of problems with this procedure. If /tmp is on # the / partition, you may want to completely remove all its content # before upgrading, as this can be a common source of shortage of # space on /. <make sure you have good level 0 dumps> <maybe fix /etc/fstab> [1] make buildworld [2] make buildkernel KERNCONF=YOUR_KERNEL_HERE [3] cp sys/${MACHINE}/conf/GENERIC.hints /boot/device.hints [4] make installkernel KERNCONF=YOUR_KERNEL_HERE cd sys/boot ; make STRIP= install [5] [6] <reboot in single user> [7] /usr/src/etc/rc.d/preseedrandom [8] mergemaster -p [9] rm -rf /usr/include/g++ rm -f /sbin/mountd make installworld [11] mergemaster -i [12] <reboot> Make sure that you've read the UPDATING file to understand the tweaks to various things you need. At this point in the life cycle of stable, things change fairly rarely. However, many changes from 4.x to 5.x are not reflected in this breif section. The defaults can also change, so please read ALL of the UPDATING entries. If you have any ports or packages installed on the system, please see /usr/ports/UPDATING. The following items are known to cause problems with the upgrade: (a) Kerberos upgrades are hard, and evidentally don't work. More on this later. (b) Old ports and packages can sometimes have subtle problems with newer libraries. portupgrade -f is recommended where possible after the upgrade. portupgrade -P will be faster since it uses packages. There are many known issues with running a mix of 4.x built packages and 5.x built packages, and this avoids them. (c) Perl based ports may also have the wrong version of perl hard coded into the headers. Spamassassin is one such port. (d) Startup scripts have significantly changed. Make sure that you verify that all expected daemons start. Modifications of /etc/rc* (except rc.conf) may cause problems. (e) Device names have changed and MAKEDEV is gone. (f) The boot loader defaults have changed, which may cause confusion. (g) If the build dies for some reason and you reboot, you'll be booting with new libraries, but old paths. You will need to tell ldconfig about them with ldconfig /lib /usr/lib /usr/local/lib (h) If the system appears to hang, try toggling the scroll lock. Many kvm switches use Scroll Lock to switch screens and on such systems a hang can often just be scroll lock active. (i) named now runs in a chroot unless you disable this. See named_chrootdir in /etc/defaults/rc.conf for details on restoring 4.x behavior. (j) Ports that use PAM on 4.x should be recompiled. This is especially true for sudo. know thy root password before the upgrade! [1] Before you upgrade, please make sure that you are not using compatibility slices. These are device names of the form, on i386 and other architectures that use MBR slicing, /dev/ad0a without the actual slice name. Chances are excellent that these will break. You generally must update these entries to use the post FreeBSD 2.x form of /dev/ad0s1a. [2] When checking out sources, you must include the -P flag to have cvs prune empty directories. Also, if CPUTYPE is defined in your /etc/make.conf, make sure to use the "?=" instead of the "=" assignment operator, so that buildworld can override the CPUTYPE if it needs to. In case you would like to avoid installing new packages of everything, you might want to uncomment the "COMPAT4X= YES" entry, so that 4.x compatibility libraries are built which should allow you to continue using your existing software for a while. [3] In order to have a kernel that can run the 4.x or earlier binaries needed to do an installworld, you must include the COMPAT_FREEBSD4 option in your kernel. Failure to do so may leave you with a system that is hard to boot to recover. If you have a.out binaries, then you need to add COMPAT_AOUT option too. If you are updating a system that's been updated from 2.x and/or 3.x in the past, enable both of these to be safe. [4] If you have legacy ISA devices, you may need to create your own device.hints to reflect your unique hardware configuration. [5] Since make installkernel also does a make heirarchy, PAM will stop working because /etc/pam.d's existance overrides /etc/pam.conf. If you want to login to your system after the install kernel, or if you have accidentally rebooted a remote system into multi-user, the existance of /etc/pam.d will cause remote logins to fail. It is safe to remove it at this step as it will be recreated later. [6] 4.x boot loader can be used to boot a 5.x system, however it is difficult to do that at best. If you wish to try, then you should interrupt the boot and at the ok prompt type: ok unload ok boot /boot/kernel/kernel If this fails to work, you must install a new boot loader as described here. [7] If you have third party modules, such as vmware, you should disable them at this point so they don't crash your system on reboot. [8] From the bootblocks, boot -s, and then do fsck -p mount -a -t ufs cd /usr/src adjkerntz -i # if CMOS is wall time Also, when doing a major release upgrade, it is required that you boot into single user mode to do the installworld. For the 4.x -> 5.x upgrade, you will also see many messages about needing to recompile your userland. These are harmless and can be ignored while you proceed to the next step. [9] In order to create temporary files, /dev/random must be initialized by feeding data into it. /usr/src/etc/rc.d/preseedrandom takes care of this. [10] Usually this step is a noop. However, from time to time you may need to do this if you get unknown user in the following step. It never hurts to do it all the time. You may need to install a new mergemaster (cd src/usr.sbin/mergemaster && make install) after the buildworld before this step if you last updated from current before 20020224 or from -stable before 20020408. If you are installing not from /usr/src, don't forget the -m option. [11] If you are using a non-standard /usr/obj, you need to set an appropriate MAKEOBJDIRPREFIX before this step. [12] Note: This step is non-optional. Failure to do this step can result in a significant reduction in the functionality of the system. Attempting to do it by hand is not recommended and those that pursue this avenue should read this file carefully, as well as the archives of freebsd-current and freebsd-hackers mailing lists for potential gotchas. Also, if you are installing not from /usr/src, don't forget the -m option. Also note: since many libraries moved into /lib with 5.x, failure to run mergemaster will result in many shared libraries that should be there not being found.
Typical Usage
cvsup /etc/cvsup-release <configure kernel config file in /sys/i386/conf> <set KERNCONF=YOUR_KERNEL_HERE in /etc/make.conf> <set fsck_y_enable=YES in /etc/make.conf> <check /etc/fstab for compatibility slices, and remove any procfs entries>
make buildworld make buildkernel cp /sys/i386/conf/GENERIC.hints /boot/device.hints make installkernel cd /sys/boot ; make STRIP= install /usr/src/usr.sbin/mergemaster/mergemaster.sh -p rm -r /etc/pam.d reboot
<reboot in single user> /usr/src/etc/rc.d/preseedrandom mergemaster -p rm -rf /usr/include/g++ rm -f /sbin/mountd make installworld mergemaster -i reboot