Undefined symbol “ssh_compat13” referenced from COPY relocation in /usr/sbin/sshd

After mass upgrading my FreeBSD jails I noticed that most of them became unreachable.

The cause of this was that the upgrading of the libraries failed due not having permissions to use chflags.

After some searching around I noticed that you first have to enable chflags on your jail and after run the upgrade.

Use the following steps to fix this issue and successfully upgrade.

Get jail ID (we use 5 in our example)

Enable chflags for jid 5 and start a shell.

In the jail run freebsd-update to upgrade to the new release but first override the UNAME_r having the previous version of your installation.

Then run freebsd-update like you would normally do after.

You may have to repeat the last step multiple times depending if there are any kernel updates.