Note: This is not for the casual reader. If you are facing any issues with any of the keywords mentioned above, you might want to continue…
So here I was trying to install some packages from a YUM repository on my Ubuntu 8.0.4 system. Why YUM when you have apt-get? Well, let's just say, the situation demanded it.
The installation seemed to be going fine. What I did not realize is that, the installation had innocently relinked my libc files to a new location (actually to an older version of libc). The yum installation failed. Without checking the error, I executed sudo yum install again.
And I got this:
sudo: /lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by sudo) sudo: /lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by /lib/libpam.so.0)
Next I executed ls. Same error! And soon I realized, I was not able to execute most of the commands. The only things running were, things that were already open. I had closed my terminal by then, and was not able to bring it back neither was I able to login in an alternative terminal.
It is extremely difficult to figure out what has gone wrong without a terminal. I tried out various things, but I soon realized that since I don't have sudo access anymore, I won't be able to fix anything in the /lib directory, so no point trying.
The only solution was to reboot in recovery mode and then see if I could relink the libc files. So I popped in the Ubuntu live CD.
Now here is an added twist to the tale. I run Ubuntu on Wubi. So how do I mount my NTFS 'file' which is actually a Linux partition?
With some pointers from my colleague, I realized that it is possible to mount a file as if it were a filesystem. I executed this:
mount /dev/windows/filesystem/containing/wubi/installation /media/disk mount /media/disk/path/to/wubi/disks/root.disk /media/root -o loop
Guess what! The Wubi file got mounted and I was able to access the files.
After some inspection I realized that the problem was that, while Ubuntu has all the libc files in /lib/tls/i686/cmov, the message indicated that these files should be in /lib/tls.
I did a 'ls' in the /lib/tls directory and found that there are some files of an older version of glibc at this location but the live cd version didn't have any files there. So it was apparent this is what is causing the problem.
I unlinked all the files, and relinked them to the new location and rebooted.
This time although it was able to boot Linux, it did not bring up the UI. I booted once again in recovery mode and ran xfix and continued with the boot.
Things seem to be fine now.
Update: Not everything was fine. Some applications, like Totem threw a SEGFAULT. So I did this:
sudo apt-get install --reinstall libc6
Things seem to be fine now.