Index | Thread | Search

From:
Crystal Kolipe <kolipe.c@exoticsilicon.com>
Subject:
Installer bug sets wxallowed on wrong partitions
To:
tech@openbsd.org
Date:
Tue, 10 Nov 2026 17:35:49 -0000

Download raw body.

Thread
  • Crystal Kolipe:

    Installer bug sets wxallowed on wrong partitions

A bug in install.sub can cause wxallowed to be applied to partitions other
than where /usr/local resides.

The current logic first determines the mount path to the partition supporting
/usr/local, (if no separate /usr/local partition is defined, then this might
be just /usr or even the root partition if no separate /usr partition exists).

This path then has the leading '/mnt' stripped, and the stripped path is
passed to sed as part of a substitution command for fstab.

Unfortunately, nothing anchors the stripped path to the beginning of the path
field in fstab.

This means that _any_ path ending with that path fragment will match, and have
wxallowed applied.

Example: a regular auto-partitioned disklabel on sd0, with a dedicated
/usr/local, and a similar set of partitions on sd1, all prefixed with
/portsroot to hold a chrooted ports environment:

/portsroot/usr/local gets wxallowed added.

Whilst this _might_ seem useful and even desired, (the /portsroot/usr/local
partition would likely need to be mounted wxallowed anyway), it's not the
intended behaviour of the installer, obviously not documented, and doesn't
even work propperly in all situations:

Second example: the main system does not have a separate /usr/local, but the
layout for the chrooted environment does:

In this case, the installer passes /usr to sed for the substitution, because
that's where the real /usr/local resides, (lacking it's own dedicated
partition).

This matches /portsroot/usr but not /portsroot/usr/local, so the chroot
environment ends up _without_ wxallowed on /portsroot/usr/local, but _with_
wxallowed on /portsroot/usr, (where it is not wanted).

The patch below adds a single space to the backreferenced capture group so
that $_mp is anchored to the beginning of the path.

--- distrib/miniroot/install.sub.dist	Mon Sep 28 15:23:03 2026
+++ distrib/miniroot/install.sub	Tue Nov 10 17:27:51 2026
@@ -3312,7 +3312,7 @@
 	# Set 'wxallowed' mount option for the filesystem /usr/local resides on.
 	_mp=$(df /mnt/usr/local | sed '$!d')
 	_mp=${_mp##*/mnt}
-	sed -i "s#\(${_mp:-/} ffs rw\)#\1,wxallowed#" /tmp/i/fstab
+	sed -i "s#\( ${_mp:-/} ffs rw\)#\1,wxallowed#" /tmp/i/fstab
 
 	# If we did not succeed at setting TZ yet, we try again
 	# using the timezone names extracted from the base set.