We already studied one weird error of dpkg, let’s do another one:
Unpacking replacement libexo-common ... dpkg: error processing /var/cache/apt/archives/libexo-common_0.6.1-1_all.deb (--unpack): unable to open '/usr/share/doc/exo/html/C/images/exo-preferred-applications-internet.png.dpkg-new': No such file or directory
Rather difficult to understand on the first look right? Let’s see in detail what’s usually happening when you get this error.
The first hint comes from the file extension “.dpkg-new”. This extension is used by dpkg to unpack the updated files near the old files. When everything has been unpacked, they are renamed over the old files.
The failure happens precisely when dpkg tries to rename the file (in fact when it tries to fsync() it before the rename)… but why does it fail?
Usually because there are unexpected symlinks (or bind mounts) involved that resulted in two different files being installed in the same directory. For example consider package that provides
/dir2/a-file. Now imagine that on the target system,
/dir1 is a real directory but
/dir2 is a symbolic link that points to
When dpkg processes
/dir1/a-file.dpkg-new everything is fine, but when it tries to process
/dir2/a-file.dpkg-new it will fail because that file is the same than
/dir1/a-file.dpkg-new which has already been renamed.
Diagnosing further the problem requires to understand why there’s a symlink instead of a real directory. It might be two packages that were badly coordinated, or a problem in the package itself because it lacks some code that drops the symlink in the preinst (so that dpkg installs the real directory instead of keeping the symlink).
There might be variations in the way two files end up sharing the same directory, but this simple example should have clarified the nature of the underlying problem.