pkg icon indicating copy to clipboard operation
pkg copied to clipboard

pkg upgrade doesn't find an existing but locked package

Open kibab opened this issue 11 years ago • 5 comments

I have a locked zabbix24-server package with the version 2.4.2

$ pkg info -kx zabbix-*
zabbix24-agent-2.4.4           no
zabbix24-server-2.4.2          yes

I want to upgrade it to 2.4.4. Expected behaviour is that pkg refuses to upgrade because the package is, well, locked. However, pkg fails with "no packages available..." error

$ sudo pkg upgrade  zabbix24-server                                                                                                                                                            
Updating FreeBSD-Q repository catalogue...
FreeBSD-Q repository is up-to-date.
All repositories are up-to-date.
pkg: No packages available to upgrade matching 'zabbix24-server' have been found in the repositories

If I unlock the package, pkg will proceed just fine. I think the error message is misleading,

kibab avatar Apr 27 '15 13:04 kibab

pkg is installed from ports:

$ pkg -v
1.5.1

kibab avatar Apr 27 '15 14:04 kibab

What behavior do you expect? Message about what package locked and cannot be upgraded?

andrejzverev avatar May 05 '15 18:05 andrejzverev

Sorry for not responding. Yes, because that's the cause why nothing is done, not that no package is available in the repo.

kibab avatar May 19 '15 14:05 kibab

@kibab if you're not already aware, pkg-version(8) can show whether something needs upgrading regardless of its lock status.

For demonstration purposes only:

pkg version -vRL=
root@mowa219-gjp4-zbook-freebsd:~ # pkg lock -y FreeBSD-kernel-minimal
Locking FreeBSD-kernel-minimal-15.snap20250320205252
root@mowa219-gjp4-zbook-freebsd:~ # pkg version -vRL= | grep -v orphaned | grep -v FreeBSD-ftpd-15.snap
Updating FreeBSD-ports repository catalogue...
FreeBSD-ports repository is up to date.
Updating FreeBSD-base repository catalogue...
FreeBSD-base repository is up to date.
Updating local-current repository catalogue...
local-current repository is up to date.
All repositories are up to date.
FreeBSD-kernel-generic-15.snap20250320205252 <   needs updating (remote has 15.snap20250321234723)
FreeBSD-kernel-generic-dbg-15.snap20250320205252 <   needs updating (remote has 15.snap20250321234723)
FreeBSD-kernel-generic-nodebug-15.snap20250320205252 <   needs updating (remote has 15.snap20250321234723)
FreeBSD-kernel-generic-nodebug-dbg-15.snap20250320205252 <   needs updating (remote has 15.snap20250321234723)
FreeBSD-kernel-minimal-15.snap20250320205252 <   needs updating (remote has 15.snap20250321234723)
FreeBSD-kernel-minimal-dbg-15.snap20250320205252 <   needs updating (remote has 15.snap20250321234723)
FreeBSD-utilities-man-15.snap20250318170433 <   needs updating (remote has 15.snap20250321211309)
talloc-2.4.2                       >   succeeds remote (remote has 2.4.1_1)
tevent-0.16.1                      >   succeeds remote (remote has 0.15.0_1)
root@mowa219-gjp4-zbook-freebsd:~ # pkg unlock -qy FreeBSD-kernel-minimal
root@mowa219-gjp4-zbook-freebsd:~ # pkg -v
2.0.6
root@mowa219-gjp4-zbook-freebsd:~ # pkg repos -el | sort -f
FreeBSD-base
FreeBSD-ports
local-current
root@mowa219-gjp4-zbook-freebsd:~ # uname -mvKU
FreeBSD 15.0-CURRENT main-n276034-16649530b7be GENERIC-NODEBUG amd64 1500034 1500034
root@mowa219-gjp4-zbook-freebsd:~ # 
  • FreeBSD-kernel-minimal-dbg-15.snap20250320205252 was shown outdated whilst it was temporarily locked.

grahamperrin avatar Mar 22 '25 10:03 grahamperrin

https://github.com/freebsd/pkg/issues/1239#issue-71286029

… pkg fails with "no packages available..." error …

Not mention of available with pkg 2.0.6:

root@mowa219-gjp4-zbook-freebsd:~ # pkg lock -y FreeBSD-kernel-minimal
Locking FreeBSD-kernel-minimal-15.snap20250320205252
root@mowa219-gjp4-zbook-freebsd:~ # pkg upgrade -nU FreeBSD-kernel-minimal
root@mowa219-gjp4-zbook-freebsd:~ # pkg upgrade -FnU FreeBSD-kernel-minimal
root@mowa219-gjp4-zbook-freebsd:~ # pkg unlock -qy FreeBSD-kernel-minimal
root@mowa219-gjp4-zbook-freebsd:~ # pkg upgrade -nU FreeBSD-kernel-minimal
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        FreeBSD-kernel-minimal: 15.snap20250320205252 -> 15.snap20250321234723 [FreeBSD-base]

Number of packages to be upgraded: 1

42 MiB to be downloaded.
root@mowa219-gjp4-zbook-freebsd:~ # 

grahamperrin avatar Mar 22 '25 10:03 grahamperrin