Skip to content

make minor & major version upgrades easy#2674

Merged
bapt merged 2 commits into
freebsd:mainfrom
skunkwerks:feature/expose-version
May 13, 2026
Merged

make minor & major version upgrades easy#2674
bapt merged 2 commits into
freebsd:mainfrom
skunkwerks:feature/expose-version

Conversation

@dch
Copy link
Copy Markdown
Contributor

@dch dch commented May 9, 2026

This simplifies base system package upgrades enormously for the
bulk of users, who have not configured custom repositories, and
makes intuitive use of the obvious VERSION_MINOR var found in both
/etc/pkg/FreeBSD.conf and /usr/local/etc/pkg.conf to allow
the user to go from 15.0-RELEASE to 15.1, and in future to 16.0:

pkg -o VERSION_MINOR=1 upgrade -r FreeBSD-base
...

Alternatively, we could allow OSVERSION by itself to assume same
ABI as the running system, but this requires users to figure out
what OSVERSION should be, and isn't as nice for major version
upgrades.

  • OSVERSION on its own does not work
dch@akai /r/pkg> pkg  -oOSVERSION=1501000 repos |grep release
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:amd64/base_release_0",
  • needs the ABI as well, not nice UX
dch@akai /r/pkg> pkg -oABI=FreeBSD:15:amd64 -oOSVERSION=1501000 repos |grep release
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:amd64/base_release_1",
  • with patch applied
dch@akai /r/pkg> /repos/pkg/src/pkg-static -oVERSION_MINOR=1 repos |grep release
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:amd64/base_release_1",

dch added 2 commits May 9, 2026 07:34
This simplifies base system package upgrades enormously for the
bulk of users, who have not configured custom repositories:

pkg -o VERSION_MINOR=1 upgrade -r FreeBSD-base

Allows a user to go from 15.0-RELEASE to 15.1.
@dch
Copy link
Copy Markdown
Contributor Author

dch commented May 9, 2026

I will add a test & docs today

@dch
Copy link
Copy Markdown
Contributor Author

dch commented May 9, 2026

example upgrade:

$ doas ./src/pkg-static -oVERSION_MINOR=1 upgrade -r FreeBSD-base
Updating FreeBSD-base repository catalogue...
pkg-static: Repository FreeBSD-base has a wrong packagesite, need to re-create database
Fetching meta.conf: 100%     179 B   0.2 kB/s    00:01
Fetching data: 100%    82 KiB  84.4 kB/s    00:01
Processing entries:   0%
Newer FreeBSD version for package FreeBSD-xz:
To ignore this error set IGNORE_OSVERSION=yes
- package: 1501000
- running userland: 1500068
Ignore the mismatch and continue? [y/N]: y
Processing entries: 100%
FreeBSD-base repository update completed. 509 packages processed.
FreeBSD-base is up to date.
Checking for upgrades (183 candidates): 100%
Processing candidates (183 candidates): 100%
The following 188 package(s) will be affected (of 0 checked):
...

@concussious
Copy link
Copy Markdown
Contributor

I haven't looked at the patch yet but that workflow looks great to me!

@vermaden
Copy link
Copy Markdown
Contributor

Not sure if that helps but these methods worked for me:

Regards,
vermaden

Comment thread docs/pkg-upgrade.8
Comment on lines +220 to +223
To upgrade base system packages from 15.0-RELEASE to 15.1-RELEASE using
the FreeBSD-base repository:
.Pp
.Dl pkg -o VERSION_MINOR=1 upgrade -r FreeBSD-base
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To upgrade base system packages from 15.0-RELEASE to 15.1-RELEASE using
the FreeBSD-base repository:
.Pp
.Dl pkg -o VERSION_MINOR=1 upgrade -r FreeBSD-base
To upgrade the base system and non-base kernel modules from 15.0-RELEASE
to 15.1-RELEASE:
.Pp
.Dl pkg -o VERSION_MINOR=1 upgrade -r FreeBSD-base -r FreeBSD-ports-kmods

