Fix libpng12-0 Missing In Ubuntu 22.10, 22.04, 21.10 Or 20.04

In this article you'll find a very easy to apply fix that allows installing and running applications that depend on libpng12-0 in Ubuntu 18.04 LTS (or Linux Mint 19.*, which is based on Ubuntu 18.04), Ubuntu 22.10, 22.04, 21.10 Or 20.04 / Linux Mint 21.* and 20.*. This applies to any Ubuntu or Linux Mint flavor: Kubuntu, Xubuntu, Ubuntu MATE, Ubuntu Budgie, Linux Mint Xfce, Linux Mint Cinnamon, etc., as well as Pop!_OS or elementary OS.

The problem


libpng12 is no longer available in the Ubuntu repository archives and as a result, some applications that were not built with the newer libpng (libpng16) library fail to install. This issue is not new, since Ubuntu dropped libpng12 with version 16.10, but those whom are upgrading from Ubuntu 16.04 to 18.04 LTS , as well as Linux Mint 19.* users, might not be aware of this and how to fix it.

Here is an example. Ubuntu Software simply fails to install WPS Office, without displaying any error message, so I opened the WPS Office deb with gdebi-gtk, which doesn't allow the deb to install, displaying this message: "Error: Dependency is not satisfiable: libpng12-0":

libpng12-0 error Ubuntu

Trying to install the same deb from a terminal results in the following libpng12-0 error:

logix@logix-laptop:~$ sudo dpkg -i wps-office_10.1.0.5707_a21_amd64.deb 
[sudo] password for logix: 
Selecting previously unselected package wps-office.
(Reading database ... 354579 files and directories currently installed.)
Preparing to unpack wps-office_10.1.0.5707_a21_amd64.deb ...
Unpacking wps-office (10.1.0.5707~a21) ...
dpkg: dependency problems prevent configuration of wps-office:
 wps-office depends on libpng12-0; however:
  Package libpng12-0 is not installed.

dpkg: error processing package wps-office (--install):
 dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.13.3-11ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for shared-mime-info (1.9-2) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:
 wps-office

Note that some apps can't be installed due to missing libpng12-0, while others simply fail to start.

The fix: install and run applications that require libpng12-0 in Ubuntu 22.10, 22.04, 21.10 or 22.04 / Linux Mint 21.*, 20.* or 19.*


To fix the issue on the now very old Ubuntu 18.04 / Linux Mint 19.* / Pop!_OS 18.04 / elementary OS 5 or 5.1, download the libpng12-0 package for your architecture (you only need one of these, specific for your Ubuntu / Linux Mint architecture):


On that page, scroll down to the Built files section and only download the libpng12-0 DEB package (e.g. on 64bit: libpng12-0_1.2.54-1ubuntu1.1_amd64.deb)!

Install the libpng12-0 deb downloaded by using the link above, and you should be able to install and run applications that still depend on this library, in Ubuntu 18.04 LTS or Ubuntu 18.10 / Linux Mint 19.

To fix the issue on Ubuntu 22.10, 22.04, 21.10 or 20.04 / Linux Mint 21.* or 20.*, you can install libpng by using a PPA I created with an updated libpng12-0 package. Use these commands to add the PPA and install libpng12-0:

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

Or download the libpng12-0 DEB package from the PPA and install it manually (you only need the libpng12-0 DEB package, e.g. libpng12-0_1.2.54-1ubuntu1.1+1~ppa0~eoan_amd64.deb).

The reason this package required an update for Ubuntu 22.10, 22.04, 21.10 and 20.04, is that with Ubuntu 19.04, the /lib directory is a symlink to /usr/lib (this was not the case with Ubuntu 18.04 and older), and this causes the libpng12-0 installation to fail, since this package tries to create a link from /lib/x86_64-linux-gnu/libpng12.so.0 to /usr/lib, which is already a symlink. So the DEB had to be repacked to get it to work on newer Ubuntu versions.

As a result, when trying to install the old libpng12-0 package on Ubuntu (or Pop!_OS, etc.) 22.10, 22.04, 21.10 Or 20.04, you'd get this error:

dpkg: error processing archive libpng12-0_1.2.54-1ubuntu1.1_amd64.deb (--unpack):
 unable to install new version of '/lib/x86_64-linux-gnu/libpng12.so.0': No such file or directory
No apport report written because the error message indicates an issue on the local system
Errors were encountered while processing:
 libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

This error will no longer happen with the version from the PPA.