Bug 287700 - Cannot 'pkg upgrade' from pkg-2.1.4 to pkg-2.2.0 on 14.3R
Summary: Cannot 'pkg upgrade' from pkg-2.1.4 to pkg-2.2.0 on 14.3R
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-pkg (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-21 06:25 UTC by Masachika ISHIZUKA
Modified: 2025-06-21 19:15 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Masachika ISHIZUKA 2025-06-21 06:25:40 UTC
I'm using 14.3R.
Infinity loop is occured by 'pkg upgrade'.
 
# pkg info -a | grep pkg | grep '^pkg-'
# pkg-2.1.4                      Package manager
# pkg upgrade
Updating FreeBSD repository catalogue...
Fetching data.pkg: 100%   10 MiB  10.5MB/s    00:01    
Processing entries: 100%
FreeBSD repository update completed. 35981 packages processed.
Updating FreeBSD-kmods repository catalogue...
FreeBSD-kmods repository is up to date.
Updating FreeBSD-latest repository catalogue...
Fetching data.pkg: 100%   10 MiB  10.6MB/s    00:01    
Processing entries: 100%
FreeBSD-latest repository update completed. 36097 packages processed.
All repositories are up to date.
New version of pkg detected; it needs to be installed first.
Checking integrity... done (0 conflicting)
Your packages are up to date.
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating FreeBSD-kmods repository catalogue...
FreeBSD-kmods repository is up to date.
Updating FreeBSD-latest repository catalogue...
FreeBSD-latest repository is up to date.
All repositories are up to date.
New version of pkg detected; it needs to be installed first.
Checking integrity... done (0 conflicting)
Your packages are up to date.
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating FreeBSD-kmods repository catalogue...
FreeBSD-kmods repository is up to date.
Updating FreeBSD-latest repository catalogue...
FreeBSD-latest repository is up to date.
All repositories are up to date.
New version of pkg detected; it needs to be installed first.
Checking integrity... done (0 conflicting)
Your packages are up to date.
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating FreeBSD-kmods repository catalogue...
FreeBSD-kmods repository is up to date.
Updating FreeBSD-latest repository catalogue...
FreeBSD-latest repository is up to date.
All repositories are up to date.
New version of pkg detected; it needs to be installed first.
Checking integrity... done (0 conflicting)
Your packages are up to date.
... (infinity repetition)
^C

So I upgraded to pkg-2.2.0 from 2.1.4 by pkg add -f as follows.
# pkg fetch pkg
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating FreeBSD-kmods repository catalogue...
FreeBSD-kmods repository is up to date.
Updating FreeBSD-latest repository catalogue...
FreeBSD-latest repository is up to date.
All repositories are up to date.
The following packages will be fetched:

New packages to be FETCHED:
        pkg: 2.2.0 (12 MiB: 100.00% of the 12 MiB to download)

Number of packages to be fetched: 1

The process will require 12 MiB more space.
12 MiB to be downloaded.

Proceed with fetching packages? [y/N]: y
Fetching pkg-2.2.0.pkg: 100%   12 MiB  12.6MB/s    00:01    
# cd /var/cache/pkg
# pkg add -f pkg-2.2.0.pkg
Comment 1 Eric 2025-06-21 15:29:24 UTC
(In reply to Masachika ISHIZUKA from comment #0)

I haven't experienced this, upgrading from pkg 2.1.4 to 2.2.0 (using Latest) on my 14.3-R. On my system I cannot reproduce this when again starting with pkg 2.1.4 (with a clean pkg cache); however, your environment will no doubt be different.

Your command
# pkg upgrade

tries to consider upgrading every installed package. This might have resulted in comparing quite a number of installed packages with the packages available remotely; also a lot of dependencies may have been involved and might have caused the infinite loop, though I cannot corroborate that. 

AFAIK the running pkg (that is 2.1.4 in this case) is first trying to upgrade itself (to 2.2.0 here); I don't know how much 'other processing' is undertaken before pkg tries to upgrade itself.

Your solution/workaround seems to have worked effectively. As alternatives to this 'pkg add' route, users facing the same problem in trying to get pkg upgraded to 2.2.0 might consider trying:
# pkg upgrade pkg

or even:
# pkg upgrade -r FreeBSD pkg

thereby limiting this to upgrading only the pkg package.
Comment 2 Graham Perrin 2025-06-21 19:15:24 UTC
(In reply to Masachika ISHIZUKA from comment #0)

uname -mv

pkg repos -e