The word packages is superfluous (from the Description and other parts of the page, it's clear enough that packages are involved).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one does not upgdade from 15.0 to 15.1 ...

root@freebsd:~ # pkg -o VERSION_MINOR=1 upgrade -r FreeBSD-base
Updating FreeBSD-base repository catalogue...
pkg: Repository FreeBSD-base has a wrong packagesite, need to re-create database
Fetching meta.conf: 100%    179 B   0.2kB/s    00:01    
Fetching data.pkg: 100%   80 KiB  82.2kB/s    00:01    
Processing entries: 100%
FreeBSD-base repository update completed. 496 packages processed.
FreeBSD-base is up to date.
Checking for upgrades (22 candidates): 100%
Processing candidates (22 candidates): 100%
The following 22 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        FreeBSD-blocklist: 15.0 -> 15.0p3 [FreeBSD-base]
        FreeBSD-clibs-dev: 15.0 -> 15.0p6 [FreeBSD-base]
        FreeBSD-devmatch: 15.0 -> 15.0p2 [FreeBSD-base]
        FreeBSD-dhclient: 15.0 -> 15.0p8 [FreeBSD-base]
        FreeBSD-kernel-generic: 15.0 -> 15.0p8 [FreeBSD-base]
        FreeBSD-librpcsec_gss: 15.0 -> 15.0p5 [FreeBSD-base]
        FreeBSD-librpcsec_gss-dev: 15.0 -> 15.0p5 [FreeBSD-base]
        FreeBSD-librpcsec_gss-dev-lib32: 15.0 -> 15.0p5 [FreeBSD-base]
        FreeBSD-librpcsec_gss-lib32: 15.0 -> 15.0p5 [FreeBSD-base]
        FreeBSD-openssl: 15.0 -> 15.0p2 [FreeBSD-base]
        FreeBSD-openssl-dev: 15.0 -> 15.0p2 [FreeBSD-base]
        FreeBSD-openssl-dev-lib32: 15.0 -> 15.0p2 [FreeBSD-base]
        FreeBSD-openssl-lib: 15.0 -> 15.0p2 [FreeBSD-base]
        FreeBSD-openssl-lib32: 15.0 -> 15.0p2 [FreeBSD-base]
        FreeBSD-pf: 15.0 -> 15.0p5 [FreeBSD-base]
        FreeBSD-rescue: 15.0 -> 15.0p8 [FreeBSD-base]
        FreeBSD-runtime: 15.0 -> 15.0p8 [FreeBSD-base]
        FreeBSD-runtime-dev: 15.0 -> 15.0p7 [FreeBSD-base]
        FreeBSD-runtime-dev-lib32: 15.0 -> 15.0p7 [FreeBSD-base]
        FreeBSD-runtime-lib32: 15.0 -> 15.0p7 [FreeBSD-base]
        FreeBSD-utilities: 15.0 -> 15.0p1 [FreeBSD-base]
        FreeBSD-zoneinfo: 15.0 -> 15.0p7 [FreeBSD-base]

Number of packages to be upgraded: 22

115 MiB to be downloaded.

Comment thread docs/pkg-upgrade.8
Comment on lines +227 to +228
variable used in repository URL expansion, allowing the repository URL
to resolve to the 15.1 package set.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
variable used in repository URL expansion, allowing the repository URL
to resolve to the 15.1 package set.
variable used in repository URL expansion, allowing use of the repos
for 15.1.

@bapt bapt merged commit 3b89fa9 into freebsd:main May 13, 2026
7 of 8 checks passed
@dch
Copy link
Copy Markdown
Contributor Author

dch commented May 14, 2026

@vermaden AFAICT it works here:

> uname -a
FreeBSD a04.cabal5.net 15.0-RELEASE-p8 FreeBSD 15.0-RELEASE-p8 releng/15.0-n281036-53054229dcb3 GENERIC arm64
> git clone https://github.com/freebsd/pkg -b main ~/src/pkg
> cd ~/src/pkg
> ./autogen.sh && ./configure --mandir=/usr/local/share/man && make clean && make -j2.0 && doas make install
root@a04 /h/d/s/pkg# pkg-static -v
2.7.99.1-3b89fa92e
root@a04 /h/d/s/pkg# pkg -d repos |grep base_
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:aarch64/base_release_0",
root@a04 /h/d/s/pkg# pkg -d -o VERSION_MINOR=1 repos |grep base_
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:aarch64/base_release_1",

root@a04 /h/d/s/pkg# pkg-static -o VERSION_MINOR=1 upgrade -r FreeBSD-base
Updating FreeBSD-base repository catalogue...
pkg-static: Repository FreeBSD-base has a wrong packagesite, need to re-create database
Fetching meta.conf: 100%     179 B   0.2 kB/s    00:01
Fetching data: 100%    81 KiB  83.3 kB/s    00:01
Processing entries:   0%
Newer FreeBSD version for package FreeBSD-zlib-lib32:
To ignore this error set IGNORE_OSVERSION=yes
- package: 1501000
- running userland: 1500068
Ignore the mismatch and continue? [y/N]: y
...
        FreeBSD-zlib: 15.0 -> 15.1.b2.20260508031406 [FreeBSD-base]
        FreeBSD-zlib-dev: 15.0 -> 15.1.b2.20260508031406 [FreeBSD-base]
        FreeBSD-zoneinfo: 15.0p7 -> 15.1.b2.20260508031406 [FreeBSD-base]

Number of packages to be installed: 6
Number of packages to be upgraded: 203

The operation will free 8 MiB.
195 MiB to be downloaded.

Proceed with this action? [y/N]:

If this still fails for you, lets move it to a new issue and add me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants