Upgrade-6X-73.Html
Upgrading from FreeBSD 6.x to 7.3
This is the procedure we used to upgrade FreeBSD-6.3-based boss and ops nodes to FreeBSD 7.3 with the Emulab-approved 2010-12-17 ports collection. It should work for upgrading later versions of FreeBSD as well.
Note that the following commands assume you are running as root (or can "sudo") and that you are using csh as your shell (not sh or bash).
This procedure applies to both boss and ops, so you will be doing most of this twice. We start with boss, though it shouldn't really matter. Certain steps are intended for only boss or only ops, and are labeled as such.
Before You Start
Backup!
First and foremost, you should backup your boss and ops before you start. A complete backup to tape or other offline storage is always best, but if nothing else you should backup the assorted configuration files, logs and databases. Copying /etc, /usr/local/etc, /usr/testbed/etc and /var should capture most of that.
Shutdown Emulab
2. On boss, and if you have it, run:
sudo testbed-control shutdown
However, only newer versions of the Emulab software have this. You may need to shutdown services manually (mysql, stated, apache, tmcd, daemon_wrapper, reload_daemon...).
To make sure they stay down, move the following files out of /usr/local/etc/rc.d (but keep them!):
2.mysql-server.sh
3.testbed.sh
apache.sh
This way Emulab stuff doesn't start up after a reboot. You shouldn't need to reboot yet as long as these services are disabled.
Obtain Sources
3. Pull over the FreeBSD 7.3 source and ports tarballs from www.emulab.net.
The freebsd source is a RELENG_7_3 checkout with a few local kernel mods; it is the same source base we use in our FBSD73-STD image for nodes. The ports are a slightly updated (for security patches) version of the ports tree that came with 7.3 release along with the Emulab ports.
Upgrade the OS
4. Unpack the fbsd73-src tarball in /usr.
cd /usr mv src src.old tar xzf <wherever>/fbsd73-src.tar.gz
5. Build the world:
cd /usr/src; make -j4 buildworld
6. Build and install the kernel. You should be aware if your hardware requires a customized configuration and/or patches. At Utah, we have a customized kernel config called "TESTBED" which is a stripped-down version of "GENERIC" that still supports all of our hardware. If you don't have a previous configuration from which to base this kernel, use a utility such as "lspci" (/usr/ports/sysutils/pciutils) to probe your hardware.
Go to /usr/src and do (optionally specifying a custom kernel config):
make -j4 buildkernel KERNCONF=TESTBED make installkernel KERNCONF=TESTBED
7. Reboot to make sure the machine comes up and then:
cd /usr/src; make installworld
8. Remove "nodev" option from /etc/fstab. Otherwise mergemaster won't run. Then:
mergemaster -iF
It will prompt you to remove files from /etc/rc.d. Do so. It will want to remove /etc/namedb and make it a symlink. Do NOT do this. Then it will start prompting you, file after file, about files it wants to update. Most you can do, but do not install the following ("leave them for later"):
/etc/crontab # boss only /etc/group /etc/hosts /etc/mail/aliases # ops only /etc/master.passwd /etc/motd /etc/newsyslog.conf /etc/shells /etc/ssh/ssh_config # See instructions below /etc/ssh/sshd_config # See instructions below /etc/sysctl.conf /etc/syslog.conf /etc/ttys
Note that by default, the temproot files are located in /var/tmp/temproot. Don't remove what is left of them when you're prompted, but you can run newaliases and cap_mkdb.
9. Go back and merge the left alone files.
- /etc/ssh/ssh_config
Use the temproot version, but make sure to add the following:
# The following lines were added by the testbed installation process Host * StrictHostKeyChecking no Protocol 2,1 # End of testbed-added configuration
- /etc/ssh/sshd_config
Use the temproot version, but make sure to merge in:
Protocol 2,1 PermitRootLogin yes
10. Deal with named. For now we can get away with just leaving /etc/namedb as-is. The new stuff will be installed in /var/named but will be ignored. A caveat on the new bind: it defaults to not allowing recursive lookups. This is the secure thing but means that nodes cannot lookup outside hosts! In /etc/named.conf, add the following to the "options" section:
allow-recursion { any; };
10b. Deal with ntp. You will need to modify /etc/rc.conf to change "xntpd_enable" to just "ntpd_enable".
10c. Deal with samba (ops only). Make sure any samba symlinks are still pointing to /usr/local/etc/samba.
11. Reboot again.
Upgrade the Ports
12. Get the pre-built package package from Utah:
mkdir -p /share/freebsd/7.3 cd /share/freebsd/7.3 fetch http://www.emulab.net/downloads/FreeBSD-7.3-20101222.tar.gz tar xzf FreeBSD-7.3-20101222.tar.gz setenv PKG_PATH /share/freebsd/7.3/packages
This will enable the upgrade to use the pre-built packages when possible. Note that if you are normal user using "sudo", the PKG_PATH variable might be cleared depending on your sudo configuration, forcing you to run the following commands from inside the directory itself.
13. Unpack the new ports tree you downloaded:
cd /usr mv ports ports.old tar xzf <wherever>/ports-20101222.tar.gz
14. Remove all your old installed ports/packages and reinstall sudo:
sudo csh # (Only if you are not running as root) pkg_info >& ~/old_packages pkg_delete -af pkg_add sudo-1.7.4.4_1.tbz exit # (Only if you are not running as root)
Note that removing all your old ports may seem a little drastic, but we have discovered via lots of experience, that this is far easier and more reliable, then running using portupgrade. Consult the old_packages file you created above, if you need to know what packages might need to be installed later by hand.
15. Reinstall perl:
pkg_add perl-5.10.1.tbz ln -sf /usr/local/bin/perl5.10.1 /usr/bin/perl /usr/local/bin/perl-after-upgrade
16a. (ops only) Install the ops packages:
pkg_add emulab-ops-3.1.tbz pkg_add emulab-fs-3.1.tbz
16b. (boss only) Or install the boss package:
pkg_add emulab-boss-3.1.tbz
17. Manually add packages for which dependencies are missing:
pkg_add p5-DBD-mysql50-3.0002.tbz pkg_add php5-extensions-1.3.tbz pkg_add py26-m2crypto-0.20.tbz
18. Fix up (unpack) python .egg files (boss and ops):
mv /usr/local/lib/python2.6/site-packages/M2Crypto-0.20-py2.6-freebsd-7.3-RELEASE-p4-i386.egg /var/tmp easy_install -N -H None -Z /var/tmp/M2Crypto-0.20-py2.6-freebsd-7.3-RELEASE-p4-i386.egg
19. Apply a magic patch (boss):
set SRC=<somewhere> patch -d /usr/local/lib/perl5/site_perl/5.10.1/mach -f -l -i $SRC/patches/Mysql.pm.patch
20. If the collab tools were installed (ops):
pkg_add mailman-2.1.12.tbz pkg_add subversion-1.6.9.tbz
If mailman is installed, you need to make sure it is enabled in /etc/rc.conf by adding
mailman_enable="YES"
21. Optionally re-install other packages:
pkg_add emulab-protogeni-1.1.tbz # If you are part of ProtoGENI pkg_add portupgrade-2.4.6_3,2.tbz # For upgrading ports (how ironic) pkg_add emacs-nox11-23.1_2,1.tbz # install a real editor pkg_add xorg-libraries-7.4.tbz # X client side... pkg_add bash-4.0.35.tbz ...
Also, restore the files from step 2 to allow the services to run again (you don't need to start them, however).
22. Build and install the new Emulab software:
a) Grab the current Emulab source code from the
Emulab Git Repository. We encourage everyone to get the source code from the repository instead of a tarball, since that makes it easier to stay up to date. Once you have the source code on your boss:
set SRC=/your/src/dir cd $SRC
b) Copy over your current defs file and add the line:
SELFLOADER_DATA=""
c) Create a new object directory and configure it:
mkdir /your/obj/dir set OBJ=/your/obj/dir cd $OBJ; $SRC/configure --with-TBDEFS=$SRC/<defsfile>
d) Install this patch
cd $SRC patch -d /usr/local/lib/perl5/5.10.1 patches/SelfLoader.patch
23. Fix apache config file (for php5 on boss and ops):
cd </your/obj/dir>/apache boss: rm -f httpd.conf.fixed gmake install ops: rm -f httpd.conf-ops.fixed gmake control-install
24. UTAH ONLY: rebuild pubsub with elvincompat. Download the pubsub-0.95 tarball, grab a copy of elvin_hash.c and rebuild/reinstall. Make sure ELVIN_COMPAT=1 in the defs file.
25. Build and Install it.
Depending on how old your Emulab installation is, you may be prompted to run "gmake update-testbed", or if you are *really* old, you may need to go through <src>/sql/database-migrate.txt and manually run all of the updates that are not found in that same file in your old source tree. You will also need to go through <src>/doc/UPDATING in a similar way and follow all of the relevant instructions in there.
Assuming you now have a reasonably recent version of the Emulab software, run:
gmake boss: gmake boss-install ops: gmake ops-install gmake fs-install
Reboot and make sure everything comes up alright.