Back to post index

Upgrading OpenBSD on the 256 MB Ramnode
Tags: [openbsd]
Published: 04 May 2015 08:35

Part of keeping OpenBSD secure is applying patches as they come out. OpenBSD 5.6 has had a few errata since the release so it was time to update operand.ca. Luckily following stable is simple:

Following the section titled Using CVS to Get and Update your Source Tree, grab the CVS source for base:

$ cd /usr
$ rm -rf src/*
$ cvs -qd anoncvs@openbsd.cs.toronto.edu:/cvs get -rOPENBSD_5_6 -P src

Then update the CVS source:

$ cd /usr/src
$ cvs -q up -rOPENBSD_5_6 -Pd

Next, following the steps at http://www.openbsd.org/stable.html, rebuild the kernel first:

$ uname -a
OpenBSD janssen.my.domain 5.6 GENERIC#310 amd64

$ cd /usr/src/sys/arch/amd64/conf
$ /usr/sbin/config GENERIC
$ cd /usr/src/sys/arch/amd64/compile/GENERIC
$ make clean && make

Then install and reboot with new kernel:

$ cd /usr/src/sys/arch/amd64/compile/GENERIC
$ make install
$ reboot

Rebooting for me involves signing into the Ramnode VPS control panel and entering encryption passphrase to unlock the main disk. As expected, the new kernel booted ok.

Next, rebuild the binaries:

$ rm -rf /usr/obj/*
$ cd /usr/src
$ make obj
$ cd /usr/src/etc && env DESTDIR=/ make distrib-dirs
$ cd /usr/src
$ make build

make build failed for me with the following output:

/usr/src/gnu/usr.bin/cc/cc_tools/../../../gcc/gcc/config/i386/i386.md: In function 'internal_dfa_insn_code':
/usr/src/gnu/usr.bin/cc/cc_tools/../../../gcc/gcc/config/i386/i386.md:206: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
*** Error 1 in gnu/usr.bin/cc/cc_int (<bsd.lib.mk>:40 'insn-attrtab.o': @cc -O2 -pipe -g -DIN_GCC -DHAVE_CONFIG_H -DPREFIX=\"/usr\" -DPIE_DE...)
*** Error 1 in gnu/usr.bin/cc (<bsd.subdir.mk>:48 'all')
*** Error 1 in gnu/usr.bin (<bsd.subdir.mk>:48 'all')
*** Error 1 in gnu (<bsd.subdir.mk>:48 'all')
*** Error 1 in . (<bsd.subdir.mk>:48 'all')
*** Error 1 in /usr/src (Makefile:82 'build')

I figured that 256 MB of RAM was not enough to compile GCC at -O2, so I dialed down the optimization level by finding the relevant Makefile flag:

# find . -name 'Makefile' | xargs grep O2
...
./sys/arch/amd64/compile/GENERIC/Makefile:COPTS?=               -O2
...

Then setting that flag and calling make build again:

export COPTS="-O1"
make build

This worked - the build completed ok.