Solved pkg: cached package virtualbox-ose-additions-4.3.18: size mismatch, cannot continue

An occasional FreeBSD upgrade failed with the following:

Code:
# pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking for upgrades (9 candidates): 100%
The following 14 packages will be affected (of 0 checked):

New packages to be INSTALLED:
    libdevq: 0.0.2
    libXvMC: 1.0.8_2
    videoproto: 2.3.2
    libXv: 1.0.10_2,1
    libvdpau: 0.8_1

Installed packages to be UPGRADED:
    virtualbox-ose-additions: 4.3.16_1 -> 4.3.18
    libxml2: 2.9.1_1 -> 2.9.2_1
    png: 1.5.18 -> 1.5.19
    libdrm: 2.4.52_1,1 -> 2.4.58_1,1
    libGL: 9.1.7_2 -> 9.1.7_3
    dri: 9.1.7_5,2 -> 9.1.7_6,2
    libglapi: 9.1.7_1 -> 9.1.7_2
    sudo: 1.8.10.p3_1 -> 1.8.11.p1
    ca_root_nss: 3.17.1 -> 3.17.2

The process will require 72 MB more space.
42 MB to be downloaded.

Proceed with this action? [y/N]: y
Fetching virtualbox-ose-additions-4.3.18.txz: 100%  448 KB 459.0k/s    00:01
pkg: cached package virtualbox-ose-additions-4.3.18: size mismatch, fetching from remote
Fetching virtualbox-ose-additions-4.3.18.txz: 100%  448 KB 459.0k/s    00:01
pkg: cached package virtualbox-ose-additions-4.3.18: size mismatch, cannot continue

Any ideas how to upgrate the system from this point?
 
Connection problems? Try it a little bit later or try another mirror.

pkg0.bme.freebsd.org/
pkg0.isc.freebsd.org
pkg0.nyi.freebsd.org
pkg0.ydx.freebsd.org

It's not very clear to see, the letter after pkg means numeric 0.
 
It doesn't look like connection issues because the repositories are updated without problems.
 
I'm guessing this is a faulty download, maybe? Try removing the old cached versions (I think they're in /var/cache/pkg), and try downloading the packages again.
 
I thought that too, did it right away. But it didn't help.:(
Hmm, well, a solution could be to directly download it from http://distcache.freebsd.org/freebsd:10:x86:64/latest/All/ (assuming you run 10.0), and directly install it. That SHOULD eliminate any possibility of a bad mirror, although I don't know if dependency checking works for offline packages (I don't use binary packages at all). WARNING: the above website is a list for ALL packages, and it will take quite a while to load. If your browser seems to freeze for a couple seconds, it's not a problem with your browser.
 
Thanks for your input, EmeraldBot!

I ended up uninstalling the faulting package. The upgrade of the rest went fine. However, I couldn't install it back again, so there's obviously a problem with the package itself.

Code:
# pkg remove virtualbox-ose-additions
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
    virtualbox-ose-additions-4.3.16_1

The operation will free 2 MB.

Proceed with deinstalling packages? [y/N]: y
[1/1] Deleting virtualbox-ose-additions-4.3.16_1: 100%

# pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking for upgrades (8 candidates): 100%
The following 13 packages will be affected (of 0 checked):

New packages to be INSTALLED:
    libXvMC: 1.0.8_2
    videoproto: 2.3.2
    libXv: 1.0.10_2,1
    libvdpau: 0.8_1
    libdevq: 0.0.2

Installed packages to be UPGRADED:
    sudo: 1.8.10.p3_1 -> 1.8.11.p1
    libxml2: 2.9.1_1 -> 2.9.2_1
    png: 1.5.18 -> 1.5.19
    libGL: 9.1.7_2 -> 9.1.7_3
    libglapi: 9.1.7_1 -> 9.1.7_2
    libdrm: 2.4.52_1,1 -> 2.4.58_1,1
    dri: 9.1.7_5,2 -> 9.1.7_6,2
    ca_root_nss: 3.17.1 -> 3.17.2

The process will require 72 MB more space.
41 MB to be downloaded.

