Tuesday, December 11, 2007

How Do I Upgrade the Libraries without Trashing the System?

This article is from the Frequently Asked Questions for Linux, the Free/Open Source UNIX-like operating system kernel that runs on many modern computer systems. Maintained by David C. Merrill with numerous contributions by others. (v1.0).

Warning You should always have a rescue disk set ready when you perform this procedure, in the likely event that something goes wrong!This procedure is especially difficult if you're upgrading very old libraries like libc4. But you should be able to keep libc4 on the same system with libc5 libraries for the programs that still need them. The same holds true for upgrading from libc5 to the newer-yet glibc2 libraries.

The problem with upgrading dynamic libraries is that the moment you remove the old libraries, the utilities that you need to upgrade to the new version of the libraries don't work. There are ways around around this. One is to temporarily place a spare copy of the run time libraries, which are in /lib/, in /usr/lib/, or /usr/local/lib/, or another directory that is listed in the /etc/ file.

For example, when upgrading libc5 libraries, the files in /lib/ might look something like:

These are the C libraries and the math libraries. Copy them to another directory that is listed in /etc/, like /usr/lib/:

$ cp -df /lib/* /usr/lib/
$ cp -df /lib/* /usr/lib/
$ ldconfig

Be sure to run ldconfig to upgrade the library configuration.

The files and are symbolic links to the actual library files. When you upgrade, the new links will not be created if the old links are still there, unless you use the -f flag with cp. The -d flag to cp will copy the symbolic link itself, and not the file it points to.

If you need to overwrite the link to the library directly, use the -f flag with ln.

For example, to copy new libraries over the old ones, try this. Make a symbolic link to the new libraries first, then copy both the libraries and the links to /lib/, with the following commands.

$ ln -sf ./
$ ln -sf ./
$ cp -df* /lib
$ cp -df* /lib

Again, remember to run ldconfig after you copy the libraries.If you are satisfied that everything is working correctly, you can remove the temporary copies of the old libraries from /usr/lib/ or wherever you copied them.



Twitter Delicious Facebook Digg Stumbleupon Favorites More