# jails pkg version mismatch



## jordanch (Jul 21, 2019)

On my system, pkg within jails seems to complain about the version numbers. I have checked the older posts (mostly from late last year) in this category, but I don't believe they solve my problem.

Symptoms:

Issuing a pkg update within a jail gave the apparently common error 





> Newer FreeBSD version for package pkg: To ignore this error set IGNORE_OSVERSION=yes
> - package: 1102000
> - running kernel: 1101001




But, doing `uname -K` in the same jail gave the result `1102000`. This seems contradictory with the message earlier which says the running kernel is `1101001`
Doing `uname -K` on the host gave `1102000`, which is consistent with the jail.
The output of `freebsd-version -u` was `11.2-RELEASE-p11` and consistent across both jail and host.
Output of `freebsd-version -k` on the host was also `11.2-RELEASE-p11`
Output of `uname -a` includes `FreeBSD 11.2-RELEASE-p9`, this is consistent across both jail and host. 
I did a `pkg bootstrap -f` on both jail and host. The jail gave the same error message as in 1. but I went on with it anyway ignoring the mismatch and clicking Y. The host had no issues.
Now the issue no longer appears while doing pkg update, but if I redo `pkg bootstrap -f` on the jail, it still complains the same thing. I've repeated steps 6 and 7 a couple of times with the same result.

Why does it still complain of the same thing? Is it actually a problem?


----------



## jordanch (Jul 22, 2019)

getopt said:


> `pkg bootstrap -f` is required to run *one time only* for a initial installing of pkg. Running it again should only be done if for what ever reason there is no more pkg.
> 
> Pkg has it's own database in /var/db/pkg which may be affected when bootstrapping again.
> 
> Once you have Pkg installed it takes care about upgrading itself when running `pkg upgrade -y`



In principle, yes. But isn't rebootstrapping pkg the most practical way to resolve the version mismatch error problem? I've run into that error a few times, and rebootstrapping always fixes it. 

What other solution would you propose when all the version numbers match, but pkg update still complains of a mismatch?


----------



## SirDice (Jul 22, 2019)

jordanch said:


> Why does it still complain of the same thing?


Update your jail.


----------



## pinned (Aug 2, 2022)

I recently upgraded my host machine from 13.0-RELEASE to 13.1-RELEASE and was prompted to confirm a couple of config files (sshd_config and another) prior to merging. All went well.

I have a few thick jails which encountered the jails pkg version mismatch errors.

So I proceeded to update the jail like this.

```
# freebsd-update -b /usr/jail/demo0/ fetch install
# freebsd-update -b /usr/jail/demo0/ upgrade -r 13.1-RELEASE
# freebsd-update -b /usr/jail/demo0/ install
# service jail restart
# freebsd-update -b /usr/jail/demo0/ install
```

But the pkg version mismatch errors still came up every time a pkg update is run.

```
# pkg -c /usr/jail/demo0 update -f
```

So, I referred to this site https://rubenerd.com/using-freebsd-update-to-upgrade-jails/ which showed another way of update the jail like this...

```
# freebsd-update -b /usr/jail/demo0/ --currently-running 13.0-RELEASE -r 13.1-RELEASE upgrade
```

This time I was prompted to confirm what felt like almost every config file in the jail prior to merging. I have no idea what these config files are, so not sure what to confirm. I gave up after blindly confirming at least 15 config files.

So, my question is... what is the right way to update a thick jail?


----------

