# Trouble installing packages in jails after FreeBSD 11.2 upgrade



## timypcr (Aug 25, 2018)

I recently upgraded  from FreeBSD 11.1-release to 11.2 following the handbook, I’m now getting : size mismatch, cannot continue on some of the jails when attempting to update and install packages.

For example when I attempt to install curl


```
Fetching curl-7.61.0.txz: 100%    1 MiB   1.3MB/s    00:01
pkg: cached package curl-7.61.0: size mismatch, fetching from remote
 [2/3] Fetching curl-7.61.0.txz: 100%    1 MiB   1.3MB/s    00:01
pkg: cached package curl-7.61.0: size mismatch, cannot continue
```
in an effort to resolve the issue I tried the below commands which seems to have made matters worse 

```
pkg clean
rm -rf /var/cache/pkg/* 
pkg update -f 
rm /var/db/pkg/repo-*.sqlite 
pkg bootstrap -f
```

now when I run pkg update

```
pkg update
Updating FreeBSD
repository catalogue...
pkg: Repository
FreeBSD load error: access repo file(/var/db/pkg/repo-FreeBSD.sqlite)
failed: No such file or directory
Fetching meta.txz:
100%    940 B   0.9kB/s    00:01   
Fetching
packagesite.txz: 100%    6 MiB   2.2MB/s    00:03   
Processing entries:
 0%
Newer FreeBSD
version for package picmi-kde4:
To ignore this error
set IGNORE_OSVERSION=yes
- package: 1101001
- running kernel:
1100122
Allow missmatch
now?[Y/n]:
```

Even pressing no
makes no difference and ignoring this error does not seem
like a great idea, also found a “workaround” that suggested
changing the kernel number in pkg.conf which seems like it would
cause additional issues with packages in the future.

Additional info that
maybe helpful:

uname results from one of the effected jails


```
uname -U && uname -K
1100122
1102000
```

and the result when running from host

```
uname -U && uname -K
1102000
1102000
```

What is the best way to address this issue?

Thanks,
Tim


----------



## rigoletto@ (Aug 25, 2018)

`pkg clean && pkg update -f` should do the trick.

[EIT]
Oh you already did that!

It seems the jail have base/kernel out of sync. You probably updated kernel but not base, and this is the first thing you need to fix.


----------



## ShelLuser (Aug 25, 2018)

Make sure you _really_ upgraded your jail. I had the same problem on one of my jails (even though it seemed the upgrade went well) and eventually I ended up backing up /etc and wiping the jail clean, then re-installing it (basically extracting base.txz)and restoring /etc again. After that everything worked normally once more.

I never gave it much thought but my assumption is that it could be some kind of library issue.


----------



## timypcr (Aug 25, 2018)

lebarondemerde said:


> `pkg clean && pkg update -f` should do the trick.
> 
> [EIT]
> Oh you already did that!
> ...



Thanks for the reply when I run this command I am still prompted with "Allow missmatch now?[Y/n]:" should I say yes for this?


----------



## timypcr (Aug 25, 2018)

ShelLuser said:


> Make sure you _really_ upgraded your jail. I had the same problem on one of my jails (even though it seemed the upgrade went well) and eventually I ended up backing up /etc abd wiping the jail clean, then re-installing it (basically extracting base.txz)and restoring /etc again. After that everything worked normally once more.
> 
> I never gave it much thought but my assumption is that it could be some kind of library issue.



ShelLuser,

Thanks very much for your reply. Perhaps I am not fully understanding your post but are you basically saying you had to rebuild the jail from scratch? Would seem to be you would need to backup more than just /etc/ if that was the case, such as /usr/local/etc. Please confirm if your solution is to simply rebuild the jail or if I've misunderstood your post please elaborate.


----------



## timypcr (Aug 25, 2018)

timypcr said:


> Thanks for the reply when I run this command I am still prompted with "Allow missmatch now?[Y/n]:" should I say yes for this?



Thanks once again for the quick response. Could you please provide addtional information on what is needed to properly update the base to sync it with host?


----------



## rigoletto@ (Aug 25, 2018)

Your real problem is the jail installed kernel is 11.2 and the base is 11.0. You need to fix it.


----------



## timypcr (Aug 25, 2018)

lebarondemerde said:


> Your real problem is the jail installed kernel is 11.2 and the base is 11.0. You need to fix it.


please advise on how this can be fixed please


----------



## rigoletto@ (Aug 25, 2018)

That depends on how the jail was created, if manually or using any jail management tool. If manually, you need to find out what went wrong ( eventually forgot to installworld? or did not restarted the jail after updating the kernel before installworld? ).  If using some jail management tool, it depends on the specific tool.


----------



## kpa (Aug 25, 2018)

Running an older base in a jail is perfectly valid, just look at my poudriere HOWTO. I suspect the real problem here is a half finished upgrade of the jail at some point.


----------



## timypcr (Aug 25, 2018)

lebarondemerde said:


> That depends on how the jail was created, if manually or using any jail management tool. If manually, you need to find out what went wrong ( eventually forgot to installworld? or did not restarted the jail after updating the kernel before installworld? ).  If using some jail management tool, it depends on the specific tool.


it was created with ezjail-admin tool and I did not install / build world.


----------



## ShelLuser (Aug 25, 2018)

timypcr said:


> are you basically saying you had to rebuild the jail from scratch? Would seem to be you would need to backup more than just /etc/ if that was the case, such as /usr/local/etc.


Ayups, I figured that was more or less implied. But yeah, I backed up the data, then manually re-installed the jail by extracting the binary archives and then things went back to normal.



lebarondemerde said:


> Your real problem is the jail installed kernel is 11.2 and the base is 11.0. You need to fix it.


Although I definitely agree that it helps to have the same version I can assure you that there's no guarantee that this actually causes the problem. Because I've had this issue in a jail which was recently upgraded. Both the host and the jail ran 11.2, upgrade went normal and without errors, yet I still ran into this weird network problem.


----------

