2

While doing a "sudo apt upgrade", I got a message "error while loading shared libraries: libcrypt.so.1".

When I came back to it some minutes later, if I try to run sudo I now get:

$ sudo -i
Sorry, try again.
Sorry, try again.
sudo: 3 incorrect password attempts
$

In other words, sudo isn't prompting for a password. Is there a way to fix this?

The system is a Raspberry Pi hence running raspbian (debian).


Update (in response to comment from Stephen Kitt):

This looks exactly like an instance of Debian bug #993755 since it occurs while I was applying upgrades to testing (sid); it was setting up libc6; and it broke perl, which broke dpkg.

Here's the tail end of the upgrade...

Preparing to unpack .../6-libc6_2.33-7+rpi1_armhf.deb ...
Checking for services that may need to be restarted...
Checking init scripts...
Unpacking libc6:armhf (2.33-7+rpi1) over (2.28-10+rpt2+rpi1) ...
Setting up libc6:armhf (2.33-7+rpi1) ...
/usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
dpkg: error processing package libc6:armhf (--configure):
 installed libc6:armhf package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 libc6:armhf
E: Sub-process /usr/bin/dpkg returned an error code (1)

I see it's tagged wontfix which is strange for something which breaks an upgrade so badly that, as far as I can see, the only way out is a clean install.

The manual steps to recover in the bugreport don't work because, since I'm not running with elevated privilege, I can't copy into /lib/...

5
  • 1
    I wonder if the missing libcrypt.so.1 is causing sudo's PAM authentication to fail out? See somewhat related Why does my sudo ask for password only once but evaluate thrice? Commented Apr 4, 2022 at 0:27
  • This could be a variant of Debian bug #993755. Do you still have the output from the failed upgrade? Commented Apr 4, 2022 at 4:34
  • @StephenKitt See update to text. It looks like exactly that.
    – StarNamer
    Commented Apr 4, 2022 at 22:31
  • Remove the SD-card of your PI, put it into a card reader, attach that card reader to a Linux PC (any Linux live USB stick will do), open the file /etc/shadow, search for root, change root:*:18970:0:99999:7::: to root::18970:0:99999:7::: (in example the first * has been removed), save file, put SD-card back into your PI, boot, login as root without password and try to fix your problem with superuser.
    – paladin
    Commented Apr 5, 2022 at 0:57
  • @paladin If only I'd seen this before reimaging the SD card! :( I'll remember for next time. :)
    – StarNamer
    Commented Apr 12, 2022 at 0:53

1 Answer 1

0

After reading the bug report, I found the cleanest fix is:

sudo apt upgrade perl-base ; sudo apt upgrade

This will install libcrypt1 which contains the missing libcrypt.so.1; I just tried it on Kali-Linux WSL2.

The above prevents OP’s situation. If you’re already in OP’s situation, use Paladin’s fix first to regain sudo access:

Remove the SD-card of your PI, put it into a card reader, attach that card reader to a Linux PC (any Linux live USB stick will do), open the file /etc/shadow, search for root, change root:*:18970:0:99999:7::: to root::18970:0:99999:7::: (in example the first * has been removed), save file, put SD-card back into your PI, boot, login as root without password and try to fix your problem with superuser.

3
  • EXcept that the OP noted sudo doesn't work Commented Sep 23, 2022 at 7:46
  • Paladin provided a fix of that
    – zencraft
    Commented Sep 23, 2022 at 22:00
  • The only answer is yours. You use sudo, which the OP had already said doesn't work. Therefore right now your answer is of no use. Comments can (and do) get deleted, so if you're relying on one I suggest you incorporate it into your answer Commented Sep 24, 2022 at 6:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .