Having fun while upgrading Debian 10 to 11.
The Problem
The following error is thrown during a Debian upgrade from Buster to Bullseye:
/usr/bin/python3: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
The file /lib/x86_64-linux-gnu/libcrypt.so.1
used to be in package libc6
on Stretch and Buster until it was split off into a separate libcrypt in Bullseye (and in Sid).
When upgrading libc6
the system ends in a situation where libcrypt.so.1
is removed before a replacement from a new package is installed.
The Workaround
This is the repo file /etc/apt/sources.list
:
deb [arch=amd64] http://ftp.uk.debian.org/debian/ bullseye main contrib non-free deb-src http://ftp.uk.debian.org/debian/ bullseye main contrib non-free deb [arch=amd64] http://security.debian.org/debian-security bullseye-security main contrib non-free deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free deb [arch=amd64] http://ftp.uk.debian.org/debian/ bullseye-updates main contrib non-free deb-src http://ftp.uk.debian.org/debian/ bullseye-updates main contrib non-free deb [arch=amd64] http://deb.debian.org/debian bullseye-backports main contrib non-free deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
And these are the steps that I used to resolve the problem:
$ cd /tmp $ apt download libcrypt1 $ dpkg-deb -x libcrypt1_1%3a4.4.33-2_amd64.deb . $ sudo cp -av lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/ $ sudo chmod 1777 /tmp $ sudo apt --fix-broken install
References
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=993755
This finally fixed my issues with upgrading buster. Thanks a lot!
No worries, you’re welcome!
Me too. Fixed my install as well. Many Thanks!
Thanks! This worked going from Buster to Bookworm too
You’re welcome!
This is how I ended up on this post as well :)
This saved my raspberry pi’s card from being reformated!
Thanks!!
Thanks dude! Awesome work!
Thanks for the fix, worked perfect!
Thanks, this saved the day!
works perfectly
Thanks, this saved the day too!
Thanks!
great!!
really thank you! It torched me a lot
Thanks a lot, you safe my mental health.
No worries at all. I understand you so well.
thanks, saved me some headache too
This one helped, but it also created a new issue. By unpacking to /tmp/, the privileges of the /tmp were changed to 755, so afterwards apt-get update would complain that it cannot create new folders. The solution was to run
sudo chmod 1777 /tmp
after the whole operation, maybe you can add that for other users so they can just copy all the lines.
Thanks Frank, the article has been updated.
What’s the solution when this happens on a linode instance in the cloud?
I can’t get a login. Do I have to wipe my system and start over?
If you have a support plan with Linode, then your best bet is to contact them and ask for assistance. If you don’t, then you’ll likely need to restore from a backup and start over I’m afraid.
This saved the day too here, thank you
thax so mush!!!
Thanks a million, saved me upgrading from 2019 so kinda expecting things to blow up 😆 been afk for awhile
Thanks for sharing.
I was doing an update/upgrade from Jessie to Buster
and then from Buster to Bookworm.
I got stuck on that part, and thanks to your info, you probably saved me a lot of time.
Thanks for sharing.
I upgraded from 10 to 12 and I get that error.
Everything in the fix goes well up to the point to copy, then I get the same result; account locked and vm is dead, blackscreen at login.
Someone knows how to fix ?
Thanks a lot!
thank you
Hey, we were struggeling with a update from buster to bookworm.
the exact same issue appeared and your workaround worked great.
thank you for sharing
I ran into this symptom in a different situation, while trying to upgrade python from 3.7.3 to >= 3.8 inside WSL2.
I ran your commands but `apt –fix-broken install` still had libc failing, with perl not finding libcrypt.so.1.
The recently copied `/usr/local/x86_64-linux-gnu/libcrypt.so.1` symlink was also now gone.
I had success instead, temporarily pointing the linker to the `libcrypt.so.1` that we downloaded and unpackaged. (I used and set permissions on `/tmp/libcrypt/` instead of `/tmp/`.)
“`
(as root:)
echo “/tmp/libcrypt/usr/lib/x86_64-linux-gnu” >> /etc/ld.so.conf.d/libcrypt-tmp-fix.conf
ldconfig
apt –fix-broken install
rm /etc/ld.so.conf.d/libcrypt-tmp-fix.conf
ldconfig
apt install python3
“`
I think it might have also worked if I had inserted and run `ldconfig` into your steps immediately before `apt –fix-broken install`.
Saved my lab VM and saved my day, now. Many thanks!