Bug 290375 - bsdinstall: can't install pkgbase system with installerconfig
Summary: bsdinstall: can't install pkgbase system with installerconfig
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 15.0-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Alan Somers
URL: https://reviews.freebsd.org/D56717
Keywords: install, pkgbase
Depends on:
Blocks:
 
Reported: 2025-10-20 09:41 UTC by Andrey Fesenko
Modified: 2026-06-11 20:11 UTC (History)
6 users (show)

See Also:
asomers: mfc-stable15?
asomers: mfc-stable14-


Attachments
simple add pkgbase (955 bytes, application/x-perl)
2025-10-20 09:41 UTC, Andrey Fesenko
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Fesenko 2025-10-20 09:41:03 UTC
Created attachment 264737 [details]
simple add pkgbase

Simple install script not work now after add pkgbase

bsdinstall script /tmp/installerconfig


  # installerconfig
  export nonInteractive="YES"
  HOSTNAME="freebsd"
  
  BSDINSTALL_PKG_REPOS_DIR="/usr/freebsd-packages/repos/"
  DISTRIBUTIONS=""
  DISKSLICE=vtbd0
  PARTITIONS="$DISKSLICE GPT { auto freebsd-ufs / }"
  
  #!/bin/sh -x

Patch base fixed, but not full non interactive. Need OK in Select System Components
Comment 1 Alan Somers freebsd_committer freebsd_triage 2025-12-12 16:41:20 UTC
This is a good start, but I think there are at least two problems, and maybe four:

* Testing BSDINSTALL_PKG_REPOS_DIR should use "-n": if [ -n "$..." ]

* "bsdinstall pkgbase" and "bsdinstall distextract" should be mutually exclusive.  If the script does the former, then it must skip "bsdinstall checksum" and "bsdinstall pkgbase"

* changing the default value of DISTRIBUTIONS may break existing scripts.  Best to leave it the same.

* "bsdinstall pkgbase" already does something sensible if BSDINSTALL_PKG_REPOS_DIR is unset.  So I don't think that you should require the user to set it.  Rather, to select a pkgbase install, I think you should either require the user to set DISTRIBUTIONS="", or else introduce a new variable.
Comment 2 Jose Luis Duran freebsd_committer freebsd_triage 2026-04-27 19:17:42 UTC
Hey @asomers!

Please tag me if you have a public revision. There is a GSoC project to "Reimagine NanoBSD", one of the goals is to use pre-compiled binaries. The user-facing interface we have decided to adopt is the one from bsdinstall (script) for distribution sets and eyeballed the pkgbase one. I would like to align our implementation with yours (whenever possible).
Comment 3 Alan Somers freebsd_committer freebsd_triage 2026-04-27 19:21:43 UTC
Here is my plan:

* make pkgbase be the default going forward.  Anybody wishing to install with legacy distsets must set PKGBASE="no" in their installerconfig file.  usr.sbin/bsdinstall/scripts/script will check for that variable, and if set, call "bsdinstall pkgbase --non-interactive" 

* Add a "--non-interactive" option to usr.sbin/bsdinstall/scripts/pkgbase.in .  When set, pkgbase.in will not call bsddialog for user input.  Instead, it will select components based on the DISTRIBUTIONS environment variable.

I plan to implement this in time for 15.1-RELEASE .
Comment 4 Slawomir Wojciech Wojtczak 2026-04-27 19:24:34 UTC
This will probably be fixed soon - but if You need solution right now then verimg(8) does that You need - installs PKGBASE FreeBSD w/o any user input ... and is fully customizable both by options and code in the script itself.

- https://github.com/vermaden/verimg

