Bug 201302 - Can't update packages using ports-mgmt/pkg
Summary: Can't update packages using ports-mgmt/pkg
Status: Closed Overcome By Events
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: 2015-07-03 11:30 UTC by Josh
Modified: 2015-07-04 09:41 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Josh 2015-07-03 11:30:10 UTC
This morning I updated the OS to the latest patchlevel due to receiving the "freebsd-update cron" email:

$ sudo freebsd-update install
Password:
Installing updates... done.
$ uname -a
FreeBSD mysql2 10.0-RELEASE-p7 FreeBSD 10.0-RELEASE-p7 #0: Tue Jul  8 06:37:44 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
$ sudo reboot
[...]
$ uname -a
FreeBSD mysql2 10.0-RELEASE-p18 FreeBSD 10.0-RELEASE-p18 #0: Wed Feb 25 01:08:00 UTC 2015     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

That seemed to work fine. Then I tried to update my packages, which failed. Fortunately there are no security vulnerabilities (though I'm not sure I trust this at this point):

$ sudo pkg audit -F
Password:
Vulnxml file up-to-date.
0 problem(s) in the installed packages found.
$ sudo pkg upgrade
Updating repository catalogue
New version of pkg detected; it needs to be installed first.
Upgrades have been requested for the following 1 packages:

        Upgrading pkg: 1.2.7_3 -> 1.5.4

The upgrade will require 2 MB more space

2 MB to be downloaded

Proceed with upgrading packages [y/N]: y
pkg-1.5.4.txz                       100% 2423KB   1.2MB/s 153.4KB/s   00:02
pkg: pkg-1.5.4 failed checksum from repository
$ sudo pkg check -s -a
$ echo $?
0
$ sudo pkg update -f
Updating repository catalogue
digests.txz                         100% 2060KB   1.0MB/s   1.4MB/s   00:02
packagesite.txz                     100% 5264KB   1.0MB/s   1.2MB/s   00:05
pkg: package field incomplete: comment
Incremental update completed, 24266 packages processed:
220 packages updated, 7 removed and 23 added.
pkg: Unable to find catalogs
$ sudo pkg upgrade
Updating repository catalogue
New version of pkg detected; it needs to be installed first.
Upgrades have been requested for the following 1 packages:

        Upgrading pkg: 1.2.7_3 -> 1.5.4

The upgrade will require 2 MB more space

2 MB to be downloaded

Proceed with upgrading packages [y/N]: y
pkg-1.5.4.txz                       100% 2423KB 807.8KB/s   1.2MB/s   00:03
pkg: pkg-1.5.4 failed checksum from repository
$ ls /usr/share/keys/pkg/trusted/
pkg.freebsd.org.2013102301
$ cd /usr/src/share/keys
$ sudo make install
Password:
===> pkg (install)
===> pkg/trusted (install)
install -o root -g wheel  -m 644 pkg.freebsd.org.2013102301 /usr/share/keys/pkg/trusted
$ sudo pkg upgrade
Updating repository catalogue
New version of pkg detected; it needs to be installed first.
Upgrades have been requested for the following 1 packages:

        Upgrading pkg: 1.2.7_3 -> 1.5.4

The upgrade will require 2 MB more space

2 MB to be downloaded

Proceed with upgrading packages [y/N]: y
pkg-1.5.4.txz                       100% 2423KB 807.8KB/s   1.2MB/s   00:03
pkg: pkg-1.5.4 failed checksum from repository

I don't know if my OS upgrade had anything to do with it breaking or not, but I wouldn't think so. I tried some things I've found online, like reinstalling the keys, though it was the same file since the source wasn't updated. Maybe freebsd-update didn't update the key. Not sure what to do now...
Comment 1 Josh 2015-07-03 12:23:43 UTC
Updating to 10.1-RELEASE-p10 didn't make a difference. Fortunately everything still works.
Comment 2 Josh 2015-07-03 12:42:03 UTC
I was able to work around the issue:

$ fetch 'http://pkg.freebsd.org/freebsd:10:x86:64/latest/Latest/pkg.txz'
pkg.txz                                       100% of 2423 kB 1134 kBps 00m03s
$ sudo pkg add -f pkg.txz
Installing pkg-1.5.4...pkg: package pkg is already installed, forced install
 done
If you are upgrading from the old package format, first run:

  # pkg2ng
$ sudo pkg update
Updating FreeBSD repository catalogue...
Repository FreeBSD has a wrong packagesite, need to re-create database
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01
Fetching packagesite.txz: 100%    5 MiB   1.1MB/s    00:05
Processing entries: 100%
FreeBSD repository update completed. 24266 packages processed.
$
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2015-07-04 09:41:35 UTC
FYI on FreeBSD 10.1+ you can run pkg bootstrap -f which will exactly do what you have done manually