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:

#!/usr/bin/env zsh

# 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 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

# Make sure /nou exists
if [ -d "/nou" ]; then
echo "Folder /nou exists."
else
echo "Folder /nou does not exist, creating it now."
mkdir /nou
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 /nou/*

# Fetch snapshots in /mnt/upgrade

cd /nou

# 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 /nou"
echo ""

# Want to update software and reboot?

read "CONT?Should I update your software and reboot (y/n)? "
if [[ "$CONT" =~ ^[YySs]$ ]]; then

# pkg_add

if dmesg | grep -q "current"; then
echo "This is current, updating software now with 'pkg_add -Iuv'"
pkg_add -Iuv
else
echo "You have updated during a release cycle, updating software now with 'pkg_add -D snap -Iuv'"
pkg_add -D snap -Iuv
fi

# reboot

echo ""
echo "Rebooting in 10 seconds, CTRL+C to stop."
sleep 10
reboot
else
exit 1
fi

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, as pointed in the above script, 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