October 21, 2016

OpenBSD: Follow -current

Remember: This is an unofficial guide

Read this for the real thing. This is just meant as a reminder for myself.

Locally, without a USB drive: My way

Use or follow this script:

#!/bin/sh

# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo ""
echo " This script must be run as root" 1>&2
echo ""
exit 1
fi

# Make sure /mnt/upgrade exists
if [ -d "/mnt/upgrade" ]; then
echo "/mnt/upgrade exists."
else
echo "Folder /mnt/upgrade does not exist, creating it now."
mkdir /mnt/upgrade
fi

# Make sure there is internet connection
wget -q --spider http://google.com
if [ $? -eq 0 ]; then
echo "You are online."
else
echo "You are offline. The script will terminate now."
exit
fi

# Define ftp server for ftp
FTP=ftp://ftp.spline.de/pub/OpenBSD/snapshots/amd64

# Define http server for wget

HTTP=http://fastly.cdn.openbsd.org/pub/OpenBSD/snapshots/amd64
alias WGET='wget -r -l1 -H -t1 -nd -N -np -erobots=off -A'

# Remove previous snapshots

\rm /mnt/upgrade/*

# Fetch snapshots in /mnt/upgrade

cd /mnt/upgrade

# If using http, employ wget to retrieve files

WGET bsd\* $HTTP
WGET INS\* $HTTP
WGET index.txt $HTTP
WGET \*tgz $HTTP
WGET SHA\* $HTTP

# If using ftp, uncomment this one
#ftp -i $FTP/{INS\*,index.txt,bsd\*,\*tgz,SHA\*}

# Make a backup of previous bsd.rd and move new one
# to / so that we can update

cp /bsd.rd /bsd.rd.old
cp bsd.rd /

# Ask the user whether running bsd should be backup'ed

echo ""
echo "Do you want to backup the current kernel bsd as bsd.old?"
echo ""
read answer
case $answer in
yes|Yes|y|Y|S|s)
cp /bsd /bsd.old && echo "" && echo "Current bsd backup'ed..."
;;
no|n|N)
echo "Current bsd not backup'ed..."
;;
esac

# Final note

echo ""
echo "Reboot, boot bsd.rd and choose for the location of the sets:"
echo ""
echo " [disk] with path /mnt/upgrade"
echo ""

Run upgrade and when getting to

Location of sets? (cd disk ftp http or 'done') [cd]

choose disk, give /mnt/upgrade as path and complete the upgrade in the usual way

Update your binaries

After upgrading, do not forget to update your binaries with

$ pkg_add -Iuv

Important is to note that during a release cycle, i.e. when

$ dmesg | grep OpenBSD

does NOT show the word “current”, you need to explicitly point to pkg_add to the snapshot directory:

$ pkg_add -D snap -Iuv

On the fly

Set installurl to fastly


# cat /etc/installurl
https://fastly.cdn.openbsd.org/pub/OpenBSD

Download bsd.rd from fastly and place it in /

After that, boot from bsd.rd

When prompted for the snapshots, choose http and no proxy and type fastly.cdn.openbsd.org

Make sure you choose the path

pub/OpenBSD/snapshots/amd64

because the script upgrade will point to the last release number, and not to snapshots.

Follow the usual process and reboot.

In case of, please check the bottom of the page

http://www.openbsd.org/faq/current.html

With a USB drive

Download install.fs and SHA256.sig from -current (change install60.fs to current number, which is the one used in -stable)

wget -c http://ftp.openbsd.org/pub/OpenBSD/snapshots/amd64/install60.fs
wget -c http://ftp.openbsd.org/pub/OpenBSD/snapshots/amd64/SHA256.sig

Verify the downloaded files

$ signify -Cp /etc/signify -Cp /etc/signify/openbsd-60-base.pub -x SHA256.sig install60.fs

Create a usb installer

$ doas dd if=install.fs of=/dev/rsd2c bs=1m

After it successfully created the usb, copy the SHA256.sig to it

$ doas mount .dev.sd2a /mnt
$ doas cp SHA256.sig /mnt/6.0/amd64/

Then boot from that drive and run (U)pgrade, and then

# pkg_add -Iuv