7

Is it possible to have a vanilla installation of Ubuntu 14.04 (Trusty) and run inside it containerized older Ubuntu versions that originally came with older kernels?

For example for 12.04 I'd assume the answer is yes as it has linux-image packages for subsequent Ubuntu releases, such as linux-image-generic-lts-saucy and linux-image-generic-lts-quantal. For 10.04 that isn't the case, though, so I'm unsure. But is there documentation available that I can use to deduce what's okay to run?

The reason I am asking is because the kernel interface undergoes updates every now and then. However, it's sometimes beneficial to run newer versions of the distro and at the same time keeping a build environment based on a predecessor.

0xC0000022L
  • 16,593

2 Answers2

7

You can run older Linux programs on newer kernels. Linux maintains backward compatibility (at least for all documented interfaces), for the benefit of people who are running old binaries for one reason or another (because they don't want to bother recompiling, because they've lost the source, because this is commercial software for which they don't have the source, etc.).

If you want to have a build environment with older development tools, or even a test environment for anything that doesn't dive deeply into kernel interfaces, then you don't need to run an older kernel, just an older userland environment. For this, you don't need anything complex: a chroot will do. Something more advanced like LXC, Docker, … can be useful if you want the older (or newer, for that matter) distribution to have its own network configuration. If you don't want that, you can use what Debian uses precisely to build software in a known environment (e.g. build software for Debian stable on a machine with a testing installation): schroot. See How do I run 32-bit programs on a 64-bit Debian/Ubuntu? for a guide on setting up an alternate installation of Debian or a derivative in a chroot.

If you want to run the older distribution's kernel, you'll need an actual virtual machine for that, such as KVM or VirtualBox. Linux-on-Linux virtualization with LXC or the like runs the same kernel throughout.

  • I know there is a backward compatibility. But it's not so trivial, is it? Why else would linking against GLIBC leave an annotation header in ELF files stating a certain kernel ABI. Think about the move from 32bit time_t to 64bit time_t which is an incompatible change. So what's the cutoff point? – 0xC0000022L Jun 16 '14 at 07:52
  • @0xC0000022L Linux still supports a.out binaries. Which have been obsoleted by ELF since 1998 or so. Newer Linux kernels support the older ABI; the kernel ABI indication is there because newer applications may not run on other kernels. – Gilles 'SO- stop being evil' Jun 16 '14 at 08:06
  • other == newer? With GLIBC unfortunately things are even more convoluted, but that's a different story. Thanks. – 0xC0000022L Jun 16 '14 at 08:34
  • i have the related question: how can a base installation running, say, 3.10 of the kernel, support a docker image of, say, Ubuntu based on version 4 of the kernel? – Otheus Mar 06 '16 at 14:51
2

➜ codetv_static# docker run ubuntu:10.04 /bin/echo 'Howdy!' Unable to find image 'ubuntu:10.04' locally 10.04: Pulling from library/ubuntu a3ed95caeb02: Pull complete 86b54f4b6a4e: Pull complete Digest: sha256:f6695b2d24dd2e1da0a79fa72459e33505da79939c13ce50e90675c32988ab64 Status: Downloaded newer image for ubuntu:10.04 Howdy!

kwerle
  • 129