Wednesday, March 08, 2006

Binary Upgrade of FreeBSD 5.4 to 6.0

Yesterday I took control of a system running FreeBSD 5.4. I wanted to upgrade it to FreeBSD 6.0. I considered using cvsup to upgrade the userland and kernel, but I wanted an easier way. I also wanted to end up with a completely GENERIC system that would work well with freebsd-update.

I decided to follow Colin Percival's FreeBSD 5.4 to FreeBSD 6.0 binary upgrade instructions. This process worked flawlessly. I am not going to repeat the steps here, but I will point out a few details.

In step 2 of his process, Colin uses freebsd-update to create a base-modified file. Mine had these contents:

# cat base-modified
/.cshrc
/boot/defaults/loader.conf
/boot/kernel/kernel
/boot/kernel/linker.hints
/etc/group
/etc/hosts
/etc/manpath.config
/etc/master.passwd
/etc/motd
/etc/passwd
/etc/pwd.db
/etc/shells
/etc/spwd.db
/etc/ttys
/root/.cshrc
/usr/share/man/cat1/crontab.1.gz
/usr/share/man/cat1/tcpdump.1.gz
/usr/share/man/cat1/uname.1.gz
/usr/share/man/cat8/ifconfig.8.gz
/usr/share/man/whatis
/var/db/locate.database
/var/log/auth.log
/var/log/cron
/var/log/debug.log
/var/log/lastlog
/var/log/maillog
/var/log/sendmail.st
/var/log/wtmp
/var/run/utmp

The first three files are associated with this system running a modified 5.4 kernel. I did not want to preserve those changes. I wanted to preserve all of the changes to files in /etc/, as those are important -- password files and the like. I did not care about changes to files in /usr. I preserved files in /var that related to logs.

I decided to make a new version with these contents.

# cat base-modified.final
/.cshrc
/etc/group
/etc/hosts
/etc/manpath.config
/etc/master.passwd
/etc/motd
/etc/passwd
/etc/pwd.db
/etc/shells
/etc/spwd.db
/etc/ttys
/root/.cshrc
/var/log/auth.log
/var/log/cron
/var/log/debug.log
/var/log/lastlog
/var/log/maillog
/var/log/sendmail.st
/var/log/wtmp
/var/run/utmp

In step 14, Colin recommends recompiling all installed ports. I decided to simply pkg_delete all of them. I will add back new packages when the upgrade process is finished.

After following Colin's directions, I ended up with a system running FreeBSD 6.0 RELEASE. I was able to use freebsd-update to apply binary updates of the kernel and userland. I did all of this remotely over OpenSSH. Very cool -- thanks Colin!

6 comments:

Jeff Cross said...

Do you think this process will work for performing a binary upgrade from 6.0 to 6.1? I would like to upgrade my laptop when 6.1 is released but would rather not compile everything (cvsup, make buildworld, etc.).

I would also like to be able to use freebsd-update to maintain the 6.1 system and am not sure if the cvsup method allows you to do that after it is completed.

If the binary upgrade path is possible (or should be) I would prefer that over compiling due to the amount of time it takes to compile certain ports on my laptop. I can only imagine what it would be like compiling "world" and a new kernel!

Any insight into this is greatly appreciated!

Jeff

Richard Bejtlich said...

Hi Jeff,

I wouldn't be surprised to see Colin post instructions for a binary upgrade from 6.0 to 6.1 at his Web site. I am in the same boat.

However, I would not recompile all my apps. I would probably pkg_delete all of them and them pkg_add the new versions.

Jeff Cross said...

On your last comment about packages, couldn't I just continue using portsnap and portupgrade to upgrade to the latest version of packages/ports without deleting them all?

Also, if I continue to use the .../packages-6-stable/Latest/ portion for the PACKAGESITE environment variable, will this grab the upgrades for 6.1 or will this need to change after the release to something more 6.1'ish?

Thanks again!

Jeff

Richard Bejtlich said...

Hi Jeff,

Yes, you can use portupgrade if you like. You will want to set the PACKAGESITE variable as you also said.

Keep in mind that deleting and adding packages is basically what portupgrade does anyway.

Jeff Cross said...

Yeah, I guess you're right. I guess I just can't trust myself to pkg_add all of the ones I delete back to the system. Maybe that would be better though... only install the ones I need now! I am sure there are some I don't use any longer!

As always, I appreciate your help, Richard! Keep the blog content coming! Your posts are very helpful and informative!

Jeff

Colin Percival said...

I wouldn't be surprised to see Colin post instructions for a binary upgrade from 6.0 to 6.1 at his Web site.

Here you go:
http://www.daemonology.net/blog/2006-06-29-freebsd-6.0-to-6.1-binary-upgrade.html

Colin