Hello, habrachitateli.
One difficult evening at work, when installing new packages on a server under Ubuntu, a message suddenly appeared that the dependencies were broken, the version of libc6 is supposedly not the same. Automatic dependency correction suggested demolishing half of the system, which naturally did not suit me. I decided for myself that I will remove this libc6, put the right version and everything will be fine.
It wasn’t easy sudo apt-get remove libc6to delete anything, so I applied it sudo dpkg --remove --force-all libc6, but some kind of error came out . After this error, I could not do anything ( ls, dir, sudoand other teams were not found, but worked cd). Then, suspicions crept in my soul that I had done something terrible, especially when I read paragraph 24 of this article .
Who cares how the gypsum was applied, please, under cat.

Googling led me to a Wikipedia article saying libc6 is a C library that provides system calls and basic functions like open, malloc, printf, etc., and is also used for all dynamically linked programs. After that, it immediately became clear why most teams did not work. Fortunately, all the server services that were already running worked, so all the employees of the enterprise calmly continued their work in normal mode. It was clear that if the server was turned off, the system would simply not boot up (we like cleaning staff to pull out plugs and power supplies from switches), and I worked through ssh, I couldn’t duplicate the session, so breaking the network connection would crash .
Until the end of the working day, I still could not find a solution to the problem, so when I got home, I took my old laptop and rolled the same system on it (Ubuntu Server 12.04), uninstalled libc6 again and started to sort it out violently.
During my searches, I found out that it is enough that the libraries are in their places, it remains to figure out where to get them and how to drop them. In Ubuntu, by default, there is a command static-shthat starts BusyBox, which could help, but in my case the ssh session was not root, and the sudo command did not work.
There is nothing to be done, I made a bootable USB flash drive with Ubuntu, and booted the laptop from it.
I looked through all the hard drives and mounted the drive with the system:
 fdisk -l
 mount /dev/hda1 /mnt/

It so happened to gain access to the files of the killed system. After that, the library files themselves were required, since the deb package is easily searched for here (you must remember to choose your own edition of the operating system).
I went to the tmp folder, downloaded the package there (observing the bit depth of the system), unpacked it and put the received files in their places
 cd /mnt/tmp
 dpkg -x libc6_2.15-0ubuntu10.5_amd64.deb libc6_files
 cp -R libc6_files/* /

Rebooting the system, I breathed a sigh of relief, now it started.
Repeating these steps on the server, I again ran into broken dependencies. But I knew that I had unpacked the necessary version, but how to explain this to the system? I tried to find some files that spelled out which packages were installed and which version, so I could edit them myself, but I didn’t find them (if there are any, tell us about them, please).
I tried installing the recently downloaded package again, and received what:
A copy of the C library was found in an unexpected directory:
It is not safe to upgrade the C library in this situation;
please remove that copy of the C library or get it out of
'/lib/x86_64-linux-gnu' and try again.

I had to go ahead: rebuild the package, tweaking the checks.
# Распаковываем
 dpkg-deb -R /tmp/libc6_2.15-0ubuntu10.5_amd64.deb /tmp/libc6_package
# В текстовом редакторе удаляем все надписи exit 1
 editor /tmp/libc6_package/DEBIAN/preinst
# Собираем
dpkg-deb -b /tmp/libc6-package
dpkg -i /tmp/libc6-package.deb

After that, the correct version of libc6 was displayed on the system.

PS The post may seem short, but I did not find a solution to this problem in RuNet, the English-language Internet also contains a small amount of information on this topic.

Also popular now: