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.
Best Answer
Well there is no perfect way, each case has its own limitations. Personally, go with quicker and easier option first.
Check upstream project's documentation, merge requests, patches & bug tracker, to see if anyone reported and solved it. Then decide
Look for PPA if there any.
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.
Expect issues like conflict with default installed packages and try to remove bunch of packages. This happens much with
:i386
multi-arch packages like withwine
. Review packages list while installation, it can even remove the desktop and leave you with command line boot.Install from source
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.