Bug 283229 - Cannot binary update a 14.2-RELEASE jail
Summary: Cannot binary update a 14.2-RELEASE jail
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.2-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-09 21:25 UTC by Joel Bodenmann
Modified: 2026-05-11 00:14 UTC (History)
4 users (show)

See Also:
linimon: mfc-stable14?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joel Bodenmann freebsd_committer freebsd_triage 2024-12-09 21:25:25 UTC
On a 14.2-STABLE host (commit 0ff2b4a85b66d5fb8cf526a47c6367671bc2bc42), I just created a 14.2-RELEASE jail. As per the usual workflow, I tried to freebsd-update it. However, that didn't go all that well. freebsd-update complained that it cannot upgrade from a version that is not a release.

Steps:

# fetch https://download.freebsd.org/ftp/releases/amd64/amd64/14.2-RELEASE/base.txz -o /usr/local/jails/media/14.2-RELEASE-base.txz

# tar -xf /usr/local/jails/media/14.2-RELEASE-base.txz -C /usr/local/jails/templates/14.2-RELEASE --unlink

# freebsd-update -b /usr/local/jails/templates/14.2-RELEASE/ fetch install
src component not installed, skipped
freebsd-update: Cannot upgrade from a version that is not a release
(including alpha, beta and release candidates)
using freebsd-update. Instead, FreeBSD can be directly
upgraded by source or upgraded to a RELEASE/RELENG version
prior to running freebsd-update.
Currently running: 14.2-STABLE
Comment 1 Dave Cottlehuber freebsd_committer freebsd_triage 2024-12-09 22:13:27 UTC
thanks Joel.

I'm not sure that freebsd-update is supported in this way. I'll let
others chime in on that.

> doas freebsd-update -r 14.2-RELEASE -b /tmp/stuff upgrade
src component not installed, skipped
freebsd-update: Cannot upgrade from a version that is not a release
(including alpha, beta and release candidates)
using freebsd-update. Instead, FreeBSD can be directly
upgraded by source or upgraded to a RELEASE/RELENG version
prior to running freebsd-update.
Currently running: 15.0-CURRENT

For your use case instead, use the jail-specific functionality built into fbsd-update:

e.g. for a jail called stuff:

# freebsd-update -r 14.2-RELEASE -j stuff upgrade

- used a 14.1-RELEASE jail
- from a 15.0-CURRENT host
- to update to 14.2-RELEASE
- and then again to patch to p0

# freebsd-update -r 14.2-RELEASE -j stuff upgrade
# freebsd-update -r 14.2-RELEASE -j stuff install
# freebsd-update -j stuff install
# freebsd-update -j stuff fetch install
...
No updates needed to update system to 14.2-RELEASE-p0.
No updates are available to install.

If the directory you want to upgrade is not an active jail, either jail
it ;-) or run the upgrade within the jail dir as chroot.
Comment 2 Joel Bodenmann freebsd_committer freebsd_triage 2024-12-09 23:04:49 UTC
I'm confused... I got this straight out of the handbook, section 17.5.1.

Both my intention and the intention of the handbook seems to update the base before you actually create a jail.

> Once the update is finished, the template is ready.

Should this PR become a docs@ PR instead then?
Comment 3 Dave Cottlehuber freebsd_committer freebsd_triage 2024-12-10 07:02:05 UTC
I think we should allow freebsd-update to handle this case, but I'll
wait for  clarification from cperciva et al before looking into it.
Comment 4 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2024-12-10 13:30:01 UTC
`freebsd-update` assumes that the system it's updating matches the kernel it's running on.  If that is not the case, you need to pass the correct version using the `--currently-running` option, as described in the documentation.
Comment 5 Joel Bodenmann freebsd_committer freebsd_triage 2024-12-10 13:43:47 UTC
Thank you for your inputs, guys.
Using --currently-running I got the expected behavior/output:


# freebsd-update --currently-running 14.2-RELEASE -b /usr/local/jails/templates/14.2-RELEASE/ fetch install
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching public key from update1.freebsd.org... done.
Fetching metadata signature for 14.2-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 14.2-RELEASE-p0.
No updates are available to install.


As per my understanding, this is therefore neither a bug nor a mistake in the handbook but rather just lack of understanding on my end. Therefore, I'm closing this PR.

Thank you!
Comment 6 Dave Cottlehuber freebsd_committer freebsd_triage 2024-12-10 13:48:24 UTC
I'll add this to the handbook in the spot you mentioned.
Comment 7 Ed Maste freebsd_committer freebsd_triage 2024-12-10 13:52:32 UTC
Proposed an error for this case (-b without --currently-running/UNAME_r): https://reviews.freebsd.org/D48016
Comment 8 crest 2024-12-16 12:06:00 UTC
(In reply to Joel Bodenmann from comment #0)
I think your problem is that freebsd-update by default takes the system to expect as installed from kernel via sysctls which is FreeBSD 14-stable. You have to either override that with arguments/environment variables or run it inside a jail with osversion and osreldate set to the jail userland version. Also as of today there is no FreeBSD 14.2 patch to update to (yet). If you upgrade a jail like that e.g. from 14.1 to 14.2 you have to modify the two version parameters afterward.
Comment 9 commit-hook freebsd_committer freebsd_triage 2026-02-11 15:46:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=097458ac665db732cc91a22279da4cc14f694da2

commit 097458ac665db732cc91a22279da4cc14f694da2
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-12-10 13:47:34 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-02-11 15:44:45 +0000

    freebsd-update: Error for -b basedir without UNAME_r set

    freebsd-update sets the currently running release from UNAME -r, which
    can be overridden via the --currently-running commandline option (or by
    setting UNAME_r in the environment).  This may be invalid if -b is used
    to specify a basedir other than /, so error out if -b is specified
    without setting the currently running version.

    PR:             283229
    Reviewed by:    cperciva
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D48016

 usr.sbin/freebsd-update/freebsd-update.sh | 4 ++++
 1 file changed, 4 insertions(+)
Comment 10 commit-hook freebsd_committer freebsd_triage 2026-02-27 20:00:13 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d37214da968b8f381e7b67f80607e0865d873f5e

commit d37214da968b8f381e7b67f80607e0865d873f5e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-12-10 13:47:34 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-02-27 19:59:04 +0000

    freebsd-update: Error for -b basedir without UNAME_r set

    freebsd-update sets the currently running release from UNAME -r, which
    can be overridden via the --currently-running commandline option (or by
    setting UNAME_r in the environment).  This may be invalid if -b is used
    to specify a basedir other than /, so error out if -b is specified
    without setting the currently running version.

    PR:             283229
    Reviewed by:    cperciva
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D48016

    (cherry picked from commit 097458ac665db732cc91a22279da4cc14f694da2)

 usr.sbin/freebsd-update/freebsd-update.sh | 4 ++++
 1 file changed, 4 insertions(+)