Solved freebsd-update -b /path/to/jail -r 10.1-RELEASE: Cannot upgrade from 10.1-RELEASE to itself

Hi all,

I have a FreeBSD amd64 system which was running FreeBSD-10.0-RELEASE and I've used freebsd-update(8) (for the first time in my life) for my security updates successfully. I am running a couple of jails on the same system on some paths, in a configuration somewhat like the one mentioned in the Application of Jails section of the Handbook (which, by the way, is removed in its latest versions).

This means that I have a /jails/manage/mroot that is used as the root of all my jails, mounted to /jails/manage/jail1, /jails/manage/jail2, etc.

Yesterday I decided to upgrade from FreeBSD-10.0-RELEASE-p12 to FreeBSD-10.1-RELEASE, again using freebsd-update(8), following the Handbook. Hence, on jail 0 I used # freebsd-update -r 10.1-RELEASE upgrade.

The system downloaded all relevant files, then I entered freebsd-update install, I restarted (as was required by the system), ran freebsd-update install again after rebooting and jail 0 was up-to-date.

As far as the jails are concerned, on the other hand, the procedure fails:
Code:
# freebsd-update -b /jails/manage/jail1 -r 10.1-RELEASE upgrade
freebsd-update: Cannot upgrade from 10.1-RELEASE to itself
I get the same message when running freebsd-update -b /jails/manage/mroot -r 10.1-RELEASE upgrade or if I chroot(8) to the jails as well.

What am I doing wrong that prevents me from upgrading my jails? The same procedure worked seamlessly when I was performing security updates for 10.0-RELEASE.

Thanks all for your time in advance.
 
What am I doing wrong that prevents me from updrading my jails? The same procedure worked seamlessly when I was performing security updates for 10.0-RELEASE.
You're not doing anything wrong. But keep in mind that there's only one kernel (the host's). So your jails are technically already running 10.1. However the userland of the jail would still be 10.0. This problem doesn't present itself with security updates.

I'm not sure how freebsd-update(8) checks this. I'm betting it's only looking at the uname(1) output. It should probably look at freebsd-version(1) instead.
 
Thanks for the answer, SirDice.

I was thinking the same thing (about uname(1) and freebsd-version(1)) but hoped it wouldn't be that bad. That's because freebsd-version(1) shows the right version inside the jails.

What I further thought I could have done - if that was the case, which it seems to be - was that I should have run
Code:
#freebsd-update -b /jails/manage/mroot -r 10.1-RELEASE
#freebsd-update install
inside my jails before running freebsd-update install in jail 0. Maybe that way I could have managed to install binaries correctly (though I am not sure how freebsd-update(8) would have handled the install without seeing the correct kernel).

All in all, if that's the case, I should upgrade to 10.1-RELEASE from sources and then continue with freebsd-update(8) for security updates or stick with sources like I do on all my other machines :).

Thanks again!

I'll leave the thread open for some time in case somebody has a different idea/suggestion.
 
So your jails are technically already running 10.1. However the userland of the jail would still be 10.0.

What is then the recommended way to upgrade the jails after upgrading the host? I suppose that doing a make buildworld from 10.1-RELEASE sources and then make installworld would work?

Guillaume
 
After doing the buildworld and installworld on the host, do installworld on the jails also. There is a -D option for the destination directory that can be used with both installworld and mergemaster(8).
 
Seems like upgrading the jail from sources is the same as upgrading the host from sources, except we skip the installkernel step. I will try that, thanks :)

EDIT: I just found the following link showing the steps.

Guillaume
 
This question is marked as solved but I have not found a solution here.

Inspired by Finch I came to a solution. I was upgrading jails from 9.2 to 9.3. You have to override uname, so that it returns the old version name:
Code:
sh uname-override.sh on
freebsd-update -b /jail/mroot -r 9.3-RELEASE upgrade
freebsd-update -b /jail/mroot install
sh uname-override.sh off
freebsd-update -b /jail/mroot install
Here is the code for the uname-override.sh:
Code:
JAIL_VERSION=9.2-RELEASE

set-e

if ["$1"="on"]; then
        cp "/usr/bin/uname""/usr/bin/uname_system"

        echo 'uname_system "$@" | sed -e "s/[0-9]*\.[0-9]*-RELEASE/'$JAIL_VERSION'/g"' > /usr/bin/uname_override
        chmod a+x /usr/bin/uname_override
        ln -sf"/usr/bin/uname_override""/usr/bin/uname"

        echo "Installed uname with fake version $JAIL_VERSION."

elif["$1"="off"]; then
        if [-x"/usr/bin/uname_system"]; then
                cp -f"/usr/bin/uname_system""/usr/bin/uname"
                rm -f /usr/bin/uname_system
                rm -f /usr/bin/uname_override

                echo "Cleaned up uname override."
        fi
fi
 
Back
Top