Solved Upgrading to 13.0-RELEASE; locked out of ssh

Hi,

I upgraded to 13.0-RELEASE, and now it looks like the upgrade process broke a dependency, and I am locked out of the server:

Code:
FreeBSD 13.0-RELEASE (GENERIC) #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 04:24:09 UTC 2021
Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

To change this login announcement, see motd(5).
ld-elf.so.1: Shared object "libncursesw.so.8" not found, required by "zsh"

Then since the shell can't start, the SSH connection closes.

Why did this happen? How can I resolve it?
 
I'd attempt booting with a recovery media (i.e. using an ISO if it's a VM or USB media otherwise); then you can mount your root partition and chroot into it. If you're using a regular install media, it should give you an option to run a shell.

Check which disk you need to mount (i.e. use geom disk list). Then mount your root partition. For example, if your root partition is on ada0p1:

mount /dev/ada0p1 /mnt

Then chroot:

chroot /mnt /bin/sh

Then, you should be able to use pw like usual to change your user's shell to one in core, i.e. sh or csh:

pw usermod <user> -s /bin/sh

For future upgrades, I highly recommend having a backup user that uses one of the built-in shells. Or, if you're building your shell from ports - maybe check, if you can do a static build. I believe bash offers that. Not sure about zsh though.

Forgot in intial reply: as to why this happend... upgrading your system updates relevant base libraries that were linked when you installed zsh. The updated libraries may have changed their version numbers, hence the file that your zsh is referencing, no longer exists.
That's why it's quite important to also reinstall all your packages/ports, once you've finished your upgrade.
 
Looks like that you did not reinstall all packages before the last freebsd-update install step.
Did you follow

And the related part about reinstalling all the packages ?

So to answer: Why did this happen ?
The last freebsd-update install command will remove old libraries, but since zsh was not reinstalled it still links to /lib/libncursesw.so.8 instead of /lib/libncursesw.so.9
 
Looks like cmoerz and monwarez were faster, just follow their advice. The problem is your zsh shell, it is not part of the base system. It needs to be reinstalled to function.
 
if you can login at console (you have physical access) just login as root and change your shell to sh or [t]csh
then you can fix missing libs
chsh -s /bin/sh user

or just fix libs as root
 
Here's what I did to upgrade:

Code:
sudo freebsd-update -r 13.0-RELEASE upgrade
It asked me to merge some config files, then
Code:
sudo freebsd-update -r 13.0-RELEASE install
It said:
Code:
Please rebuild all installed 3rd party software (e.g., programs
installed from the ports tree) and then run "/usr/sbin/freebsd-update install"
again to finish installing updates.
But I hadn't installed any ports, so I just went ahead and ran again:
Code:
sudo freebsd-update -r 13.0-RELEASE install

I'm guessing that I missed

24.2.3.2. Upgrading Packages After a Major Version Upgrade​

in the handbook and I should have run "pkg upgrade" after the first "install" and before the second "install." I think I thought I only needed to do anything if ports were installed, not pkg.
 
Well, a package is nothing else than a pre-built port, so if you have packages installed, you do have ports installed :)
 
I ended up fixing it by rebooting into single-user mode via the cloud provider's web console. Then I re-mounted the root filesystem as read/write, changed my user shell to sh, and rebooted back into multi user mode. Then I was able to ssh in and do a pkg upgrade. After than zsh started properly. Thank you for the help, everyone.
 
As the thread originator, you can mark the thread solved. Go to the first post, click the edit button and you'll see there's an option to put in a prefix. One of the prefixes is Solved.
 
Back
Top