The Linux Page

Installation of Debian package with file moved from one package to another

Duplicated files can cause double the trouble when part of a dependent package.

Today I tried to install a new version of a Debian package I created.

That package, let's call it A, now depends on another new package, let's call it B.

A included a file that was installed under /etc/... I removed that file from A because it is also present in B. In other words, the exact same file was being installed by two packages:

  • A (old version)
  • B

Unbeknownst to me, when you try to do so, dpkg gets confused because A also included:

Depends: B

My idea was that since the new version of A does not include the file, it will get removed and then B gets installed and that, in effect, re-installs the file at the same place. That definitely works for me...

But dpkg has a different way of looking at things and in the following file:

/var/lib/dpkg/status-old

It kept track of the now old  file from A and marked it as "obsolete". It also did not delete the actual file (probably because it is under /etc/... and considered a configuration file).

Looking at the list of files from the package:

dpkg-query -L A

the file was gone (that -L command line option simple does a `cat /var/lib/dpkg/info/A.list`).

The problem just did not want to go away. Package B was not getting installed and several other packages had issues while being installed. The one thing that fixed it was to edit that status-old file and delete the line that included the old file. I could then run dpkg/apt-get to install everything properly.