17

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

Elazar Leibovich
  • 3,231
  • 5
  • 27
  • 28
  • 4
    Must be, but... oh, so much pain. – tshepang May 03 '11 at 12:34
  • Possibly, but you'll need to give more details. What OS (version of Debian/Ubuntu) precisely, and more imporantly what is the legacy software, and what libc version does it use? I think ldd would tell you something. If possible you may need to recompile the legacy libc library and/or install/recompile supporting packages. Depending on how old your app is, this could get tricky. I see current Debian libc6 depends on libc-bin (= 2.13-0exp5) and libgcc1, so libc6 doesn't have a lot of dependencies, but you could still run into problems. – Faheem Mitha May 03 '11 at 13:15

1 Answers1

8

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.

  • If one already has the newer version installed, can he start from that and then, on top of the newer, install the older one into /old/etch? – n611x007 Nov 07 '12 at 14:06
  • @naxa Yes, in fact that's the situation described here, but it works in the same way if you go the other way round (newer chrooted in the older). I did in fact write a debootstrap/schroot tutorial a few days after writing this answer, I've added the link. – Gilles 'SO- stop being evil' Nov 07 '12 at 19:05