Wednesday, August 8, 2007

Quick Upgrade Process

LaptopsYou may not have noticed it yet here, but I love OpenBSD. I keep that pretty close to the vest, I know.

I just finished upgrading my Thinkpad T42 to the latest OpenBSD 4.2-current snapshot and thought I should share my upgrade process. Over the past few releases of OpenBSD, the process has gotten steadily easier. Marc Espie has almost single handedly overhauled the ports system (here, here and here to cite a few examples) into a robust, easy to upgrade system. And I especially like the clear distinction between the system base and add-on packages.

And, at this point, it's only slightly more work to create a port for new software instead of running make install to just install something into /usr/local/foo. The whole system has seen improvements, but I only pick on ports and packages because they'd been traditionally been more difficult to upgrade (you used to have to remove all packages and install the new ones). Even with the new packaging enhancements, though, on a production server it's a good idea to spend time comparing old configuration options to new configuration options to make sure the new versions of your applications do what you expect.

So, from top to bottom (at 10,000 feet), here's my upgrade process:

  1. I download the newest snapshots from my favorite mirror.

  2. I enable ACPI in both the ramdisk kernel and my upgrade kernel. For example:

    1. config -ef bsd

    2. enable acpi

    3. quit

  3. I copy bsd.rd to / and reboot.

  4. I type bsd.rd at the "boot>" prompt and go through the "(U)pgrade" process almost choosing defaults the whole way through.

  5. Because I test and build a bunch of different ports, I want to remove the cruft, so:

    1. I run: (cd /var/db/pkg ; ls -1 > ~/pkgs)

    2. I then remove lines for all of the ports I want and run: for f in `cat ~/pkgs`; do sudo pkg_delete $f; done a couple times to remove packages I really don't want. Dependencies for the packages I DO want nicely give error messages and are not removed.

  6. Then I go through the arduous process of upgrading my installed packages. It's a tough series of commands to type: pkg_add -ui

  7. Now with config-less X, there's nothing in /etc/X11 that I modify, so I rm -Rf /etc/X11 and run: tar -xvzpf xetc42.tgz -C /
    [Update 2007-08-18]: As Antoine Jacoutot (ajacoutot@) pointed out, I am stupidly deleting the beautiful OpenBSD artwork in this step. So either also untar xetc42.tgz into /tmp/foo when running mergemaster in the next step or also run tar -xvzpf xbase42.tgz ./etc -C / && tar -xvzpf xshare42.tgz ./etc -C /. Thanks Antoine.

  8. Then I prepare my mergemaster comparison directory: mkdir /tmp/foo ; sudo tar -xvzpf etc42.tgz -C /tmp/foo

  9. I make sure mergemaster is installed and run: mergemaster -i -r -t /tmp/foo ([Update 2007-08-18]: Antoine also suggested using the -i option to mergemaster to automatically install new files.)

  10. Then I reboot one last time and I'm off and running.


Not including the download of the installation sets, the whole process took less than 20 minutes and I was back in X. It took longer to write this post than to upgrade my laptop.

Yay, OpenBSD!

2 comments:

  1. "I am stupidly deleting the beautiful OpenBSD artwork in this step."

    Oh well, who would have thought xetc42.tgz was not the only one to write in /etc.

    Makes me wonder why the OpenBSD artwork is in /etc and not in /usr/share, and why this artwork is separated in two packages, xbase and xshare. Don't you think?

    ReplyDelete
  2. [...] BSD haftet immer der Ruf an, das dafür kaum Treiber existieren - andererseits beweisen selbst Systeme wie OpenBSD, deren primärer Antrieb Sicherheit ist, genau das Gegenteil. Neue Hardware in OpenBSD 4.2. Und das man ein BSD schnell updaten kann, wird hier ebenfalls am Beispiel von OpenBSD vorgeführt [...]

    ReplyDelete