Index | Thread | Search

From:
Renaud Allard <renaud@allard.it>
Subject:
sysupgrade with relink filling disk
To:
tech@openbsd.org
Date:
Fri, 31 Oct 2025 07:58:56 +0100

Download raw body.

Thread
Hello,

I noticed that some people reported having issues using sysupgrade as 
the /usr filesystem was full due to /usr/share/relink.
Wouldn't it be a good idea to cleanup that directory before doing the 
upgrade to avoid the issue?
What about this kind of patch? It cleans the relink directory within 
sysupgrade. It would probably be cleaner if it's cleaned within the 
upgrade process, but that's way more intrusive. I did it with a flag 
mainly for testing purposes.

Best Regards
Index: usr.sbin/sysupgrade/sysupgrade.8
===================================================================
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.8,v
diff -u -r1.22 sysupgrade.8
--- usr.sbin/sysupgrade/sysupgrade.8	25 Oct 2024 03:42:06 -0000	1.22
+++ usr.sbin/sysupgrade/sysupgrade.8	31 Oct 2025 06:52:18 -0000
@@ -22,7 +22,7 @@
 .Nd upgrade system to the next release or a new snapshot
 .Sh SYNOPSIS
 .Nm
-.Op Fl fkns
+.Op Fl dfkns
 .Op Fl b Ar base-directory
 .Op Fl R Ar version
 .Op Ar installurl | path
@@ -54,6 +54,10 @@
 .Ar base-directory Ns / Ns Pa _sysupgrade
 instead of
 .Pa /home/_sysupgrade .
+.It Fl d
+Remove the contents of
+.Pa /usr/share/relink
+during the upgrade.
 .It Fl f
 For snapshots, force an already applied upgrade.
 This option has no effect on releases.
Index: usr.sbin/sysupgrade/sysupgrade.sh
===================================================================
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
diff -u -r1.58 sysupgrade.sh
--- usr.sbin/sysupgrade/sysupgrade.sh	3 Feb 2025 18:55:55 -0000	1.58
+++ usr.sbin/sysupgrade/sysupgrade.sh	31 Oct 2025 06:52:18 -0000
@@ -35,7 +35,7 @@
 
 usage()
 {
-	echo "usage: ${0##*/} [-fkns] [-b base-directory] [-R version] [installurl | path]" 1>&2
+	echo "usage: ${0##*/} [-dfkns] [-b base-directory] [-R version] [installurl | path]" 1>&2
 	return 1
 }
 
@@ -77,15 +77,17 @@
 FORCE=false
 FORCE_VERSION=false
 KEEP=false
+DELETE_RELINK=false
 REBOOT=true
 WHAT='release'
 
 VERSION=$(uname -r)
 NEXT_VERSION=$(echo ${VERSION} + 0.1 | bc)
 
-while getopts b:fknrR:s arg; do
+while getopts b:dfknrR:s arg; do
 	case ${arg} in
 	b)	SETSDIR=${OPTARG}/_sysupgrade;;
+	d)	DELETE_RELINK=true;;
 	f)	FORCE=true;;
 	k)	KEEP=true;;
 	n)	REBOOT=false;;
@@ -224,6 +226,10 @@
 	cat <<__EOT > /etc/rc.firsttime
 rm -f ${SETSDIR}/{${CLEAN}}
 __EOT
+fi
+
+if ${DELETE_RELINK}; then
+        rm -rf /usr/share/relink/*
 fi
 
 echo Fetching updated firmware.