Pacman trouble again, This time, glibc is the culprit.

glibc
[###########################################] 100%
warning: /etc/locale.gen installed as /etc/locale.gen.pacnew
error: extract: not overwriting dir with file lib
error: problem occurred while upgrading glibc
call to execv failed (Bestand of map bestaat niet)
error: command failed to execute correctly
error: could not commit transaction
error: failed to commit transaction (transaction aborted)
Errors occurred, no packages were upgraded.

Well….. this leaves me with a broken C library. When this happens, do not close any windows or program as without the C library in place, it’s very hard to open a new shell. So…. since I was running pacman to upgrade stuff, which failed, I did have a root shell available, which is essential to fix this problem.

So, the situation, no program would start. It would just say file not found, but what file? Appearently the dynamic linker was broken. Running a program with the dynamic linker manually worked. For example
/lib64/ld-linux-x86-64.so.2 /bin/ls

So, what we have to do… replace the required files manually. So, wehere to get them? We have to know pacman downloads its packages to /var/cache/pacman/pkg/. So, the file we are interested in is /var/cache/pacman/pkg/glibc-2.16.0-2-x86_64.pkg.tar

So, we are going to create a directory and extract the files. As we do have a broken dynamic linker, we need to prefix it manually


/lib64/ld-linux-x86-64.so.2 /bin/mkdir blaat
cd blaat
/lib64/ld-linux-x86-64.so.2 /usr/bin/xz -d /var/cache/pacman/pkg/glibc-2.16.0-2-x86_64.pkg.tar.xz
/lib64/ld-linux-x86-64.so.2 /bin/tar -xvf /var/cache/pacman/pkg/glibc-2.16.0-2-x86_64.pkg.tar

Now, replacing the files…

/lib64/ld-linux-x86-64.so.2 /bin/cp lib64/* /lib64

which leads to the next problem. We have mixed library versions now! We have replaced the /lib64/ld-linux-x86-64.so.2 file however the /usr/lib/libc.so.6 is still the old version. Now we cannot execure anything! Lucky me, busybox provides statically linked binaries, which can solve this problem. Remember when I said not to close any window. I still had a browser open, so I could download this. Then using busybox, prefixing the path to busybox so copy the content of usr/lib to /usr/lib, and finally lib to /lib, making the system work again.

This my friends, was another day on ArchLinux. Feels like being on safari, doesn’t it?