LinkedIn Sourceforge

Vincent's Blog

Pleasure in the job puts perfection in the work (Aristote)

My sysupgrade adapted for OpenBSD 7.6

Posted on 2024-11-01 20:29:00 from Vincent in OpenBSD My Sysupgrade

For several years, I've been using a customized version of sysupgrade to avoid deploying all OpenBSD sets across my different machines. This adapted script has been working flawlessly, but in this post, I’ll share an updated version that incorporates the latest features and code improvements from the OpenBSD developers.


Introduction

With the release of OpenBSD 7.6 and previous versions, there have been some changes in the sysupgrade code. You can check the GitHub history here.

I have customized sysupgrade to allow selection of specific sets to deploy during the upgrade. This can be done by creating a file with the sets you want to exclude.

Here’s an example of /etc/sysupgrade_sets on my OpenBSD system, which is connected to my Hi-Fi system:

obsd:~# cat /etc/sysupgrade_sets
-game*  # Exclude game sets
-xs*    # Exclude X server and X share sets, but keep xbase
-xf*    # Exclude X font sets

As shown, comments are allowed, and the syntax is similar to the installation process. This file specifies which sets to download and install.

My sysupgrade Script

You can download my custom sysupgrade script here or use the following commands:

obsd:~# ftp https://vincentdelft.be/static/post/post_20241101/mysysupgrade.ksh
obsd:~# ksh mysysupgrade.ksh

Like the default version, this script needs to be run with ksh.

Using My sysupgrade Script

Here’s a walkthrough of using the script on an OpenBSD 7.5 server. You can see the steps it performs:

obsd: ~ # ksh mysysupgrade.ksh
Fetching from https://cdn.openbsd.org/pub/OpenBSD/7.6/amd64/
SHA256.sig   100% |*************************************************************************|  2324       00:00
Signature Verified
BUILDINFO    100% |*************************************************************************|    54       00:00
Verifying old sets.
The following files will be downloaded: INSTALL.amd64 base76.tgz bsd bsd.mp bsd.rd comp76.tgz man76.tgz xbase76.tgz
old file: INSTALL.amd64 base75.tgz bsd bsd.mp bsd.rd comp75.tgz man75.tgz xbase75.tgz
INSTALL.amd64 100% |************************************************************************| 44889       00:00
base76.tgz   100% |*************************************************************************|   414 MB    00:38
bsd          100% |*************************************************************************| 28007 KB    00:03
bsd.mp       100% |*************************************************************************| 28139 KB    00:03
bsd.rd       100% |*************************************************************************|  4600 KB    00:02
comp76.tgz   100% |*************************************************************************| 81512 KB    00:08
man76.tgz    100% |*************************************************************************|  8039 KB    00:04
xbase76.tgz  100% |*************************************************************************| 60681 KB    00:10
Verifying sets.
Fetching updated firmware.
fw_update: add none; update intel,inteldrm,vmm|
Reboot now ?(Y/n) n
obsd: ~ #

The script creates an /auto_upgrade.conf file, simulating the manual input you would typically provide during an upgrade. Here’s a look:

Location of sets = disk
Pathname to the sets = /mnt/home/_sysupgrade/
Set name(s) = -game*
Set name(s) = -xs*
Set name(s) = -xf*
Directory does not contain SHA256.sig. Continue without verification = yes

This configuration specifies the sets’ location and excludes game, xs, and xf sets based on /etc/sysupgrade_sets. The installation script installs only what is in /mnt/home/_sysupgrade.

The script also ensures that /bsd.upgrade is prepared and protected with the 700 permission:

obsd:~# ls -al /bsd.upgrade
-rwx------  1 root  wheel  4710411 Oct 31 14:42 /bsd.upgrade

To complete the upgrade, reboot the machine:

obsd:~# reboot

If you have console access, you can monitor the process. Otherwise, wait a few minutes for the upgrade and a final reboot.

Final Steps

After rebooting, complete the upgrade by running sysmerge and updating packages:

obsd:~# sysmerge
obsd:~# pkg_add -u

Although the upgrade script includes a first-boot sysmerge, it might not cover all changes to customized files. Package updates can take longer depending on your internet speed and the number of installed packages. Once everything is up-to-date, reboot the system again:

obsd:~# reboot

Conclusion

I do once the sets I want to deploy in /etc/sysupgrade_sets file in each of my machines and with the following commands, I can now upgrade all my OpenBSD 7.5 systems that have an /etc/sysupgrade_sets file configured:

obsd:~# ftp https://vincentdelft.be/static/post/post_20241101/mysysupgrade.ksh
obsd:~# ksh mysysupgrade.ksh
(wait a minute or two before reconnecting via ssh)
obsd:~# sysmerge
obsd:~# pkg_add -u

While some users prefer a standard installation (source), I exclude certain sets to optimize for smaller systems with limited resources. This setup has worked well for me over the years without issues.

In rare cases, I may need to install xbaseXX.tgz for specific libraries (e.g., Pillow), but this is limited to certain packages.

My customized sysupgrade has suited my needs perfectly, and I hope it does the same for you!



3, 2
displayed: 598



What is the last letter of the word Moon?