[Bug 296467] pkg upgrade installs unrelated, unnecessary other packages
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 31 Jul 2026 00:02:35 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296467
--- Comment #10 from wbe@psr.com ---
My apologies for taking so long to get back to this ...
===== EXECUTIVE SUMMARY of things of general interest to FreeBSD: =====
* It appears "pkg upgrade -f -r FreeBSD-port $list" did not apply
FreeBSD-port:'s dependencies. Instead, it appears to have used FreeBSD:'s
dependencies, in at least some cases. The result is that pkg is not handling
two repositories with matching/overlapping packages properly.
* Some FreeBSD: packages were not upgraded to FreeBSD-ports:. The reason
appears to be that they're not in FreeBSD-ports:. "pkg autoremove" did not
remove them. Most had no %r dependencies and weren't anything I cared about,
so I uninstalled them.
* Thanks Mark!
===== "Typo"s: =====
in Comment #9:
pkg-status => pkg-static
in Comment #7:
I think you meant `...` instead of $(...):
- pkg upgrade -f $(pkg ... | grep ...)
+ pkg upgrade -f `pkg ... | grep ...`
Including %v when generating the list of packages to upgrade works poorly, so:
- pkg query %R:%n-%v | grep ^FreeBSD:
+ pkg query %R:%n | grep '^FreeBSD:'
===== DETAILS =====
Terminology: "the Conversion" = converting all FreeBSD: packages to
FreeBSD-ports: packages.
1. Before the Conversion
1.1. With both FreeBSD: and FreeBSD-ports: enabled, I saw they both have 38030
packages (though later tests indicated there are differences). Both are
/latest (see earlier comments for the full URLs):
# pkg update
Updating FreeBSD-ports repository catalogue...
Fetching data: 100% 12 MiB 1.2 MB/s 00:11
Processing entries: 100%
FreeBSD-ports repository update completed. 38030 packages processed.
[WBE: Upgrading the schema version of FreeBSD-ports happened a couple days
ago, which is why there's no line saying that here.]
Updating FreeBSD-ports-kmods repository catalogue...
pkg: need to re-create repo FreeBSD-ports-kmods to upgrade schema version
Fetching meta.conf: 100% 179 B 0.2 kB/s 00:01
Fetching data: 100% 35 KiB 35.6 kB/s 00:01
Processing entries: 100%
FreeBSD-ports-kmods repository update completed. 239 packages processed.
Updating FreeBSD repository catalogue...
pkg: need to re-create repo FreeBSD to upgrade schema version
Fetching meta.conf: 100% 168 B 0.2 kB/s 00:01
Fetching data: 100% 12 MiB 979.5 kB/s 00:13
Processing entries: 100%
FreeBSD repository update completed. 38030 packages processed.
Fetching files: 100% 41 MiB 1.1 MB/s 00:40
Processing file entries: 100%
All repositories are up to date.
1.2. Comparison of upgrade -r FreeBSD vs. -r FreeBSD-ports
Not just today, but also when I tried similar tests before, pkg upgrade of a
test package usually gave me different results with -r FreeBSD vs. -r
FreeBSD-ports. Here's an example using firefox as the test. Prior to the
Conversion, firefox was a FreeBSD package.
# pkg upgrade -n -r FreeBSD-ports firefox
Updating FreeBSD-ports repository catalogue...
FreeBSD-ports repository is up to date.
FreeBSD-ports is up to date.
The following 3 package(s) will be affected (of 0 checked):
Installed packages to be UPGRADED:
firefox: 152.0,2 -> 153.0.1_2,2 [FreeBSD-ports]
librsvg2-rust: 2.62.3 -> 2.62.3_1 [FreeBSD-ports]
libxkbcommon: 1.13.1 -> 1.13.2 [FreeBSD-ports]
Number of packages to be upgraded: 3
The operation will free 6 MiB.
85 MiB to be downloaded.
----------
Note: at the time of that command, the FreeBSD-ports version of firefox used
python312, not 311, but upgrade said nothing about that.
# pkg upgrade -n -r FreeBSD firefox
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
FreeBSD is up to date.
The following 30 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
py312-packaging: 26.2 [FreeBSD]
python312: 3.12.13_3 [FreeBSD] (vulnerable!)
Installed packages to be UPGRADED:
aom: 3.14.0 -> 3.14.1_1 [FreeBSD]
firefox: 152.0,2 -> 153.0.1_2,2 [FreeBSD]
graphite2: 1.3.14 -> 1.3.15 [FreeBSD]
harfbuzz: 13.2.1 -> 14.2.1 [FreeBSD]
hwdata: 0.408,1 -> 0.409,1 [FreeBSD]
lame: 3.100_5 -> 4.0 [FreeBSD]
lerc: 4.1.0 -> 4.1.1 [FreeBSD]
libXfixes: 6.0.1 -> 6.0.2 [FreeBSD]
libXrandr: 1.5.4 -> 1.5.5 [FreeBSD]
libXres: 1.2.2_1 -> 1.2.3 [FreeBSD]
libass: 0.17.4_1 -> 0.17.5 [FreeBSD]
libevent: 2.1.12 -> 2.1.13 [FreeBSD]
libffi: 3.5.2 -> 3.7.1 [FreeBSD]
libva: 2.23.0 -> 2.24.1 [FreeBSD]
nss: 3.125 -> 3.126 [FreeBSD]
p11-kit: 0.26.2 -> 0.26.4 [FreeBSD]
pango: 1.56.4_1 -> 1.57.1 [FreeBSD]
pciids: 20260522 -> 20260711 [FreeBSD]
sqlite3: 3.53.1,1 -> 3.53.3,1 [FreeBSD]
svt-av1: 4.1.0 -> 4.2.0 [FreeBSD]
tiff: 4.7.1_1 -> 4.7.2 [FreeBSD]
vmaf: 3.1.0 -> 3.2.0 [FreeBSD]
vulkan-loader: 1.4.354 -> 1.4.356 [FreeBSD]
xkeyboard-config: 2.41_4 -> 2.48 [FreeBSD]
Installed packages to be REINSTALLED:
at-spi2-core-2.60.4 [FreeBSD] (direct dependency changed: python311
(removed), python312 (added))
glib-2.86.4,2 [FreeBSD] (direct dependency changed: py311-packaging
(removed), py312-packaging (added), python311 (removed), python312 (added))
gtk3-3.24.52 [FreeBSD] (direct dependency changed: python311 (removed),
python312 (added))
json-glib-1.10.8 [FreeBSD] (direct dependency changed: python311
(removed), python312 (added))
Number of packages to be installed: 2
Number of packages to be upgraded: 24
Number of packages to be reinstalled: 4
The process will require 218 MiB more space.
163 MiB to be downloaded.
WARNING: 1 package(s) have known vulnerabilities
----------
Note: this upgrade plan is much more complete and deals with the change from
python311 to 312.
2. The Conversion
Mark suggested:
> # pkg upgrade -rFreeBSD-ports -f \
> $(pkg query %R:%n-%v | grep ^FreeBSD: | sed -e 's@^[^:]*:\(.*\)$@\1@')
Running
pkg upgrade -r FreeBSD-ports -f `pkg query %R:%n | grep '^FreeBSD:' | sed -e
's@^[^:]*:\(.*\)$@\1@'`
went smoothly, but didn't convert everything [the "stragglers"]:
# pkg query %R:%n | grep '^FreeBSD:'
FreeBSD:dialog4ports
FreeBSD:gnomehier
FreeBSD:libexecinfo
FreeBSD:libpthread-stubs
FreeBSD:libvolume_id
FreeBSD:mkfile
FreeBSD:py311-numpy
FreeBSD:xf86-video-mach64
FreeBSD:xf86-video-openchrome
FreeBSD:xf86-video-r128
They all appear to be absent from FreeBSD-ports. I checked one:
# pkg query %R:%n py311-numpy
FreeBSD:py311-numpy
# pkg query %rn py311-numpy
Imath
# pkg query %R:%n Imath
FreeBSD-ports:Imath
so Imath from FreeBSD-ports depends on FreeBSD:py311-numpy?! My log files
indicate that Imath was NOT upgraded by the "all FreeBSD: packages" conversion
command.
If there's a way to make pkg query use an alternate database origin (e.g.,
$snapshot/var/db/pkg/), then I can check for sure which repo Imath was in
previously.
Upgrading Imath:
# pkg upgrade -f -r FreeBSD-ports Imath
Updating FreeBSD-ports repository catalogue...
FreeBSD-ports repository is up to date.
FreeBSD-ports is up to date.
Checking integrity... done (2 conflicting)
- py312-boost-libs-1.89.0 [FreeBSD-ports] conflicts with
py311-boost-libs-1.89.0 [installed] on
/usr/local/lib/cmake/boost_numpy-1.89.0/boost_numpy-config-version.cmake
- py312-numpy-2.4.6_1,1 [FreeBSD-ports] conflicts with py311-numpy-2.4.6_1,1
[installed] on /usr/local/bin/f2py
Checking integrity... done (0 conflicting)
The following 5 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
py312-boost-libs: 1.89.0 [FreeBSD-ports]
py312-numpy: 2.4.6_1,1 [FreeBSD-ports]
Installed packages to be UPGRADED:
Imath: 3.2.2_2 -> 3.2.2_4 [FreeBSD-ports]
Installed packages to be REMOVED:
py311-boost-libs: 1.89.0
py311-numpy: 2.4.6_1,1
Number of packages to be removed: 2
Number of packages to be installed: 2
Number of packages to be upgraded: 1
----------
so pkg believes Imath previously depended on py311-numpy.
Fortunately, none of the stragglers were anything I'd installed, and nothing
else depended on any of them, so I uninstalled them all.
3. After Conversion
> After that the command:
>
> # pkg query %R:%n-%v | grep ^FreeBSD:
>
> should generate an empty list.
It does now.
> At that point deletion (or disabling) of the FreeBSD
> repository reference in /usr/local/etc/pkg/repos/ is
> appropriate.
I disabled it.
> Then:
>
> # pkg clean
>
> should get back relevant space under: /var/cache/pkg/
It did.
> Then you should be able to:
>
> # rm /var/db/pkg/repos/FreeBSD /var/db/pkg/*FreeBSD.*
Except that /var/db/pkg/repos/FreeBSD is a directory and so needed -r, it did.
> # pkg-static version -U -vRl\?
produced no output, so that's good.
===== Wrap-up =====
For me, this issue is resolved. You're welcom to keep this open for the "pkg
gets confused by multiple overlapping repos" issue. You have the FreeBSD and
FreeBSD-ports URLs from earlier, so the problem should be reproducible. It
happened both when FreeBSD-ports was .../quarterly and .../latest.
Thanks!
-WBE
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.