Re: Some simple/basic things that do not work during or after "pkg delete -a" in a PkgBase based chroot

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sun, 11 May 2025 23:55:09 UTC
On May 11, 2025, at 15:41, Mark Millard <marklmi@yahoo.com> wrote:
> 
> On May 11, 2025, at 15:09, Mark Millard <marklmi@yahoo.com> wrote:
> 
>> Inside a PkgBase based chroot I did:
>> 
>> # pkg delete -a 2>&1 | tee ~/pkg-del-a.txt
>> 
>> After that pkg (dynamic) no longer works:
>> 
>> # pkg info pkg
>> ld-elf.so.1: Shared object "libarchive.so.7" not found, required by "pkg"
>> 
>> By contrast, "pkg-static info pkg" still works. But
>> any scripting that uses pkg instead of pkg-static
>> would be broken for the pkg usage.
>> 
>> Also, when I tried to summarize some error
>> messages, I found uniq was not present:
>> 
>> # grep "cannot open" ~/pkg-del-a.txt | sort | uniq -c
>> /bin/sh: uniq: not found
>> 
>> Nor was wc :
>> 
>> # grep "cannot open" ~/pkg-del-a.txt | sort | wc -l
>> /bin/sh: wc: not found
>> 
>> (I can not tell what is expected vs. what is not.
>> So some of the above may well be considered normal
>> and might end up documented to some degree or in
>> some way.)
>> 
>> 
>> During the delete (POST-DEINSTALL notice summary):
>> 
>> Note: I'd only had a few hundred packages installed,
>> so the variety tested is rather limited.
>> 
>> Of note: the port packages were not deleted before the
>> PkgBase system packages were. This ordering seems
>> problematical to me.
>> 
>> # grep -B1 "POST-DEINSTALL" ~/pkg-del-a.txt | sort -u
>> --
>> .: cannot open /etc/rc.subr: No such file or directory
>> pkg: POST-DEINSTALL script failed
>> 
>> 
>> Done from outside the chroot to get an idea of the
>> counts:
>> 
>> # grep -B1 "POST-DEINSTALL" /usr/obj/DESTDIRs/main-armv7-chroot-ports-main-dup/root/pkg-del-a.txt | sort | uniq -c
>> 87 --
>> 88 .: cannot open /etc/rc.subr: No such file or directory
>> 88 pkg: POST-DEINSTALL script failed
>> 
> 
> Looks like there is some more related to
> even pkg-static operation with official
> package distriubtion by FreeBSD (shown
> from inside the chroot after the delete
> -a):
> 
> # ls -loaT /etc/pkg/
> ls: /etc/pkg/: No such file or directory
> 
> So: No FreeBSD repository.
> 
> (I had not created/populated a
> /usr/local/etc/pkg/repos/ so that was untested.)
> 
> 
> poudriere/poudriere-devel side note (mostly):
> 
> # ls -loaT /usr/local/etc/poud*
> ls: /usr/local/etc/poud*: No such file or directory
> 
> # ls -loaT /usr/local/etc/
> total 44
> drwxr-xr-x  4 root  wheel -  1024 May 11 21:49:42 2025 .
> drwxr-xr-x  9 root  wheel -   512 May 11 21:49:42 2025 ..
> drwxr-xr-x  2 root  wheel -   512 May 11 21:49:40 2025 bash_completion.d
> -rw-r--r--  1 root  wheel -   813 Apr 22 21:11:28 2025 mke2fs.conf
> drwxr-xr-x  5 root  wheel -   512 May 11 05:00:15 2025 periodic
> -rw-r--r--  1 root  wheel -  2553 Apr 22 06:00:03 2025 pkg.conf
> -rw-r--r--  1 root  wheel -  2553 Apr 22 06:00:03 2025 pkg.conf.sample
> -rw-r-----  1 cyrus mail  - 16384 May 11 05:12:38 2025 sasldb2.db
> 
> Note: What I started with had:
> 
> # ls -loaT /etc/pkg/ /usr/local/etc/poud*
> -rw-r--r--  1 root wheel - 15545 Apr 27 07:28:10 2025 /usr/local/etc/poudriere.conf
> -rw-r--r--  1 root wheel - 15545 Apr 27 07:28:10 2025 /usr/local/etc/poudriere.conf.sample
> -rw-r--r--  1 root wheel -   655 Apr 27 07:28:10 2025 /usr/local/etc/poudriered.conf
> -rw-r--r--  1 root wheel -   655 Apr 27 07:28:10 2025 /usr/local/etc/poudriered.conf.sample
> 
> /etc/pkg/:
> total 12
> drwxr-xr-x   2 root wheel -  512 May 11 04:44:41 2025 .
> drwxr-xr-x  23 root wheel - 2048 May 11 05:14:39 2025 ..
> -rw-r--r--   1 root wheel -  424 May 11 04:49:51 2025 FreeBSD.conf
> 
> /usr/local/etc/poudriere.d:
> total 12
> drwxr-xr-x   3 root wheel -  512 May 11 05:13:23 2025 .
> drwxr-xr-x  18 root wheel - 1024 May 11 05:16:22 2025 ..
> drwxr-xr-x   2 root wheel -  512 May 11 05:13:23 2025 hooks
> 
> None of that survived.

