Upgrade to 11.2 failure

Polytropon freebsd at edvax.de
Fri Dec 21 05:25:54 UTC 2018


On Thu, 20 Dec 2018 13:51:59 -0500, Scott Ballantyne wrote:
> I'm running 10.4, so the obvious thing to do (which a few people pointed
> out)
> was to upgrade to 11.2 or 12.x.

Depends. In my (very individual) opinion, the obviois thing
to do would be to install 12.0 directly, instead of using
the freebsd-update tool.

Allow me to share my experience so far:

When updating FreeBSD _within_ a certain major version number,
using freebsd-update usually does a wonderful job, especially
on "boring servers", systems that do not run anything one would
call "special", and especially not Firefox or Emacs. :-)

But when switching from one major version to the next, or even
worse, from version n to version n+2 or n+3 (yes, that can also
happen!), doing a fresh install seems to be the easiest way. I
make a list of "top ports", those software pieces I actually
want to use, and I don't care about their dependencies as pkg
can resolve them on its own. Then I install the fresh OS, and
feed the list into pkg. Finally I pull configuration files
from backup / CVS and make the neccessary adjustments. This of
course only works when you can have scheduled downtime, but I
usually make sure this is being arranged properly.

Changes that require you to adjust configuration files can
happen on two fronts: first the OS, then the software from
ports you're using. Taking configurations and using them 1:1
doesn't always work.

As it has been discussed in an earlier thread, dependencies
also might change (new ones appearing, old ones disappearing,
required version numbers changing), so having pkg deal with
them is the most convenient thing.

Of course, the OS libraries are different after a major version
upgrade, so you will have to pay attention to that fact,
especially as pkg is a port, and not really part of the OS
(the base system); the /usr/sbin/pkg program is just a stub.
So the first thing you need to do after the OS update is to
update pkg, either by using the stub as "pkg-static upgrade -f",
or you reinstall it from ports (after "portnap fetch extract").
It's also important to make sure that pkg's and portsnap's
configuration files use the same source ("Latest" or "Quarterly",
as the default source changed during FreeBSD 11, if I remember
correctly).



> I've used FreeBSD-update many times, no problems. So I proceeded to do this.
> All went as expected until the pkg-static upgrade -f step, which core
> dumped. i ran
>  a debugger on it, but it is compiled with no symbols, so I can't give much
> more detail.

There could be a simple explanation:

If you call "pkg-static", /usr/local/sbin/pkg-static will be used,
which is obsolete as it matches the previous OS version. You could
try to explicitely use the OS-provided stub to upgrade the installed
pkg first.



> Out of curiosity, I ran pkg-static to update my emacs. That identified
> hundreds of
> binaries whose ABI had changed, so I updated those.

Again, this is to be expected due to the OS version change.



> pkg-static upgrade -f
> still
> seg faulted after that, so I tried pkg-static autoremove after which it
> updated
> a few files. I finished with the required final run of freebsd-install and
> rebooted.

What is "freebsd-install"? Do you mean "freebsd-update"? You should
have completed all its steps _before_ turning to ports.



> Now I couldn't login at all. The system wasn't recognizing my credentials.
> I booted to single-user, thinking
> that perhaps I had made an error in editing the password files during the
> merge, but they were fine.

Has the pkd_mkdb step been performed? It is required after the
password text files get altered.



> I also
> discovered that even after the apparently successful runs of
> freebsd-install and pkg-static upgrade -f that
> there was software on the system that couldn't find the proper libraries to
> run.

Correct, as this software hasn't been upgraded yet.

As I said before, starting with a clean ports tree often saves
you from that kind of trouble (FreeBSD n.x -> n+1.y). You can
either create the list yourself, or use "pkg info" as a source
list, and trim it down to only contain what you're _really_
using (no version numbers!). That list can be fed into pkg
after removing all installed software.

As FreeBSD makes a difference between "the OS" and "everything
else", it's safe to remove /usr/local altogether, use mtree to
restore the directory tree, remove pkg databases, and checkout
a new ports tree with portsnap; first thing to be done is to
install pkg (by stub or by ports), and then go ahead and install
what you need. The portsnap step is only required if you install
something from source.

Yes, I know, this procedure isn't written very well, and it's
not even worthy being called a procedure, but I'm sure you can
follow its basic idea. :-)

By the way, as long as pkg is "somehow working", you can use
pkg-delete to delete installed software.



> This was obviously a disaster. Fortunately, I had taken zfs snapshots of
> the filesystems prior to the upgrade
> and was able to roll things back to the point where only the GUI was hosed.
> So once again, thanks are
> due to the creators and porters of ZFS.

Yes, that was an excellent step to think about beforehand.



> Obviously, many people have succeeded in doing this and perhaps I made some
> error, although, as I have said
> I have done this many, many times. It does seem that the freebsd-update/pkg
> system is more fragile than
> I have thought. This isn't a big deal for the stuff I have at homes, but I
> have come to rely on this combo
> to update systems to which I don't have physical access. Now I am a bit
> concerned about doing that.

I think you encountered a severe version mismatch here, resulting
in strange behaviour and corrupted installs.



> When I have more time, I will go back to my older method of building the
> system from source. But for now
> this will have to do.

This is, in my opinion, not your problem. Your system has been
updated binarily as expected, but your ports (which pkg belongs
to) have not been treated properly.

Personally, building OS from source is something I only do for
very few exceptions. I have done so in the past regularly (and
with custom kernels), but today, I prefer the convenience of
using freebsd-update for everything that's not an exception. :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list