📜 ⬆️ ⬇️

Impose yourself a cast

Hello, helper readers.
One difficult evening at work when installing new packages on a server under Ubuntu, a message suddenly appeared that dependencies crashed, the version of libc6 is not the same. Automatic correction of dependencies offered to demolish half of the system, which naturally did not suit me. I decided for myself that I would remove this libc6, put the correct version and everything will be fine.
sudo apt-get remove libc6 simple sudo apt-get remove libc6 nothing happened, so I applied sudo dpkg --remove --force-all libc6 , but some kind of error sudo dpkg --remove --force-all libc6 out. After this error, I could not do anything ( ls , dir , sudo and other commands were not found, only cd worked). Then suspicions crept into my soul that I did something terrible, especially when I read point 24 of this article .
Who cares how to cast a plaster, please under the cat.

Googling led me to a Wikipedia article saying that libc6 is a C library that provides system calls and basic functions such as open, malloc, printf, etc., and is also used for all dynamically linked programs. After that, it immediately became clear why most of the teams did not work. Fortunately, all the server services that were already running worked, so all employees of the company quietly continued their work in normal mode. It was clear that if the server is turned off, the system will simply not boot (we like cleaners to pull out power outlets from the outlets and switchboard power supplies), and I worked through ssh, the session could not be duplicated, therefore the disconnection of the network connection would be a crash .
Until the end of the working day, I did not manage to find a solution to the problem, so when I got home, I took my old laptop and rolled the same system (Ubuntu Server 12.04), deleted libc6 again and began to furiously understand.
During my searches I found out that it was enough for the libraries to lie in their places, it remains to figure out where to get them and how to throw them. In Ubuntu, the default is the static-sh command, which runs BusyBox, which could help, but in my case, the ssh session was not as root, and the sudo command did not work.
Do nothing, make a bootable USB flash drive from Ubuntu, and load the laptop from it.
I looked through all the hard drives and mounted the system disk:
  fdisk -l mount /dev/hda1 /mnt/ 

It so happened to gain access to the files of the murdered system. After that, the library files themselves were required, the benefit of the deb-package is easily searched here (you need to remember to choose your own release of the operating system).
I went to the tmp folder, downloaded the package there (respecting the system capacity), unpacked it and put the received files in their places
  cd /mnt/tmp wget http://security.ubuntu.com/ubuntu/pool/main/e/eglibc/libc6_2.15-0ubuntu10.5_amd64.deb dpkg -x libc6_2.15-0ubuntu10.5_amd64.deb libc6_files cp -R libc6_files/* / 

After restarting the system, I sighed with relief, now it was launched.
Having repeated these actions on the server, I again encountered broken dependencies. But I knew that I had unpacked the necessary version, but how can this be explained to the system? I tried to find any files in which it was written which packages were installed and which version, in order to edit them myself, but I did not find them (if there are any, tell about them, please).
I tried to install the recently downloaded package again, and I received:
 A copy of the C library was found in an unexpected directory: '/lib/x86_64-linux-gnu/libc-2.15.so' 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 right through: rebuild the package, correcting 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 system displayed the desired version of libc6.

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.

')

Source: https://habr.com/ru/post/212259/


All Articles