Of possible note as well:

# pkg-static clean
pkg-static: No active remote repositories configured

# pkg-static help clean
sh: /usr/bin/man: not found

For reference:

# pkg-static info 
FreeBSD-clibs-15.snap20250509235408 Core C Libraries
FreeBSD-runtime-15.snap20250510091134 FreeBSD Base System
pkg-2.1.0                      Package manager

What FreeBSD-clibs provides:

# pkg-static info -b FreeBSD-clibs
FreeBSD-clibs-15.snap20250509235408:
	libc++.so.1
	libc.so.7
	libcxxrt.so.1
	libdl.so.1
	libedit.so.8
	libformw.so.6
	libgcc_s.so.1
	libm.so.5
	libncursesw.so.9
	libpanelw.so.6
	librt.so.1
	libssp.so.0
	libsys.so.7
	libthr.so.3
	libtinfow.so.9

But some of the required list for
FreeBSD-runtime is not covered
( libarchive.so.7 libbsm.so.3
and libcrypto.so.30 are missing ):

# pkg-static info -B FreeBSD-runtime
FreeBSD-runtime-15.snap20250510091134:
	libarchive.so.7
	libbsm.so.3
	libc.so.7
	libcrypto.so.30
	libedit.so.8
	libgcc_s.so.1
	libm.so.5
	libthr.so.3
	libtinfow.so.9

Similarly for what pkg 2.1.0 requires
. . .

But first what FreeBSD-runtime
adds to what is provided:

# pkg-static info -b FreeBSD-runtime
FreeBSD-runtime-15.snap20250510091134:
	lib80211.so.1
	libbsdxml.so.4
	libcam.so.7
	libcap_dns.so.2
	libcap_fileargs.so.1
	libcap_grp.so.1
	libcap_netdb.so.1
	libcap_pwd.so.1
	libcap_sysctl.so.2
	libcap_syslog.so.1
	libcasper.so.1
	libcrypt.so.5
	libelf.so.2
	libgeom.so.5
	libgssapi.so.10
	libipsec.so.4
	libjail.so.1
	libkiconv.so.4
	libkvm.so.7
	libmd.so.7
	libnv.so.1
	libpam.so.6
	libprivatekldelf.so.5
	libprivatezstd.so.5
	libregex.so.1
	librpcsvc.so.5
	libsbuf.so.6
	libutil.so.9
	libxo.so.0
	libypclnt.so.4
	libz.so.6

But  pkg 2.1.0 (dynamic) requires:
( libarchive.so.7 libcrypto.so.30
and libssl.so.30 are missing ):

# pkg-static info -B pkg
pkg-2.1.0:
	libarchive.so.7
	libc.so.7
	libcrypto.so.30
	libelf.so.2
	libgcc_s.so.1
	libjail.so.1
	libm.so.5
	libssl.so.30
	libthr.so.3
	libutil.so.9
	libz.so.6

===
Mark Millard
marklmi at yahoo.com