My Pi has run fine for months. Maybe I added a package during that time that messed it up on reboot.

Today when I logged in to Raspian I get the last login and Debian welcome message then I get

-bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file or directory 

followed by a repetition of

rasberrypi login:

How can I repair the install and get out of this login loop. Can I pull the SD card and add the file somehow?

It's like catch 22. I can't fix anything without getting into a terminal but I can't get into a terminal cause I can't login.

  • Can you look through your history and see which packages you have added, or which config file you changed? Sep 16, 2015 at 20:26

2 Answers 2


Libtinfo is an ncurses library; bash uses this to get information about the terminal it is in in order to implement certain features correctly.

It is a fairly fundamental thing since the default shell (bash) requires it. Installing some package would never cause this library to be removed, so something stranger than that has happened.

It could be that the root filesystem is damaged, so the first you should try is to run e2fsck on it. For this you probably require another linux system where you can insert the card. If you don't have one, use a live CD or a virtual machine image (if you are not familiar with this concept, for MS windows, see the first thing here).

There are many explanations of fsck (of which e2fsck is a particular form) online.


I had this same agonizing problem running Xubuntu 14.04. The login screen accepted my username and password, and then reappeared. I also had the repeated login prompt as described by the OP.

At some point I saw that libtinfo.so.5 was a symlink to libtinfo.so.5.9, and the latter file was missing. Using a live CD, I took that file from the ubuntu packages, placed it into /lib/i386-linux-gnu/, and computer got past the login screen.

This took 24 hours to resolve, most of which was dedicated to following repairs offered by users having the same symptom but different root cause. The frustration and fear, followed by elation and relief, was the typical bipolar cycle we all suffer in the debugging world.

  • 1
    Hmm. While a nice answer, I don't think there are any live CDs for raspberry pi, or that the i386 lib file would do any good. If you would rephrase you answer to that it is a better fit for raspbian, you'll get a +1 from me.
    – Bex
    Dec 30, 2015 at 13:05
  • 1
    Yeah, a binary from a desktop live CD could not possibly work on the pi...
    – goldilocks
    Dec 30, 2015 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.