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"
sudo apt-get update
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.

  • 5
    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, 2018 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, 2018 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, 2018 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, 2018 at 2:02
  • 2
    I think "proper" way is to download 1-3 packages manually and install them manually. Do not mix releases in sources.list.
    – N0rbert
    Feb 13, 2018 at 7:36

2 Answers 2


Well there is no perfect way, each case has its own limitations. Personally, go with quicker and easier option first.

  1. Check upstream project's documentation, merge requests, patches & bug tracker, to see if anyone reported and solved it. Then decide

  2. Look for PPA if there any.

  3. Try its package by adding older release repository. Following similar method you mention and explained in my answer here. Few rules for easy and clean role back.

    • Test in a machine not in production (VirtualBox, ...)
    • Add *-update & *-security repositories too.
    • Record the log for changes (new installed packages and removed ones)
    • Remove these repositories right after completing the installation.
    • Keep in mind this is like PPA with old packages which it may lead to unmet dependencies in the future.

    Expect issues like conflict with default installed packages and try to remove bunch of packages. This happens much with :i386 multi-arch packages like with wine. Review packages list while installation, it can even remove the desktop and leave you with command line boot.

  4. Install from source

  5. Update the package or Repackage it and upload it to a PPA, if you are advanced user.

    Here a trick that works sometimes: Copy that package to your own PPA and ask it to build it for your current distribution.


use this:

sudo add-apt-repository ppa:linuxuprising/libpng12
sudo apt update
sudo apt install libpng12-0 libpng12-dev

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .