I'm trying to install a package that has been removed from my Ubuntu release (17.10). Specifically, I'm trying to install libpng12-dev, which is a dependency of another program I'm trying to install, very similar to what this question asks about.

As discussed in that question, I can manually install the package pretty easily, but using a package manager is the preferred way to install packages, which I agree with.

I tried to adapt ffmurray's answer and combine it with the instructions at help.ubuntu.com, coming up with this:

sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/ xenial main"

However, apt-get update gives me this error:

The repository 'http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng xenial Release' does not have a Release file.

I'm not sure what's wrong, or if something like this can even work.

The question

Using apt (or other package managers), is there a proper way to install packages from previous Ubuntu releases like this? I realize that compatibility and stability become suspect when doing this, but I'd still like a semi-clean way of doing it.

Note that I'm looking for a general answer for previous release packages, not just libpng.

Partial solution while writing this question

On the libpng12-dev package page, within the "links for libpng12-dev" section, "download source package" subsection, there is a link for the package description. On a hunch, I removed the file name from the link address, which allowed me to browse the archive and figure out a few conventions.

It turns out I was over-specifying the site URL, and I only needed the http://site.domain/ubuntu/ portion of the URL. The remainder is resolved by supplying the Ubuntu release name (xenial), category (main), and package in apt-get (libpng12-dev).

So instead, I should have done:

sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ xenial main"

followed by

sudo apt-get update

After that,

sudo apt-get install libpng12-dev

Ran flawlessly!

I'm not sure how hacky this is as a solution. I feel like building/installing from source is a more robust way of dealing with older packages, but I'm not sure if that's true, nor how to do it.

Now that I somewhat know what I'm looking at, this answer regarding PPAs seems to support that this is, in fact, a good way of adding previous release packages.

If there's a better way, I'd sure like to know.

  • 3
    The 'proper', support-channel answer is: Don't mix packages from different releases of Ubuntu. It's not a supported action. When you run into trouble (like a version conflict that breaks apt), you're on your own until you uninstall the wrong-version packages and disable the wrong-version sources. – user535733 Feb 13 '18 at 1:48
  • Instead, install a supported release of Ubuntu that does have the packages you want. You will find life to be much more satisfying if you have not Frankenstein-ed your system...and your system won't be unstable (nor violently afraid of fire). – user535733 Feb 13 '18 at 1:48
  • 1
    For your specific situation, most libpng12-dev is handled in 17.10 by libpng-dev. See apt show libpng-dev – user535733 Feb 13 '18 at 1:54
  • @user535733 For this specific case, the program suite I'm trying to install is dependent on libpng12-dev. During installation, it can't find libpng12-dev and fails out. Wouldn't the installer fail to recognize libpng-dev as an acceptable substitute? – drmuelr Feb 13 '18 at 2:02
  • Well, that's a different question. Since your 'installer' is seemingly not apt, then support for that application must come from whomever created and distributed it. You should, of course, point out to them the bug in their installer if it does indeed require an obsolete/dropped package. Many third-party installers are simply shell scripts, and easily edited. – user535733 Feb 13 '18 at 2:07

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.