LinkedIn Sourceforge Twitter

Vincent's Blog

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

Modifications on OpenBSD sysupgrade

Posted on 2019-11-10 17:04:00 from Vincent in OpenBSD

Since version 6.6 of OpenBSD we can upgrade a machine via a simple commmand: sysupgrade. Unfortunately this tool as some side effects annoying for me: install all sets and reboot immediately without asking it.
In this blog, I present modifications I did in order to solve those problems.


Since few months, a new command has been added in OpenBSD base: sysupgrade.

This command is in fact a configuration script in order to prepare required files for autoinstall.
Infact, sysupgrade will create a file called: /auto_upgrade.conf with few elements in it informing auto_upgrade (the upgrade feature of autoinstall) what he must do.

This is a very nice initiative because most probably few persons were using this "auto upgrade" feature present since several years in OpenBSD.

Troubles with this sysupgrade tool

I have few concerns with this tool. Let me summarize them here under:

  • The tool download and install all possibles sets. This is a problem on several of my machines because they are tuned to run read-only. So they have a very limited disk size. Thus less unused sets if better.
  • The tool does not request any confirmation and reboot immediately. By RTFM, we can clearly see that this feature is documented. Nevertheless, the "manual" upgrade process do not do it automatically. So to have coherence between processes, I would prefer to have a confirmation before doing the reboot.
  • And finally, as said, the tool create the /auto_upgrade.conf file. But here the small issue is coming from the fact that sysupgrade over-write this file without any warning.

As said, some of those elements annoys some of my setups.

My modifications on sysupgrade

First I test is a /autoinstall.conf file is not yet present. In case we have one, we stop here.

I check a file called /etc/sysupgrade_sets.
This file must contain the sets your want to install.
If the file is not present, sysupgrade will take all sets available.

The syntax to use is exactly the one you use when doing a manual install.

So, you can say:

-x*  to remove all X relatated sets.   
+xbase*  to add xbase relatated sets.   
-ga* to remove games.

Every character after the "#" is considered as a comment. So a typical file could be:

# comment
-g* #remove games
-x* #remove all X sets

Finally, I inform the user that the script is reaching ends.
The user has some time to check the messages (and error messages).
To the question "Reboot now(Y/n)?", if the user is answering something else than "n" or "no", the machine reboot.

I'v also added extra error handling.
For example when ftp is failing, it does not display which file he tries to get.


The whole patching based on the version 1.30 available on November 10th 2019, is here.

The source code of the whole script is here

If someone of the core team find this useful, I will be very happy that you take this code. It's BSD license ;-).


I've used it on few of my machines.
Works as it should.

Be careful, this is updates your system.
After the execution of sysupgrade, look at you /auto_upgrade.conf file and check if there is no bad elements. After the reboot, it will be too late.

5, 3
displayed: 1930

1. From Sacha on Wed Feb 5 15:24:16 2020

Hi, thanks for this patch, it is usefull to chose the sets ! Why it is not commited ? Kind Regards, Sacha.

2. From Vincent on Thu Feb 6 22:51:31 2020

Thanks for the comment. Happy that it fit your needs :-).
Why it's not committed? ... maybe because someone has to propose it. I'm not personally ready for such process.

What is the second letter of the word Moon?