Proceed with this action? [y/N]: y
Fetching sudo-1.8.11.p1.txz: 100%  743 KB 760.4k/s    00:01
Fetching libxml2-2.9.2_1.txz: 100%  754 KB 771.8k/s    00:01
Fetching png-1.5.19.txz: 100%  226 KB 231.8k/s    00:01
Fetching libGL-9.1.7_3.txz: 100%  211 KB 216.3k/s    00:01
Fetching libglapi-9.1.7_2.txz: 100%   39 KB  40.0k/s    00:01
Fetching libdrm-2.4.58_1,1.txz: 100%  157 KB 161.0k/s    00:01
Fetching dri-9.1.7_6,2.txz: 100%   39 MB   3.1M/s    00:13
Fetching libXvMC-1.0.8_2.txz: 100%   25 KB  25.7k/s    00:01
Fetching videoproto-2.3.2.txz: 100%    7 KB   6.9k/s    00:01
Fetching libXv-1.0.10_2,1.txz: 100%   36 KB  36.4k/s    00:01
Fetching libvdpau-0.8_1.txz: 100%   48 KB  49.5k/s    00:01
Fetching libdevq-0.0.2.txz: 100%    5 KB   5.4k/s    00:01
Fetching ca_root_nss-3.17.2.txz: 100%  315 KB 322.4k/s    00:01
Checking integrity... done (0 conflicting)
[1/13] Upgrading libxml2 from 2.9.1_1 to 2.9.2_1: 100%
[2/13] Installing videoproto-2.3.2: 100%
[3/13] Upgrading libdrm from 2.4.52_1,1 to 2.4.58_1,1: 100%
[4/13] Installing libXv-1.0.10_2,1: 100%
[5/13] Installing libdevq-0.0.2: 100%
[6/13] Upgrading libglapi from 9.1.7_1 to 9.1.7_2: 100%
[7/13] Installing libXvMC-1.0.8_2: 100%
[8/13] Installing libvdpau-0.8_1: 100%
[9/13] Upgrading sudo from 1.8.10.p3_1 to 1.8.11.p1: 100%
[10/13] Upgrading png from 1.5.18 to 1.5.19: 100%
[11/13] Upgrading libGL from 9.1.7_2 to 9.1.7_3: 100%
[12/13] Upgrading dri from 9.1.7_5,2 to 9.1.7_6,2: 100%
[13/13] Upgrading ca_root_nss from 3.17.1 to 3.17.2: 100%

# pkg install virtualbox-ose-additions
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 1 packages will be affected (of 0 checked):

New packages to be INSTALLED:
    virtualbox-ose-additions: 4.3.18

The process will require 2 MB more space.
443 KB to be downloaded.

Proceed with this action? [y/N]: y
Fetching virtualbox-ose-additions-4.3.18.txz: 100%  448 KB 459.0k/s    00:01
pkg: cached package virtualbox-ose-additions-4.3.18: size mismatch, fetching from remote
Fetching virtualbox-ose-additions-4.3.18.txz: 100%  448 KB 459.0k/s    00:01
pkg: cached package virtualbox-ose-additions-4.3.18: size mismatch, cannot continue

I will try the direct link you posted to install it directly, but I am pretty sure it won't help.
 
Well, I must admit that offline installation worked fine which, indeed, surprised me a lot!

Code:
# fetch http://distcache.freebsd.org/freebsd:10:x86:64/latest/All/virtualbox-ose-additions-4.3.18.txz
virtualbox-ose-additions-4.3.18.txz           100% of  448 kB  922 kBps 00m00s

# pkg install virtualbox-ose-additions-4.3.18.txz
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The following 1 packages will be affected (of 0 checked):

New packages to be INSTALLED:
    virtualbox-ose-additions: 4.3.18

The process will require 2 MB more space.

Proceed with this action? [y/N]: y
[1/1] Installing virtualbox-ose-additions-4.3.18: 100%
Message for virtualbox-ose-additions-4.3.18:
=============================================================================

VirtualBox Guest Additions were installed.


You need to enable the vboxguest startscript to load the kernel module and
vboxservice to use host time synchronization.

vboxguest_enable="YES"
vboxservice_enable="YES"

You also have to add all X11 users that want to use any of the additional
features (clipboard sharing, window scaling) to the wheel group.

%25 pw groupmod wheel -m jerry

