debian ubuntu – Installing Two Versions of glibc

debiandynamic-linkingglibcUbuntu

Is it possible to install and use two different glibc versions on the same machine. Where one version is only used to run legacy software, which relies on old glibc binaries?

Is it possible to do that with the aid of the package manager (something like "install this package, and its dependencies, to /opt/old-glibc), instead of managing it dire

Best Answer

Yes, it's possible. You'll have to be very careful with the library load paths, and you may need to recompile some other libraries.

As the path of least friction, I recommend installing an older version of Debian or Ubuntu in a chroot. That is, make a directory, say /old/etch, and install the older distribution in the tree rooted there; to run that problematic program, call chroot to restrict its view of the filesystem to /old/etch.

Debian (or Ubuntu) comes with a package to assist with installing another system in a chroot: schroot (successor of dchroot). First, use debootstrap to install the older distribution (install only the base system and what your program needs, no servers). Then set up schroot to run the program conveniently (with /dev, /proc, /home and other “satellite” filesystems accessible).

So the plan is: debootstrap, then dchroot. In How do I run 32-bit programs on a 64-bit Debian/Ubuntu?, I give a tutorial about a similar setup − whether you're running different versions of the distribution, or different architectures, or different Debian-like distributions, it's only a matter of selecting the appropriate package source, the rest is the same.