Sunday, January 8, 2006

OpenBSD Upgrade + Mergemaster

OpenBSDPreviously, my process to update OpenBSD was a manual one. Before, you couldn't upgrade installed packages and I didn't know of a way to easily upgrade /etc. Enter two things: 3.8-current's "pkg_add -u" and taking the time to test mergemaster.

My old upgrade method included running "sudo cp -Rp /etc /var /home/backup", formatting and installing the new version (leaving the /home partition unformatted during install). Then, manually updating /etc, re-adding accounts and re-installing all packages.

Today, I upgraded my -current (well, a snapshot, really) desktop running X.

I used Yaifo-0.2 to run a remote install. After building the yaifo.rd and copying it to /bsd, I rebooted and ssh'd back into my box (from downstairs on my PowerBook). For one of the first times, I upgraded OpenBSD to the latest snapshot (using the (u)grade option vs. the (i)nstall option). This process doesn't modify /dev, /etc, /root or /var. After the install, I rebooted into my newly upgraded machine.

Once the machine rebooted, I ssh'd back into it. I logged in as myself since my user account wasn't modified during the upgrade (my user account referring really to /etc/master.passwd). Then, I ran "sudo pkg_add -u" (Remember to set PKG_PATH). A bunch of packages were upgraded to their new versions. Two packages didn't upgrade properly, so I ran "sudo pkg_add -r -F update libxml" and it complained about not being able to run "sudo /usr/local/share/libxml2/rebuild", so I manually ran it. Then, I had to run "sudo pkg_add -r F updatedepends xmms-1.2.10p6". Finally, I ran "sudo pkg_add -u" again and all packages were upgraded.

I upgraded the packages first in case mergemaster was upgraded, and it was. Never having used mergemaster, I wanted to test it to see what happens. I installed source to /usr/src. I created a /foo and then ran "sudo cp -Rp /etc /var /root /foo". Then, I tested mergemaster with "sudo mergemaster -D/foo".

After seeing how mergemaster works, I ran it against the real thing: "sudo mergemaster". Since /etc is so important, I backed it up first. I also wanted to use mergemaster in manual mode and approve all changes. There are some options to automate some actions and I think I may test out some of them. It's just a matter of knowing what files you modified and what seem like system upgrades.

So, read up on mergemaster (install it and run "man mergemaster") and try out "pkg_add -u".