Skip to content
Advertisement

How to remove a broken installation of glibc

I just attempted to install glibc version 2.19 to my computer as follows:

1) I cloned the glibc git repo with

$ cd ~
$ git clone git://sourceware.org/git/glibc.git

2) I checked out version 2.19 with

$ git co tags/glibc-2.19

3) I made a directory objdir in my home directory, and built the installation there with

$ cd ~/objdir
$ ~/glibc/configure --prefix=$HOME
$ make

4) I tested the make with

$ make check

This gave me an error, but some webpage I found with a Google search told me this particular error wasn’t a big deal. (I wish I could remember what the error and webpage were, but I can’t, and I found the webpage using a computer I don’t have access to right now, so it’s not on my web history where I’m typing now.)

5) I attempted to install glibc with

$ make install

This is where things went crazy for me. The installation failed midway, and, now using a broken glibc, my user account completely stopped working.

Luckily, my system administrator was able to move my .bashrc — which was pointing to the broken glibc under my home directory — and revert me to a default .bashrc. So I can log into my account again and do stuff.

My question is, what should I do to completely remove the broken installation of glibc that resides under my home directory?

Advertisement

Answer

what should I do to completely remove the broken installation of glibc that resides under my home directory

cd && ls -lrt

will show you files and directories that were installed. Likely you have include/, lib/ (or lib64/), etc/ and possibly some more. Simply remove these directories, and you should be fine.

You may also want to read this answer.

Update:

that command shows me all the directories in my home directory, of which there are many.

It lists them in chronological order (newest last), and so all the files that are modified recently are at the bottom. These are the ones you’ll want to remove.

given that i’ve installed things besides glibc to my home directory

I hope you realize by now that installing anything into your home directory is a bad idea(TM).

Assuming you haven’t installed anything after the failed glibc install, and that your failed glibc install happened within last 3 days, the following command is likely to produce satisfactory results:

find include lib etc -mtime -3 | egrep -v '^(include|etc|lib)$' |
  tee /tmp/to-delete

Now examine /tmp/to-delete for any files that you do not want to remove (there shouldn’t be any such files if my assumptions hold).

Finally, remove them with:

cat /tmp/to-delete | xargs rm -rf 

Update2:

unfortunately, i don’t think your “last 3 days” heuristic is going to work here. i installed a bunch of C libraries yesterday — MPFC, GMP, MPC, and glibc — and it’s not at all clear to me which files are part of glibc and not the others.

Ok then. What you want to do is find a list of files that are part of glibc install. You can do so:

cd glibc-2.19-src; mkdir build;
cd build; ../configure --prefix `pwd`/../install
make -j12 all && make install

You now have a “cleanly installed” directory in glibc-2.19-src/install. You can get a list of files there:

cd ../install; find . -type f > /tmp/to-delete

Finally you are ready to clean up:

cd; cat /tmp/to-delete | xargs rm -f

This may still leave some empty directories around, but that’s generally not a big deal. If you want to remove them as well:

cd ~/glibc-2.19-src/install
find . -type d > /tmp/dirs-to-delete
cd; cat /tmp/dirs-to-delete | xargs rm 2>/dev/null

(The last command will fail to remove any non-empty directories, which is exactly what you want.)

Advertisement