Regards,
vermaden
Comment 5 Jose Luis Duran freebsd_committer freebsd_triage 2026-04-27 20:45:09 UTC
(In reply to Alan Somers from comment #3)

Right, so you plan to map, for example:

DISTRIBUTIONS="base.txz kernel.txz" to FreeBSD-set-base and FreeBSD-set-kernels; a one to one, so to speak? No fancy -minimal or a particular FreeBSD-kernel?

At the moment, we have opted to at least require FreeBSD-set-base or FreeBSD-set-minimal (as the MANDATORY base options) and if a kernel is required (non-jail), some form of FreeBSD-kernel-* (PowerPC kernel names are fun!). Although, we have decided to use a different variable name (this is the information I'm looking to align with your implementation, thank you for the input).

(In reply to Slawomir Wojciech Wojtczak from comment #4)

Thank you, we'll take a look at this implementation as well.
Comment 6 Mark Millard 2026-04-27 23:26:37 UTC
(In reply to Alan Somers  from comment #1 and #3)
(In reply to Jose Luis Duran from comment #5)

A question here is if the support is only for 15.0+ (not,
say, 14.*). For example, 14.* does not have FreeBSD-set-base
or FreeBSD-set-kernels to use. Only 15.* and later have the
Release & Security Engineering class of support for pkgbase
contexts as I understand. 14.*'s draft/unsupported status
for pkgbase relative to Release Engineering lead to 14.* not
being updated to match what was done with 15.0 . In various
places base packages are split up differently.

(This is also visible in standard/official poudriere-devel
not putting any FreeBSD-set-* to use --and over installing
in order to be operational for both 14.* and 15.0+ without
tracking all the details of the differences: there are
hundreds of base packages for either.)
Comment 7 Alan Somers freebsd_committer freebsd_triage 2026-04-27 23:32:12 UTC
(In reply to Jose Luis Duran from comment #5)
> DISTRIBUTIONS="base.txz kernel.txz" to FreeBSD-set-base and FreeBSD-set-kernels; a one to one, so to speak? No fancy -minimal or a particular FreeBSD-kernel?

Yes.  I'm planning to mimic the interactive code as closely as possible.  So minimal or minimal-jail will always be installed, for example.  But if you have a better suggesting for how to specify packages in the installerconfig, I'm all ears.

(In reply to Mark Millard from comment #6)
I don't plan to MFC this to stable/14 at all.
Comment 8 commit-hook freebsd_committer freebsd_triage 2026-05-12 14:14:40 UTC
A commit in branch main references this bug:

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

commit dc14ae4217a0babb1240f813b642edc2d7b955a6
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2026-04-28 17:27:17 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2026-05-12 14:13:16 +0000

    bsdinstall: do pkgbase installations with the "script" command

    "bsdinstall script" will now do a pkgbase installation by default.  The
    system components to install can be specified in the COMPONENTS
    variable, and have the same names as those used in the interactive
    installer.  bsdinstall will still do a legacy distset installation if
    DISTRIBUTIONS is defined in the installerconfig file.

    MFC:            1 week
    PR:             290375
    Sponsored by:   ConnectWise
    Reviewed by:    ziaee, ivy, jduran
    Differential Revision: https://reviews.freebsd.org/D56717

 UPDATING                               |  5 +++
 usr.sbin/bsdinstall/bsdinstall.8       | 45 ++++++++++++++++-----
 usr.sbin/bsdinstall/scripts/pkgbase.in | 15 ++++++-
 usr.sbin/bsdinstall/scripts/script     | 71 ++++++++++++++++++++--------------
 4 files changed, 95 insertions(+), 41 deletions(-)
Comment 9 Alan Somers freebsd_committer freebsd_triage 2026-05-12 14:15:58 UTC
Committed to head.  This should be MFCed to stable/15 and releng/15.1 .  But it's not needed in stable/14, because pkgbase is still experimental in 14.
Comment 10 commit-hook freebsd_committer freebsd_triage 2026-05-13 19:31:52 UTC
A commit in branch stable/15 references this bug:

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

commit 1f5869130f6ebd299e65a627eff23a8c3d360afb
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2026-04-28 17:27:17 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2026-05-13 19:27:34 +0000

    bsdinstall: do pkgbase installations with the "script" command

    "bsdinstall script" will now do a pkgbase installation by default.  The
    system components to install can be specified in the COMPONENTS
    variable, and have the same names as those used in the interactive
    installer.  bsdinstall will still do a legacy distset installation if
    DISTRIBUTIONS is defined in the installerconfig file.

    PR:             290375
    Sponsored by:   ConnectWise
    Reviewed by:    ziaee, ivy, jduran
    Differential Revision: https://reviews.freebsd.org/D56717

    (cherry picked from commit dc14ae4217a0babb1240f813b642edc2d7b955a6)

 UPDATING                               |  5 +++
 usr.sbin/bsdinstall/bsdinstall.8       | 45 ++++++++++++++++-----
 usr.sbin/bsdinstall/scripts/pkgbase.in | 15 ++++++-
 usr.sbin/bsdinstall/scripts/script     | 71 ++++++++++++++++++++--------------
 4 files changed, 95 insertions(+), 41 deletions(-)
Comment 11 commit-hook freebsd_committer freebsd_triage 2026-05-14 19:05:47 UTC
A commit in branch releng/15.1 references this bug:

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

commit cb7880bb09009c977d3fb70a66b0f57f9fbe83ed
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2026-04-28 17:27:17 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-05-14 19:04:21 +0000

    bsdinstall: do pkgbase installations with the "script" command

    "bsdinstall script" will now do a pkgbase installation by default.  The
    system components to install can be specified in the COMPONENTS
    variable, and have the same names as those used in the interactive
    installer.  bsdinstall will still do a legacy distset installation if
    DISTRIBUTIONS is defined in the installerconfig file.

    Approved by:    re (cperciva)
    PR:             290375
    Sponsored by:   ConnectWise
    Reviewed by:    ziaee, ivy, jduran
    Differential Revision: https://reviews.freebsd.org/D56717

    (cherry picked from commit dc14ae4217a0babb1240f813b642edc2d7b955a6)
    (cherry picked from commit 1f5869130f6ebd299e65a627eff23a8c3d360afb)

 UPDATING                               |  5 +++
 usr.sbin/bsdinstall/bsdinstall.8       | 45 ++++++++++++++++-----
 usr.sbin/bsdinstall/scripts/pkgbase.in | 15 ++++++-
 usr.sbin/bsdinstall/scripts/script     | 71 ++++++++++++++++++++--------------
 4 files changed, 95 insertions(+), 41 deletions(-)
Comment 12 Mark Linimon freebsd_committer freebsd_triage 2026-06-11 20:11:10 UTC
^Triage: appears to have been committed and MFCed.