Here’s what happened

The newly developed JAR package is deployed on the old server and is Red Hat Enterprise Linux AS Release 4 (Nahant Update 5). The older JDK tells you that the gliBC version is too low to upgrade, yes, like a nesting baby. Upgrade glibc from 2.3 to 2.9 using compiled source code. The ls command does not work. LD_PRELOAD = ls/LD_PRELOAD = ls/LD_PRELOAD Of course I’m mildly ocD, and then

#reboot
Copy the code

There is no then. The operating system won’t get up. Various attempts, the best result is stuck in

Starting cups-config-daemon:Starting HAL daemon:
Copy the code

Never go down again. 007’s server was put into ICU by 996 programmers. You see, taking down servers makes it look innocent. Deleting libraries seems too deliberate, will be accused of character problems.

Rescue the train of thought

Perform a reverse process like Credo, overwriting glibc-related static and dynamic libraries with the original lower version. Cp overrides and install RPM overrides together.

A necessary condition for

  • You can access the equipment room and directly operate the server, because SSH cannot be connected.
  • A Linux CD-ROM of the same version is available. The Linux rescue mode requires the CD-ROM boot.
  • Have the iso image file of the same Linux operating system to obtain RPM [or alternative method]
  • A server or virtual machine with the same version of Linux for downloading. A files.

The preparatory work

The RPM installation package

Unzip the ISO file in

RHEL4.6 - i386 - AS - DVD/RedHat/RPMSCopy the code

The RPM package directory contains all required RPM packages. The following installation packages need to be prepared:

A Static library file

Download the following library files from the corresponding directory of the good server with the same version

/ lib directory



The directory/usr/lib

Place the installation packages and static libraries on a usb drive that plugs into the server.

The rescue process

Accessing the CD-ROM System

Put the CD into the drive.

Power on quickly press F2 to enter

Adjust the boot sequence by +- sign, and adjust the CD-ROM to the top

Press Enter to restart the system and enter the CD-ROM boot interface



Press F5 to enter



The Linux rescue



Press Enter, wait a moment, enter

Press Enter to enter



Press Enter to enter



Press Enter to enter

Move the cursor to No and press Enter to enter



Press Enter to enter



The system is mounted to/MNT /sysimage. Press Enter to enter the rescue mode. In the CD-ROM system environment, all files of the original system are stored in the subdirectory/MNT /sysimage of the CD-ROM system.



You can see that all directory structures of the original system are visible under/MNT /sysimage.

Mount the U disk

First, mount the USB disk to the OPTICAL disk system,

mount -t vfat /dev/sdb1 /mnt/usb/
Copy the code

The IDENTIFIER of a USB flash drive may not be Sdb1 in different environments, but may be sda1 on a physical machine. You can run the fdisk -l command to check the capacity of each directory to determine which usb flash drive is used.

If the format of the USB flash drive is incorrect (it may be fat16 format), run mount -t msdos /dev/sdb1 / MNT /usb/ to try

At this point, all files in the USB disk are under/MNT/USB /, and all files in the original system are under/MNT /sysimage. Copy the files from the USB directory to any directory you can remember under/MNT /sysimage. Copy this article to/MNT /sysimage/home.

cp /mnt/usb/* /mnt/sysimage/home
Copy the code

Switch to the original system

perform

#chroot  /mnt/sysimage
Copy the code

This command will switch you from the current CD system to the original system (the system we are trying to salvage), execute PWD and ls to see that the directory you are in is the root directory of the original system, and the account is root of the original system.

In a word, the original system directly into not go, but from the CD-ROM system jump, is able to jump into.

Install the RPM

Enter/home,

RPM -ivh --force RPM package nameCopy the code

Install the RPM package of usb flash drive one by one. Install failure to wait for the success of all installed back to try again, and answer questions will not be a gameplay, are dependent on the relationship to bring about failure.

Better to rename RPM itself to a shorter name (glibccomm.rpm) without the “-“. At that time, I saw the name displayed on the monitor including garbled characters and question marks, so I guessed which bag it was, and regretted not naming it before.

Replace static library files

Then manually replace static libraries (*.a files) for /lib and /usr/lib with cp directives.

cp /home/libpthread.a  /libcp /home/*.a  /usr/lib
Copy the code

Modify the dynamic library soft link

Manually modify the soft link of the dynamic library

You are advised to manually modify the software connection regardless of whether the software connection is automatically modified during RPM package installation. To the /lib directory, first

Rm *2.9* # delete the higher version libraryCopy the code

then

1 ln -sf libutil-2.3.4.solibutil.so. 2 ln -sf libnss_nis-2.3.4.solibnss_nis-so -sf libnss_nisplus-2.3.4. Solibnss_nisplus.so.2 ln -sf libnss_hesiod-2.3.4. Solibnss_hesiod.so.2 ln -sf So libnss_files.so.2 ln -sf libnss_dns-2.3.4.so libnss_dns.so.2 ln -sf libnss_dns.so.2 ln -sf Libnss_compat-2.3.4.solibnss_compat.so. 2 ln -sf libnsl-2.3.4.solibnsl.so.1 ln -sf libdl-2.3.4.solibdl.so.2 ln -sf Libcrypt - 2.3.4. Solibcrypt. So. 1 ln - sf libBrokenLocale - 2.3.4. SolibBrokenLocale. So. 1 ln - sf libanl - 2.3.4. Solibanl. So. 1 ln Libpthread.so.0 ln -sf libpthread.so.0 ln -sf libpthread.so.0 ln -sf libpthread.so.0 ln -sf libpthread.so.0 ln -sf libpthread.so.0 ln -sf libpthread.so.0 ln -sf libpthread.so.0 ln -sf libpthread.so.0 ln -sf libpthread.so.0 ln -sf libpthread.so.0 Libm - 2.3.4. Solibm. So. 6Copy the code

Jump back to the CD system

Exit to jump back to the CD system,



Enter Exit again at the cursor above and press Enter to restart the system.

Immediately modify the BIOS, set the system to boot from the hard disk, the original system can boot normally.

End and spend

The successful rescue is quite a sense of achievement! You can try anything else that brings down the server, as long as you can reverse that operation again, it’s not a problem. Why not reinstall it? What was deployed there was put there years ago, so there’s no way to start again. Why dare to upgrade? I’ve seen someone update RHEL6.6 glibc without incident. I had no idea it could go so wrong. If you don’t have a CD with the same version, a close one will do. The disc I actually use is RHEL4.6, which is a small size different from the original system. RPM and. A files can be obtained on the line, not according to the method of this article. The solution to replace SO provided by netizens is unreliable and must be installed by RPM. 2.3 Upgrade to 2.9 cannot, does not mean upgrade to 2.4 cannot, the recent version may be successful. The server is still running, and the JAR packages are deployed to other servers.