Reboot the machine to load the needed kernel modules.

For detailed informations please visit http://wiki.freebsd.org/VirtualBox

=============================================================================

I don't know what to think. It's either out-of-sync repos or some other thing... Not sure if it's of interest of the packaging team though. Could be potentially...
 
Well, I must admit that offline installation worked fine which, indeed, surprised me a lot!

Code:
# fetch http://distcache.freebsd.org/freebsd:10:x86:64/latest/All/virtualbox-ose-additions-4.3.18.txz
virtualbox-ose-additions-4.3.18.txz           100% of  448 kB  922 kBps 00m00s

# pkg install virtualbox-ose-additions-4.3.18.txz
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The following 1 packages will be affected (of 0 checked):

New packages to be INSTALLED:
    virtualbox-ose-additions: 4.3.18

The process will require 2 MB more space.

Proceed with this action? [y/N]: y
[1/1] Installing virtualbox-ose-additions-4.3.18: 100%
Message for virtualbox-ose-additions-4.3.18:
=============================================================================

VirtualBox Guest Additions were installed.


You need to enable the vboxguest startscript to load the kernel module and
vboxservice to use host time synchronization.

vboxguest_enable="YES"
vboxservice_enable="YES"

You also have to add all X11 users that want to use any of the additional
features (clipboard sharing, window scaling) to the wheel group.

%25 pw groupmod wheel -m jerry

Reboot the machine to load the needed kernel modules.

For detailed informations please visit http://wiki.freebsd.org/VirtualBox

=============================================================================

I don't know what to think. It's either out-of-sync repos or some other thing... Not sure if it's of interest of the packaging team though. Could be potentially...


I think your problem is (was) yet another case of needing to run pkg update -f to fully re-download the repository metadata. If you run into similar trouble again try that and see if it helps.
 
I have the same problem, and I tried the solution above, but the virtualbox-ose-additions upgrade still failed. However the failure was actually in upgrading dbus, which is a dependency, so perhaps that's where the problem really lies.
 
I think your problem is (was) yet another case of needing to run pkg update -f to fully re-download the repository metadata. If you run into similar trouble again try that and see if it helps.

Thanks for the input, kpa! Actually, there was no need to wait for another chance. I am too curious to postpone. Here is what I did:

Code:
# pkg remove virtualbox-ose-additions
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
    virtualbox-ose-additions-4.3.18

The operation will free 2 MB.

Proceed with deinstalling packages? [y/N]: y
[1/1] Deleting virtualbox-ose-additions-4.3.18: 100%

# pkg install virtualbox-ose-additions
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 1 packages will be affected (of 0 checked):

New packages to be INSTALLED:
    virtualbox-ose-additions: 4.3.18

The process will require 2 MB more space.
443 KB to be downloaded.

Proceed with this action? [y/N]: y
Fetching virtualbox-ose-additions-4.3.18.txz: 100%  448 KB 459.0k/s    00:01
pkg: cached package virtualbox-ose-additions-4.3.18: size mismatch, fetching from remote
Fetching virtualbox-ose-additions-4.3.18.txz: 100%  448 KB 459.0k/s    00:01
pkg: cached package virtualbox-ose-additions-4.3.18: size mismatch, cannot continue

# pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%   944 B   0.9k/s    00:01
Fetching digests.txz: 100%    2 MB   2.1M/s    00:01
Fetching packagesite.txz: 100%    5 MB   1.8M/s    00:03
Processing new repository entries: 100%
FreeBSD repository update completed. 23683 packages processed:
  0 updated, 0 removed and 23683 added.

# pkg install virtualbox-ose-additions
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 1 packages will be affected (of 0 checked):

New packages to be INSTALLED:
    virtualbox-ose-additions: 4.3.18

The process will require 2 MB more space.
448 KB to be downloaded.

Proceed with this action? [y/N]: y
Fetching virtualbox-ose-additions-4.3.18.txz: 100%  448 KB 459.0k/s    00:01
Checking integrity... done (0 conflicting)
[1/1] Installing virtualbox-ose-additions-4.3.18: 100%

So, yes, the pkg update -f command saves the day. The only question remains so far is how come I ended up with a repo state like that?:)
 
Back
Top