Since Ubuntu 19.04 and Debian 10 the
usrmerge package has been installed by default. The package makes symlinks between
/usr/lib64 ensuring that any file appears in both places. There’s more detail on why this has been done at The Case for the /usr Merge and Understanding the bin, sbin, usr/bin, usr/sbin split.
The downside of this merging is that some packages that write files to both
/lib (looking at you
libpng12-0) now fail, because one of the symlinks now effectively point at themselves and cause the install to fail:
The following additional packages will be installed: libpng12-0 The following NEW packages will be installed: libpng12-0 0 upgraded, 1 newly installed, 0 to remove and 2294 not upgraded. 2 not fully installed or removed. Need to get 0 B/173 kB of archives. After this operation, 273 kB of additional disk space will be used. Do you want to continue? [Y/n] y (Reading database ... 602063 files and directories currently installed.) Preparing to unpack .../libpng12-0_1.2.50-2+deb8u3_amd64.deb ... Unpacking libpng12-0:amd64 (1.2.50-2+deb8u3) ... dpkg: error processing archive /var/cache/apt/archives/libpng12-0_1.2.50-2+deb8u3_amd64.deb (- -unpack): unable to install new version of '/usr/lib/x86_64-linux-gnu/libpng12.so.0': No such file or directory Errors were encountered while processing: /var/cache/apt/archives/libpng12-0_1.2.50-2+deb8u3_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
The key line being
unable to install new version of '/usr/lib/x86_64-linux-gnu/libpng12.so.0': No such file or directory . If you have an older package that depends on libpng12-0 you’re out of luck unless you can get it installed. So what to do?
There are various solutions floating around, including installing from a 3rd-party PPA, but I didn’t fancy that. It turns out that it’s actually very easy (but only once you’ve read the whole of the internet) to repackage libpng12-0 from the official sources and successfully install it. Here’s what I did:
# Add older sources to your apt list # If you need a non-Intel version (e.g. arm64) you'll need to use # http://ports.ubuntu.com/ubuntu-ports instead of http://archive.ubuntu.com/ubuntu echo "deb http://archive.ubuntu.com/ubuntu trusty main universe multiverse" | tee -a /etc/apt/sources.list.d/trusty.list echo "deb http://archive.ubuntu.com/ubuntu trusty-security main universe multiverse" | tee -a /etc/apt/sources.list.d/trusty.list # pull in the updates sudo apt update # Download the original package into /tmp cd /tmp && apt download -y libpng12-0 # extract it to /tmp/libpng sudo dpkg-deb -R libpng12-0_1.2.50-1ubuntu2.14.04.3_arm64.deb libpng # now remove the problematic symlink that causes the error rm -rf /tmp/libpng/usr/ # and now repackage it sudo dpkg-deb -b libpng libpng-fixed.deb # finally install from your fixed package apt install -y /tmp/libpng-fixed.deb # Tidy up and remove those old apt sources sudo rm /etc/apt/sources.list.d/trusty.list # forget about them sudo apt update
- Patch for aarch64 (aka arm64) openssl 1.0.2 'relocation R_AARCH64_PREL64 against symbol OPENSSL_armcap_P error'
- TIL: the `NO_COLOR` informal standard to suppress ANSI colour escape codes
- Copy the contents of a branch into an existing git branch without merging
- Adding search to a static Jekyll site using pagefind
- asdf, python and automatically enabling virtual envs