docs/reference/sysupgrade.txt: what sysupgrade 1.5 does on this tree (t0055)
packages.list:46-48 takes sysutils/sysupgrade as a binary of the makronix set and names docs/reference/sysupgrade.txt as the reading behind it, and docs/reference/AGENTS.md lists the file too; neither existed. This is the reading, done in the distfile sysupgrade-1.5.tar.gz (build/distfiles) and pkgsrc's three patches, with the claims measured in the tree. What it settles for t0055: - RELEASEDIR is the architecture directory of a release (it fetches binary/sets/<set>.<ext> and binary/kernel/netbsd-<KERNEL>.gz under it), so build/obj/releasedir/amd64, not the sets directory; the sets there are *.tar.xz and pkgsrc's ARCHIVE_EXTENSION is tar.xz on x86_64. - file:// is not an accepted form: an absolute path, ftp://, http://, ssh:// (and https:// through pkgsrc's patch). Our command has to translate file:///DIR to /DIR. - KERNEL=AUTO needs config(1), which is comp-obsolete in this tree (src/distrib/sets/lists/comp/mi:4719-4720) and not in the destdir: it fails, it does not skip; KERNEL must be explicit (GENERIC on amd64). - SETS=AUTO takes /etc/mtree/set.*, and set.makronix is one of them: the makronix set is fetched and unpacked with the base system. - The configuration file does not exist on an installed system: the set carries share/examples/sysupgrade/default.conf, the CONF_FILES copy to /usr/pkg/etc/sysupgrade.conf is a pkg_add action, and shtk_config_load stops when the file is missing. The command of t0055 passes -c its own. - Nothing verifies a set (t0078's subject). Also recorded as makronix wiki entry e00012.
This commit is contained in:
1 parent
724ad5bd80
commit
e52d511ec0
1 file changed
+149
-201
+149
-201
@@ -1,211 +1,159 @@
|
||||
sysupgrade -- saved documentation (t0055)
|
||||
Source: pkgsrc/sysutils/sysupgrade (sysupgrade-1.5, pkgsrc patches applied:
|
||||
https allowed, ARCHIVE_EXTENSION tar.xz on x86_64, direct paths to
|
||||
etcupdate/postinstall); distfile build/distfiles/sysupgrade-1.5.tar.gz.
|
||||
Read 2026-11-14. What settles the questions of the task:
|
||||
sysupgrade(8), the base system's upgrade (t0055)
|
||||
|
||||
1. RELEASEDIR (sysupgrade.conf.5): "Location of the release directory (which
|
||||
must hold a binary/sets/ subdirectory). This can be either a local path or
|
||||
a URL. If the location is a URL, any of the HTTP, FTP or SSH protocols are
|
||||
supported." -> file:// is NOT among them. sysupgrade.sh sysupgrade_fetch():
|
||||
cases ftp://*|http://* (https:// after the pkgsrc patch), ssh://*, /* (an
|
||||
absolute path: the files are symlinked into the cache), anything else:
|
||||
"Don't know how to fetch from ..., must be an absolute path or an FTP/HTTP
|
||||
site". So a file:// URL has to become a path before sysupgrade sees it.
|
||||
2. Files fetched: binary/sets/<set>.<ARCHIVE_EXTENSION> for every set in SETS,
|
||||
and binary/kernel/netbsd-<KERNEL>.gz. Makronix's release has exactly that
|
||||
layout (build/obj/releasedir/amd64/binary/{sets/*.tar.xz,kernel/netbsd-*.gz}).
|
||||
3. SETS (conf.5): "If this is set to the magic value AUTO, the list of sets is
|
||||
determined from the files in <DESTDIR>/etc/mtree." etc/mtree/set.makronix
|
||||
exists in the destdir, so the makronix set is upgraded with the others.
|
||||
"The presence of any configuration sets (such as etc or xetc) in this list
|
||||
enables the etcupdate and postinstall steps."
|
||||
4. KERNEL (conf.5): "AUTO: attempt to automatically determine the name of the
|
||||
current kernel by using config(1) on <DESTDIR>/netbsd" -- needs config(1)
|
||||
from the comp set; a Makronix system without comp must name it (GENERIC).
|
||||
5. POSTINSTALL_AUTOFIX (conf.5): "It is recommended that you include 'obsolete'
|
||||
in this list at the very least."
|
||||
6. ETCUPDATE: "the only interactive step in the upgrade process".
|
||||
7. CACHEDIR default ${VARBASE}/cache/sysupgrade; AUTOCLEAN deletes the
|
||||
downloaded files after `auto'.
|
||||
Binary packages of the NetBSD project (x86_64, 11.0_2026Q3):
|
||||
sysupgrade-1.5nb12.tgz, shtk-1.7.tgz (HTTP 200, 2026-11-14).
|
||||
Read 2026-11-15. Source: pkgsrc `sysutils/sysupgrade`, version 1.5 with
|
||||
PKGREVISION 12 (`pkgsrc/sysutils/sysupgrade/Makefile:3-4`), upstream
|
||||
https://github.com/jmmv/sysupgrade/ (modified-bsd,
|
||||
`pkgsrc/sysutils/sysupgrade/Makefile:10`). Read in the distfile
|
||||
`sysupgrade-1.5.tar.gz` (build/distfiles): `sysupgrade.sh` (505 lines),
|
||||
`sysupgrade.8.in` (the man page), `sysupgrade.conf.5.in`, `default.conf`, and
|
||||
pkgsrc's three patches (`pkgsrc/sysutils/sysupgrade/patches/patch-*`). Line
|
||||
numbers below are the distfile's, unless a path in this tree is named.
|
||||
|
||||
--- sysupgrade.conf(5) as shipped ---
|
||||
.Dd October 10, 2012
|
||||
.Dt SYSUPGRADE.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm sysupgrade.conf
|
||||
.Nd configuration file to control NetBSD system upgrades
|
||||
.Sh DESCRIPTION
|
||||
Configuration files for
|
||||
.Xr sysupgrade 8
|
||||
are simple shell scripts that set, or explicitly clear, a collection of known
|
||||
configuration variables.
|
||||
.Pp
|
||||
The following configuration variables are recognized:
|
||||
.Bl -tag
|
||||
.It Va AUTOCLEAN
|
||||
Whether to automatically delete the downloaded files or not as part of the
|
||||
.Sq auto
|
||||
command.
|
||||
.Pp
|
||||
If you set
|
||||
.Va ETCUPDATE
|
||||
to false, you will probably want to disable autocleaning.
|
||||
This will let you run the
|
||||
.Sq etcupdate
|
||||
command on your own at a later stage reusing the same distribution sets used to
|
||||
upgrade the system.
|
||||
.Pp
|
||||
Default: yes.
|
||||
.It Va CACHEDIR
|
||||
Path to the local directory into which distribution sets are temporarily fetched
|
||||
while applying a system upgrade.
|
||||
Note that all
|
||||
.Nm
|
||||
commands that need access to the distribution sets (pretty much all of them)
|
||||
will read from this directory.
|
||||
If you plan on issuing different upgrade steps at different times, this
|
||||
directory should persist across the different executions.
|
||||
.Pp
|
||||
Default:
|
||||
.Pa __SYSUPGRADE_CACHEDIR__
|
||||
.It Va DESTDIR
|
||||
Path to the root of the system to be upgraded.
|
||||
This is prepended to all other paths affected by
|
||||
.Xr sysupgrade 8
|
||||
and can be used to perform upgrades of non-live systems or for testing
|
||||
purposes.
|
||||
.Pp
|
||||
Default: not set (which means
|
||||
.Pa /
|
||||
is affected).
|
||||
.It Va ETCUPDATE
|
||||
Whether to run
|
||||
.Xr etcupdate 8
|
||||
as part of an automated upgrade.
|
||||
You may want to disable this because this is the only interactive step in the
|
||||
upgrade process.
|
||||
.Pp
|
||||
If set to false, the
|
||||
.Sq auto
|
||||
subcommand will skip this step.
|
||||
In this case, you are also recommended to set
|
||||
.Va AUTOCLEAN
|
||||
to
|
||||
.Sq no
|
||||
so that you are not required to redownload the distribution files just to run
|
||||
.Xr etcupdate 8
|
||||
later.
|
||||
.Pp
|
||||
Default: yes.
|
||||
.It Va KERNEL
|
||||
Name of the kernel to install.
|
||||
There must be a
|
||||
.Sq netbsd-<KERNEL>.gz
|
||||
file in the release directory matching this name.
|
||||
.Pp
|
||||
If this is set to the magic value
|
||||
.Sq AUTO ,
|
||||
.Xr sysupgrade 8
|
||||
will attempt to automatically determine the name of the current kernel by using
|
||||
.Xr config 1
|
||||
on
|
||||
.Pa <DESTDIR>/netbsd .
|
||||
If the guessing fails, an error is raised to prevent installing a mismatching
|
||||
kernel.
|
||||
.Pp
|
||||
Default: AUTO.
|
||||
.It Va POSTINSTALL_AUTOFIX
|
||||
Whitespace-separated list of
|
||||
.Xr postinstall 8
|
||||
checks that will be unconditionally fixed as part of an upgrade.
|
||||
.Pp
|
||||
It is recommended that you include
|
||||
.Sq obsolete
|
||||
in this list at the very least: this check often fails because it is common for
|
||||
newer releases to drop existing files, and fixing it should be harmless.
|
||||
Note that old shared libraries are never cleaned by this check, so existing
|
||||
third-party binaries should not stop working even after auto-fixing this check.
|
||||
.Pp
|
||||
Default: empty.
|
||||
.It Va RELEASEDIR
|
||||
Location of the release directory (which must hold a
|
||||
.Pa binary/sets/
|
||||
subdirectory).
|
||||
This can be either a local path or a URL.
|
||||
.Pp
|
||||
If the location is a URL, any of the HTTP, FTP or SSH protocols are supported.
|
||||
In the case of SSH, the URL takes the form:
|
||||
.Sq ssh://[user[:password]@]<host>/<absolute_path> ,
|
||||
which is different to the syntax accepted by
|
||||
.Xr scp 1 .
|
||||
.Pp
|
||||
Default: not set.
|
||||
.It Va SETS
|
||||
Whitespace-separated list of distribution sets to install.
|
||||
If this is set to the magic value
|
||||
.Sq AUTO ,
|
||||
the list of sets is determined from the files in
|
||||
.Pa <DESTDIR>/etc/mtree .
|
||||
.Pp
|
||||
This list cannot include any
|
||||
.Sq kern-*
|
||||
sets; the kernel to be installed is determined by the
|
||||
.Va KERNEL
|
||||
variable.
|
||||
.Pp
|
||||
The presence of any configuration sets (such as
|
||||
.Sq etc
|
||||
or
|
||||
.Sq xetc )
|
||||
in this list enables the etcupdate and postinstall steps in the automated
|
||||
upgrade procedure.
|
||||
.Pp
|
||||
The presence of a modules set enables the modules step in the automated upgrade
|
||||
procedure.
|
||||
.Pp
|
||||
Default: AUTO.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr sysupgrade 8
|
||||
## What it is
|
||||
|
||||
--- default.conf as shipped ---
|
||||
# $NetBSD: default.conf,v 1.2 2012/10/11 00:16:46 jmmv Exp $
|
||||
The README's own sentence: "sysupgrade is a script to automate NetBSD system
|
||||
upgrades. sysupgrade works by first fetching distribution sets from a
|
||||
specified site or local directory, then by upgrading the system using such
|
||||
distribution sets and later by ensuring that the system configuration is up to
|
||||
date."
|
||||
|
||||
# Configuration of automatic system upgrades by sysupgrade(8).
|
||||
#
|
||||
# See sysupgrade.conf(5) for details on the syntax of this file and the
|
||||
# meaning of the configuration variables. Note that not all the supported
|
||||
# configuration variables are listed in this sample configuration file.
|
||||
It is a shell script over `shtk` (`shtk_import cli|config|list|process`,
|
||||
`sysupgrade.sh:35-38`); `shtk` is installed with it
|
||||
(`/usr/pkg/bin/shtk`, `/usr/pkg/share/shtk/*.subr` in the destdir). It does
|
||||
nothing of its own: it fetches, untars, and calls `config(1)`, `etcupdate`
|
||||
and `postinstall`.
|
||||
|
||||
# Path to the release files (local path or remote URL).
|
||||
#RELEASEDIR="ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-6.0/$(uname -m)"
|
||||
#RELEASEDIR="ssh://me@builder.example.net/home/sysbuild/release/$(uname -m)"
|
||||
RELEASEDIR="/home/sysbuild/release/$(uname -m)"
|
||||
## The interface
|
||||
|
||||
# Name of the kernel to be installed.
|
||||
KERNEL=AUTO # Guess from /netbsd (requires config(1)).
|
||||
Commands (`sysupgrade.sh:481-492`, `sysupgrade.8`): `auto`, `fetch`,
|
||||
`modules`, `kernel`, `sets`, `etcupdate`, `postinstall`, `clean`, `config`.
|
||||
Global options: `-c CONFIG_FILE` (default
|
||||
`/usr/pkg/etc/sysupgrade.conf`, `sysupgrade.sh:454`), `-d DESTDIR` (upgrade a
|
||||
non-live system; `etcupdate` is never run with it), `-o VAR=VALUE` (override
|
||||
one configuration variable).
|
||||
|
||||
# Whitespace-separated list of sets to install.
|
||||
SETS=AUTO # Guess from /etc/mtree/set.* files.
|
||||
`auto` is the whole procedure, in this order (`sysupgrade.sh:432-437`):
|
||||
|
||||
# Whitespace-separated list of postinstall(8) checks to automatically fix.
|
||||
POSTINSTALL_AUTOFIX="obsolete"
|
||||
fetch modules kernel sets [etcupdate] postinstall [clean]
|
||||
|
||||
# Whether to run etcupdate or not as part of an upgrade.
|
||||
#
|
||||
# Running etcupdate is the only interactive step in the upgrade process, so
|
||||
# setting this variable to 'no' effectively makes upgrades unattended. You
|
||||
# can later run etcupdate at a later step by hand.
|
||||
#ETCUPDATE=no
|
||||
`etcupdate` is skipped when `ETCUPDATE=no`; `clean` when `AUTOCLEAN=no` (both
|
||||
default yes, `sysupgrade.sh:58-66`).
|
||||
|
||||
# Whether to delete the downloaded files after an upgrade or not.
|
||||
#
|
||||
# If you set ETCUPDATE=no, you will most likely want to disable
|
||||
# auto-cleaning as well. The reason for this is that, if you want to later
|
||||
# do "sysupgrade etcupdate" using the same etc.tgz file downloaded during
|
||||
# the upgrade, you will need the same etc.tgz file to be present.
|
||||
#AUTOCLEAN=no
|
||||
Configuration variables (`sysupgrade.sh:41-43`, plus ARCHIVE_EXTENSION from
|
||||
pkgsrc's patch): `AUTOCLEAN`, `CACHEDIR`, `DESTDIR`, `ETCUPDATE`, `KERNEL`,
|
||||
`POSTINSTALL_AUTOFIX`, `RELEASEDIR`, `SETS`, `ARCHIVE_EXTENSION`.
|
||||
|
||||
## Where it fetches, and what RELEASEDIR means
|
||||
|
||||
`sysupgrade_fetch` builds its file list as
|
||||
`binary/sets/<set>.<ARCHIVE_EXTENSION>` and
|
||||
`binary/kernel/netbsd-<KERNEL>.gz` under `RELEASEDIR`
|
||||
(`sysupgrade.sh:194-199`). **RELEASEDIR is the architecture directory of a
|
||||
release, not the sets directory**: for this tree's release directory that is
|
||||
`build/obj/releasedir/amd64` (measured 2026-11-15:
|
||||
`build/obj/releasedir/amd64/binary/sets/` holds 24 `*.tar.xz` sets and
|
||||
`binary/kernel/netbsd-GENERIC.gz`).
|
||||
|
||||
Accepted forms of RELEASEDIR (`sysupgrade.sh:201-260`):
|
||||
|
||||
- an **absolute path** (`/*`): the files are symlinked into the cache
|
||||
(`ln -s -f`, `:252`); nothing is copied;
|
||||
- `ftp://`, `http://` (upstream) and `https://` (pkgsrc's patch,
|
||||
`patch-sysupgrade.sh`: `ftp://*|http://*|https://*)`) -- downloaded with
|
||||
`ftp(1)` into the cache (`:215`);
|
||||
- `ssh://` -- `scp`, one call with a brace expression (`:225-243`).
|
||||
|
||||
Anything else stops with "Don't know how to fetch from ${releasedir}; must be
|
||||
an absolute path or an FTP/HTTP site" (`:258-259`). **`file://` is not
|
||||
supported by sysupgrade itself.** GOAL.md's decision (a URL, `file://`
|
||||
allowed) therefore has to be translated by our command: `file:///x` becomes
|
||||
the absolute path `/x` before sysupgrade sees it.
|
||||
|
||||
The cache is `CACHEDIR`, default `${VARBASE}/cache/sysupgrade`
|
||||
(`sysupgrade.sh:48`); pkgsrc configures `SYSUPGRADE_CACHEDIR=/var/cache/sysupgrade`
|
||||
and creates it 0755 (`pkgsrc/sysutils/sysupgrade/Makefile:21-26`).
|
||||
|
||||
`ARCHIVE_EXTENSION` is pkgsrc's addition (`patch-sysupgrade.sh`, PR pkg/53697):
|
||||
`tar.xz` on `x86_64` and `sparc64`, `tgz` elsewhere
|
||||
(`patch-sysupgrade.sh`, hunk at `sysupgrade.sh:70`). The tree's sets are
|
||||
`*.tar.xz` (above), so amd64 needs no override.
|
||||
|
||||
## KERNEL=AUTO does not work on Makronix (measured)
|
||||
|
||||
With `KERNEL=AUTO` (the default) the script asks `config(1)` for the kernel's
|
||||
name: `config -x /netbsd | head -n 1 | cut -d '"' -f 2`
|
||||
(`sysupgrade.sh:79-86`), and stops with "Failed to determine kernel name;
|
||||
please set KERNEL explicitly" when that gives nothing.
|
||||
|
||||
`config(1)` is **not installed** in this tree: `./usr/sbin/config` is
|
||||
`comp-obsolete obsolete` in `src/distrib/sets/lists/comp/mi:4719-4720`, and
|
||||
there is no `build/obj/destdir.amd64/usr/sbin/config` (measured 2026-11-15).
|
||||
So on a Makronix system `KERNEL` must be set explicitly (amd64: `GENERIC`, the
|
||||
name of `binary/kernel/netbsd-GENERIC.gz`), or `config` would have to be
|
||||
shipped. Do not leave `AUTO` in our configuration: it fails, it does not
|
||||
silently skip the kernel.
|
||||
|
||||
## SETS=AUTO and the makronix set
|
||||
|
||||
With `SETS=AUTO` the set names come from the files in `/etc/mtree/set.*`
|
||||
(`sysupgrade.sh:93-99`). Measured: `build/obj/destdir.amd64/etc/mtree/` holds
|
||||
`set.base`, `set.base32`, `set.comp`, `set.etc`, `set.games`, `set.gpufw`,
|
||||
`set.makronix`, `set.man`, `set.manhtml`, `set.misc`, `set.modules`,
|
||||
`set.rescue`, `set.tests`, `set.text`, `set.xbase`, `set.xcomp`, `set.xetc`,
|
||||
`set.xfont`, `set.xserver`. **`set.makronix` is among them**, so `auto` also
|
||||
fetches and unpacks `binary/sets/makronix.tar.xz`: MCDE, vim, git and the rest
|
||||
of the set are upgraded with the base system. That is the wanted behaviour for
|
||||
t0055; registering those files as packages (so `pkg_add -u` sees them) is
|
||||
t0056's separate question.
|
||||
|
||||
`sets` never extracts `*etc` (etcupdate's job) and refuses a `kern-*` set in
|
||||
SETS (`sysupgrade.sh:322-334`); the kernel comes from `kernel`.
|
||||
|
||||
## etcupdate and postinstall
|
||||
|
||||
Both are called with the fetched `*etc` sets as `-s` flags, and only when `etc`
|
||||
is in SETS (`sysupgrade.sh:352-408`). `etcupdate` runs `etcupdate -a -l`
|
||||
(:374, absolute `/usr/sbin/etcupdate` through pkgsrc's patch) -- the one
|
||||
interactive step; `POSTINSTALL_AUTOFIX=obsolete` (default) makes `postinstall`
|
||||
fix first (:402) and then `check` (:405, absolute `/usr/sbin/postinstall`).
|
||||
With `DESTDIR` set, etcupdate is skipped and postinstall gets `-d`.
|
||||
|
||||
## The configuration file must exist
|
||||
|
||||
`shtk_config_load` stops with "Configuration file ... does not exist"
|
||||
(`share/shtk/config.subr:176-181` in the destdir). pkgsrc ships the example as
|
||||
`/usr/pkg/share/examples/sysupgrade/default.conf` and would copy it to
|
||||
`/usr/pkg/etc/sysupgrade.conf` through `CONF_FILES` -- a **pkg_add** action.
|
||||
Measured 2026-11-15: the makronix set (unpacked with its METALOG, not
|
||||
`pkg_add`) carries
|
||||
`build/obj/destdir.amd64/usr/pkg/share/examples/sysupgrade/default.conf` and
|
||||
**no** `/usr/pkg/etc/sysupgrade.conf`. So `sysupgrade auto DIR` on an
|
||||
installed Makronix fails today with "Configuration file
|
||||
/usr/pkg/etc/sysupgrade.conf does not exist" unless the caller passes `-c` a
|
||||
file of its own. The pkgsrc default in the example names the NetBSD daily
|
||||
snapshot site (`patches/patch-default.conf`), which is not our source.
|
||||
|
||||
## Nothing is verified
|
||||
|
||||
The fetch uses `ftp(1)` and the extraction is `progress -zf FILE | tar -xp -C
|
||||
DESTDIR/` (`sysupgrade.sh:177`, `tar -xJp` for `tar.xz` in pkgsrc's patch); no
|
||||
checksum and no signature of a set is checked. The release writes
|
||||
`SHA512`/`MD5` next to the sets; nothing in sysupgrade reads them. That is
|
||||
t0078's business (`docs/reference/update-verification.txt`).
|
||||
|
||||
## Our sysupgrade is the NetBSD package, unpatched
|
||||
|
||||
`packages.list:46-48` takes `sysutils/sysupgrade` as a binary of the `makronix`
|
||||
set (`bin`), "unpatched, as the NetBSD project builds it", and names this
|
||||
file. Measured in the destdir: `/usr/pkg/sbin/sysupgrade` (17447 bytes) and
|
||||
`shtk` with its `share/shtk` modules. The command of t0055 therefore wraps
|
||||
this program (a `-c` file of our own, RELEASEDIR translated from `file://` to
|
||||
a path, `KERNEL` explicit); it does not reimplement it.
|
||||
|
||||
## Not measured
|
||||
|
||||
An actual `sysupgrade auto` run on an installed Makronix (no VM run has done
|
||||
it). The time of an upgrade, what etcupdate asks in this tree's
|
||||
`/etc`, and the encrypted-root hook of `docs/UPDATING.md` ("the gap") are open.
|
||||
|
||||
<!-- License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. -->
|
||||
Reference in new issue
Block a user