Re: PKGBASE Removes FreeBSD Base System Feature

From: Don Lewis <truckman_at_FreeBSD.org>
Date: Tue, 12 Aug 2025 05:07:30 UTC
On 11 Aug, Jamie Landeg-Jones wrote:
> Charles Sprickman <spork@bway.net> wrote:
>=20
>> > On Aug 10, 2025, at 4:47=E2=80=AFAM, Don Lewis <truckman@FreeBSD.org> =
wrote:
>> >=20
>> > On  8 Aug, Jamie Landeg-Jones wrote:
>> >> all the ports, and then BATCH rebuild them from a list of previously
>> >> installed ports.
>> >>=20
>> >=20
>> > It looks like you are making extra work for youself.  When you
>> > "pkg delete -af", you are erasing all the data about which ports you
>> > carefully chosen to install and whether they were manually our
>> > automatically installed.  You need to record this info somewhere befor=
e
>> > you "pkg delete".
>>
>> I don't think he stated that he doesn't have a list of ports/pkgs that a=
re wanted.
>=20
> Yep! As I even wrote! :-) , I batch rebuild them from a list - rather, I =
have
> a script that parses a pkg list, and creates a script to install the port=
s
> fresh. (I build from ports not packages) The script does hard code a prio=
rity
> install order of ports if necessary - i.e. on machines I use the ports ve=
rsion
> of openssl, that's the port the script installs first. I think if openssh=
 from
> ports was installed, that is next, and a few other similar examples.
>=20
> I don't do this process for all upgrades, just the times I want to do a
> complete rebuild, usually after a major release upgrade.
>=20
> After doing a pkg delete -af I then check /usr/local for orphaned files
> etc. and make it clean before running the script.
>=20
> The script first runs through all the ports to check for config option ch=
anges
> (I still have the previous settings in /var/db/ports) and then when they =
are
> done, it runs through the install in BATCH=3DYES mode.
>=20
>> Deleting everything, and then just adding the 4 or 5 things you want (wh=
ich would end up with many more than 4-5 pkgs installed) is a pretty foolpr=
oof way to clean up a bunch of cruft. Unless of course your base OS also go=
es away.=20
>=20
> Exactly! After cleaning the system, before running the script, I prune th=
e
> list of ports I know I don't want, or are just dependencies. Any that are
> only there as dependencies will get built again anyway. It's a nice, and
> as you say, pretty foolproof way of cleaning things up. It's also quite
> a fast operation - well, the actual ports install takes a while, but that
> happens without me needing to be around.
>=20
> Finally, any errors/failed installs are highlighted at the end of the scr=
ipt
> for manual selection.

I use poudriere to pre-build my desired package set on a headless box
running -CURRENT before starting the upgrade.  It's now close to 24
hours for a full build of my package set.  That way, I don't bog down my
desktop while the build is in progress, and I can defer the upgrade if
anything vital fails to build.  I don't have to worry about getting
stuck in a half-upgraded state.  My only downtime is during pkg upgrade.

If you use "pkg prime-origins" to get the list of ports, that is lot
smaller set to sort through.

> I like to use pkg delete -af because I want to catch orphaned files, but =
bluntly,
> I could just save /usr/local/etc and nuke the rest of /usr/local and /var=
/db/pkg

Any thoughts on how to do the same housecleaning on the base system?

> Thanks for the reply, cheers, Jamie
>=20
>>