# pkg 1.3.0: size mismatch cannot continue



## BSDBernd (Aug 1, 2014)

Hi,

I use FreeBSD 10.0-RELEASE-p7 and tried to install vim using pkg, which is now version 1.3.0, and got the following: 


```
fbsd_home:~ bernd$ sudo pkg install vim
Updating repository catalogue
pkg: http://pkg.FreeBSD.org/freebsd:10:x86:64/latest/meta.txz: Not Found
pkg: repository FreeBSD has no meta file, using default settings
FreeBSD repository catalogue is up-to-date, no need to fetch fresh copy
The following 4 packages will be affected (of 584 checked):

New packages to be INSTALLED:
	vim: 7.4.364
	lua52: 5.2.3_2
	ctags: 5.8
	cscope: 15.8a

The process will require 29 MB more space
6 MB to be downloaded

Proceed with this action [y/N]: y
Fetching vim-7.4.364.txz: 100% of 6 MB                                                                                 
pkg: cached package vim-7.4.364: size mismatch, fetching from remote
Fetching vim-7.4.364.txz: 100% of 6 MB                                                                                 
pkg: cached package vim-7.4.364: size mismatch, cannot continue
```

A new warning that comes with the new version of pkg seems to be that a metafile is missing. 
But that aside, what explains the message in the last line of the code presented above? Why doesn't the installation work?

Thank you for any answer....


----------



## SirDice (Aug 1, 2014)

BSDBernd said:
			
		

> I use FreeBSD 10.0-RELEASE-p7 and tried to install vim using pkg, which is now version 1.3.0,


It received a few updates in the meantime. It's now at 1.3.3 

You may want to try and update pkg first. There were some issues with 1.3.0.


----------



## BSDBernd (Aug 1, 2014)

Thank you for your answer. I updated the package manager to version 1.3.4 now and got the exact same messages. 
What else could have went wrong?


----------



## SirDice (Aug 1, 2014)

Yeah, I've had some struggles with pkg too. The transition from 1.2.x to 1.3.x wasn't easy. You can try any one of these:

```
pkg clean # cleans /var/cache/pkg/
rm -rf /var/cache/pkg/* # just remove it all
pkg update -f # forces update  of repository catalog
rm /var/db/pkg/repo-*.sqlite # removes all remote repository catalogs
pkg bootstrap -f # forces reinstall of pkg
```
You can delete quite a lot but whatever you do, do NOT delete /var/db/pkg/local.sqlite. It contains the database with your installed packages. If you remove it the system will think you have nothing installed.


----------



## BSDBernd (Aug 1, 2014)

Thank you very much for your help!
The following one of your suggestions did it . I successfully installed vim.

```
sudo pkg update -f
```


----------



## hyperrealx (Sep 14, 2014)

BSDBernd said:
			
		

> Thank you very much for your help!
> The following one of your suggestions did it . I successfully installed vim.
> 
> ```
> ...



I just want to verify that this solved my issue as well.  Thank you.


----------



## iBookG4 (Aug 23, 2015)

Ditto. Had issues installing vim, and `sudo pkg update -f` fixed it. Thanks very much.


----------



## xchris (Jan 14, 2018)

f*** unbelievable its 2018 and still I had the same issue trying to install vim!


----------



## Deleted member 48958 (Jan 14, 2018)

It is not an issue, you just need to  use `# pkg update`,
to update the local copy of the repository, your local copy is just too old
and you get "package size mismatch". 
Use `# pkg update -f`, to be sure. In my experience, 
sometimes `# pkg update -f` is also required after ports-mgmt/pkg upgrade.


----------



## xchris (Jan 15, 2018)

I know... the strange thing is that happened with vim package only.


----------



## elgrande (Jan 27, 2019)

BSDBernd said:


> Thank you very much for your help!
> The following one of your suggestions did it . I successfully installed vim.
> 
> ```
> ...



Hey Bernd,
Thanks for your contribution. I executed this and the one before you and it seems to have solved the size mismatch issue which occured for seemingly all packages to me.


----------



## SirDice (Jan 28, 2019)

Yeah, sometimes your locally cached repository database can get out of sync with the actual repository data. A `pkg update` or `pkg update -f` usually solves it.


----------



## balanga (Jul 21, 2019)

I got the '*size mismatch*'  error just now when trying `pkg install apache24`

`pkg update -f` fixed it!


----------



## NuLL3rr0r (Oct 27, 2019)

Thank you so much SirDice. Faced the same issue on a new 12.0 install. Even in 2019 `pkg update -f` does wonders.


----------



## scottro (Oct 27, 2019)

Forget when I ran into this, but I also came across this thread and SirDice's solution was the answer. (FreeBSD-12.0)


----------



## teekwan (Apr 22, 2020)

Thank you all!
Not to beat a dead horse (this thread I mean  ) but `pkg update -f` solved my issue trying to install atop on my 11.2 
So it continues to do wonders in 2020 too


----------



## golpemortal (Jul 18, 2020)

pkg update -f # It always been good to me which makes everything great again.  The best of FreeBSD is yet to come - Drive on Pathfinder


----------

