Wednesday, March 2, 2016

NetBSD 7.0: Clean and update pkgin database to solve "download mismatch"

Here's a problem I encountered with pkgin in my current NetBSD install, as well as the solution I was able to find. While it may be "NetBSD/pkgsrc 101" for experienced users, I'll pass this along anyway, as I always assume that whenever I'm encountering a certain issue, then odds are someone else is, as well. (Even those of us who have no damn business running an operating system for grown ups deserve guidance every now and then, too.)

The problem in question is that I've been I've been tripping over my own feet while trying to install packages via pkgin install, as shown by the following console porn, which I managed to capture using the script command:

darkstar# pkgin install lynx
reading local summary...
processing local summary...

calculating dependencies... -
calculating dependencies... done.

nothing to upgrade.
1 packages to be installed (2284K to download, 5489K to install):

lynx-2.8.8.2nb2

proceed ? [Y/n] y
downloading packages...
downloading lynx-2.8.8.2nb2.tgz: 0%
lynx-2.8.8.2nb2.tgz 0% 0 0.0KB/s 0.0KB/s --:-- ETA
lynx-2.8.8.2nb2.tgz 12% 292KB 292.0KB/s 292.0KB/s 00:06 ETA
lynx-2.8.8.2nb2.tgz 43% 1000KB 333.6KB/s 708.0KB/s 00:03 ETA
lynx-2.8.8.2nb2.tgz 74% 1692KB 369.4KB/s 692.0KB/s 00:01 ETA
lynx-2.8.8.2nb2.tgz 100% 2284KB 571.0KB/s 592.1KB/s 00:04
pkgin: download mismatch: /var/db/pkgin/cache/lynx-2.8.8.2nb2.tgz

I chose lynx here merely for ease of illustration, rather than, say, kde4. In any case, I got the same results regardless of which package I was trying to install. And so I did much searching on the web along the lines of "NetBSD 7.0 download mismatch" and didn't really get anywhere.

And then, lo and behold, I found what I suspected may have been what I was looking for on the main page of www.pkgin.net. Fearing I may be on the verge of fouling up yet another BSD install (hello FreeBSD 8.2), I took a deep breath and did the following:

darkstar# pkgin clean
darkstar# pkgin update
processing remote summary (http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/7.0/All)...
downloading pkg_summary.bz2: 0%
pkg_summary.bz2 0% 0 0.0KB/s 0.0KB/s --:-- ETA
pkg_summary.bz2 5% 128KB 128.0KB/s 128.0KB/s 00:17 ETA
pkg_summary.bz2 5% 128KB 115.2KB/s 0.0KB/s 00:19 ETA
pkg_summary.bz2 5% 128KB 103.7KB/s 0.0KB/s 00:22 ETA
pkg_summary.bz2 5% 128KB 93.3KB/s 0.0KB/s 00:24 ETA
pkg_summary.bz2 10% 256KB 96.8KB/s 128.0KB/s 00:22 ETA
pkg_summary.bz2 15% 384KB 99.9KB/s 128.0KB/s 00:20 ETA
pkg_summary.bz2 21% 512KB 102.7KB/s 128.0KB/s 00:18 ETA
pkg_summary.bz2 23% 576KB 98.8KB/s 64.0KB/s 00:18 ETA
pkg_summary.bz2 28% 704KB 101.8KB/s 128.0KB/s 00:16 ETA
pkg_summary.bz2 31% 768KB 98.0KB/s 64.0KB/s 00:16 ETA
pkg_summary.bz2 36% 896KB 101.0KB/s 128.0KB/s 00:15 ETA
pkg_summary.bz2 42% 1024KB 103.7KB/s 128.0KB/s 00:13 ETA
pkg_summary.bz2 50% 1216KB 112.5KB/s 192.0KB/s 00:10 ETA
pkg_summary.bz2 57% 1408KB 120.5KB/s 192.0KB/s 00:08 ETA
pkg_summary.bz2 63% 1536KB 121.2KB/s 128.0KB/s 00:07 ETA
pkg_summary.bz2 73% 1792KB 134.7KB/s 256.0KB/s 00:04 ETA
pkg_summary.bz2 76% 1856KB 124.4KB/s 64.0KB/s 00:04 ETA
pkg_summary.bz2 84% 2048KB 131.2KB/s 192.0KB/s 00:02 ETA
pkg_summary.bz2 89% 2176KB 130.9KB/s 128.0KB/s 00:01 ETA
pkg_summary.bz2 94% 2304KB 130.6KB/s 128.0KB/s 00:00 ETA
pkg_summary.bz2 100% 2432KB 110.5KB/s 127.8KB/s 00:22
With trembling fingers, a dry mouth, and a trickle of sweat upon my furrowed brow, I took another run at installing lynx:

darkstar# pkgin install lynx

calculating dependencies... -
calculating dependencies... done.

nothing to upgrade.
1 packages to be installed (2284K to download, 5489K to install):

lynx-2.8.8.2nb2

proceed ? [Y/n] y
downloading packages...
downloading lynx-2.8.8.2nb2.tgz: 0%
lynx-2.8.8.2nb2.tgz 0% 0 0.0KB/s 0.0KB/s --:-- ETA
lynx-2.8.8.2nb2.tgz 12% 288KB 288.0KB/s 288.0KB/s 00:06 ETA
lynx-2.8.8.2nb2.tgz 38% 888KB 319.2KB/s 600.0KB/s 00:04 ETA
lynx-2.8.8.2nb2.tgz 69% 1596KB 358.1KB/s 708.0KB/s 00:01 ETA
lynx-2.8.8.2nb2.tgz 97% 2236KB 386.3KB/s 640.0KB/s 00:00 ETA
lynx-2.8.8.2nb2.tgz 100% 2284KB 571.0KB/s 48.1KB/s 00:04
installing packages...
installing lynx-2.8.8.2nb2...
lynx-2.8.8.2nb2: copying /usr/pkg/share/examples/lynx/lynx.cfg to /usr/pkg/etc/lynx.cfg
lynx-2.8.8.2nb2: copying /usr/pkg/share/examples/lynx/lynx.lss to /usr/pkg/etc/lynx.lss
pkg_install warnings: 0, errors: 0
reading local summary...
processing local summary...
marking lynx-2.8.8.2nb2 as non auto-removable

And then I typed "lynx" at the prompt and,  voila, I was browsing the web like it was 1994. (I'd wax nostalgic about the good ol' days on National Capital FreeNet, but the last thing I need to do is provide even more evidence of how unhip and out-of-touch I've become.)