Upgrading OpenBSD — so darn easy!

Tonight I finally got around to upgrading my OpenBSD machine, Vectra functions as my file server among other things hehe. The 4.2 upgrade screwed around with the expat library making it depend on xbase42.tgz which is the X Windows System, normally not needed unless one is running a graphical desktop environment.

The system runs headless with no monitor, keyboard, or mouse and functions as a file server. So I have no need what so ever to run a GUI, using a command prompt over SSH is actually my preferred way of working on the box any way. because it means I don’t need a monitor, keyboard, or mouse to work on Vectra and because SSH is not as heavy on the network as using VNC/X Forwarding and crap. Now that 4.3 was released May 1st and fixed the libexpat thing I can update

I took the machine from OpenBSD 4.1 to 4.2 to 4.3. I could probably have saved time by not dealing with any of the *42.tgz files besides etc42.tgz but I did it any way. I’ve also learned the hardway to back up /root first hehe (see end of post notes). OpenBSD is one of the most easy to install, upgrade, use, and maintain operating systems I have ever used.

Here is my general log of things, and yes I do use the shells command grouping and flow-control constructs when I feel like it :-P. Most of the configuration file changes in 4.2/4.3 were never modified by me so I could install most of them over the old ones

EDIT:, be sure to remove BOTH etc*.tgz before using any the for loops to install files!!! or end up in my sleepy boat. Updating the files in /dev before rebooting is also not a bad idea.

su – root
cd /usr/obj
mkdir {4.2,4.3} && cd 4.2
cat ~/.profile          # look up my mirrors address
ftp ftp.usa.openbsd.org
        …             # login as anonymous
ftp> cd /pub/OpenBSD/4.2/i386
        …             # fetch files for OpenBSD 4.2
ftp> get base42.tgz
ftp> get etc42.tgz
ftp> get comp42.tgz
ftp> get misc42.tgz
ftp> get man42.tgz
ftp> get games42.tgz
ftp> lcd ../4.3
        …     # change directories
ftp> cd /pub/OpenBSD/4.3/i386
        …             # fetch files for OpenBSD 4.3
ftp> get bsd
ftp> get bsd.rd
ftp> get base43.tgz
ftp> get etc43.tgz
ftp> get comp43.tgz
ftp> get misc43.tgz
ftp> get man43.tgz
ftp> get games43.tgz
ftp> close
221 Goodbye.
ftp> bye        # return to my shell, pwd := /usr/obj/4.2
ftp>  http://openbsd.org/faq/upgrade42.patch      # fetch patch file for /etc
tar -xzphf etc42.tgz
cd etc          # pwd := /usr/obj/4.2/etc
# install the etc42 files as directed by the upgrade notes
cp magic man.conf netstart rc rc.conf rpc services /etc
cp mtree/* /etc/mtree/
cp mail/helpfile mail/localhost.cf mail/submit.cf /etc/mail
cp mail/sendmail.cf /etc/mail
cp etc/bgpd.conf /etc/                                                      
cp etc/mail/spamd.conf /etc/mail/                                            
cp etc/ospfd.conf /etc/                                                      
# test the patch
cd ..           # pwd:= /usr/obj/4.2 again
(cd /; patch -C -p0) < ./upgrade42.patch        # test patch
(cd /; patch -p0) < ./upgrade42.patch           # apply patch
# my /etc/ntpd.conf is customized and fails to patch clean
# remove the left over notes, _AFTER_ reviewing them !
(cd /etc; for i in `ls /etc/|grep rej`; do rm $i; done)
vimdiff etc/ssh/sshd_config /etc/ssh/sshd_config
# manually merge the new sshd_config with mine
                # this puts both files in a verticle split, new on the left,
                # old on the right. Merge changes in with the :diffput command
cd ../4.3              
# pwd := /usr/obj/4.3
ftp>  http://openbsd.org/faq/upgrade43.patch      # fetch patch file for /etc
# install the etc43 files as directed by the upgrade notes
tar -xzphf etc43.tgz
cp moduli netstart ospf6d.conf rc rc.conf relayd.conf security snmpd.conf /etc
cp mtree/* /etc/mtree/
cp mail/README /etc/mail
cp ../var/named/etc/root.hint /var/named/etc
cp etc/ttys /etc/ttys                                                        
(cd /; patch -C -p0) < ./upgrade43.patch        # test patch
(cd /; patch -p0) < ./upgrade43.patch           # apply patch
# remove the left over notes, _AFTER_ reviewing them !
(cd /etc; for i in `ls /etc/|grep rej`; do rm $i; done)
# remove uneeded files, as directed in 4.3 upgrade

rm /etc/hoststated.conf /var/named/standard/root.hint
# add the new users and groups in 4.3:
useradd -u90 -g=uid -c"OSPF6 Daemon" -d/var/empty -s/sbin/nologin _ospf6d
useradd -u91 -g=uid -c"SNMP Daemon" -d/var/empty -s/sbin/nologin _snmpd
# update mail aliases
mtree -qdef /etc/mtree/4.4BSD.dist -p / -u                                  
# create new directories as needed
# change permissions as instructed by the 4.3 upgrade notes
chown root:operator /etc/chio.conf                                          
chmod 644 /etc/chio.conf                                                    
# install the new kernel as directed, pwd := /usr/obj/4.3
ln /bsd /bsd.41                                                              
cp bsd /bsd.41
mv /bsd.41 /bsd                                                              
shutdown -r now         # reboot into the new kernel so we can begin

                        # upgrade files safely.
# wait for the machine to come back up, and ssh back to it
ping vectra
ssh2v                   # an alias that expands to ssh’ing me into vectra
su – root
# install all of the 4.2 upgrade files
(cd /usr/obj/4.2/; for ark in `ls | grep .tgz`; do tar -C / -xzphf $ark; done
# install all of the 4.3 upgrade files
(cd /usr/obj/4.3/; for ark in `ls | grep .tgz`; do tar -C / -xzphf $ark; done

Since there are a lot of printing related packages from back when I screwed with setting up a Lexmark WinJet with cups awhile back and the Samba system which is no longer used… Since oddly integrating Windows and BSD clients forced me into NFS shares : I’ve opted to delete all of the packages installed on the server and reinstall the only ones I actually give a flying rats rear end about

pkg_delete -cxi -F dependencies /var/db/pkg/*
pkg_add -vi bzip2 lzma

Sadly it seems that /root/profile for some odd reason was overwritten by one of the upgrade files, which really sucks… Because I didn’t stop to think — the tarballs for upgrade are the same as a fresh install which has to create roots default home directory!!!

I had set up roots ~/.profile to set PKG_PATH dynamically based on the current architecture and release level. So I redirected the output of ‘set’ to a file to retain the values and rewrote my file by hand and changed ~/.profile to source a separate ~/.kshrc before rebooting the system

set > /tmp/root.profile
vim -o ~/.profile -o ~/.kshrc
shutdown -r now

1 thought on “Upgrading OpenBSD — so darn easy!”

  1. Originally posted on my Live Journal:

    by: spc78 at 2008-05-29 03:20 am (UTC)
    comment: That whole thing about root's .profile is really odd. I've been upgrading my OBSD box that same way since 3.8, and never had that happen.

    by: sas_spidey01 at 2008-05-30 04:36 am (UTC)
    comment: I guess it pays not to extract the wrong tarballover the / by accident ^_^


Comments are closed.