After doing some package installs, the desktop-file-utils
package is now failing to be installed via apt
and aptitude
. This is for Xubuntu 20.04.2
.
When running apt
, I now always get this error:
dpkg: error processing package desktop-file-utils (--configure):
installed desktop-file-utils package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
desktop-file-utils
I know that I can purge this package, but then quite a few of its dependencies will also be uninstalled, and my system is likely to become unusable.
I don't understand what could have caused this problem, because I don't know what I could have done to affect this package.
Is there some way to fix this other than purging desktop-file-utils
and making my system unusable? Also, is there some way where I can get more detailed information about exactly how the post-installation script is failing? If so, perhaps I could debug this.
Thank you in advance for any suggestions.
Let's fix this error step by step.
First, run force install to know the exact problem:
Identify the error:
Mark dependencies as manually installed to prevent them from getting removed;
Remove the post-installation files:
Purge the package:
Re-install the package (Optional):
Explanation
As the error message states:
This usually implies that there are transient issues in the post-installation files.
In the first step, we executed a command that attempted to correct the mistakes.
In step three, we deleted the package's post-installation files.
We purged the package in step four to remove any configuration files.
In step five, we reinstalled the package to make sure it didn't break any other packages.
It turns out that this has nothing to do with packages nor with the
apt
system.I discovered that I had accidentally set
XDG_DATA_DIRS
to point to a non-existent directory.Once I fixed this, the problem went away.
Here are more details as to why this fixed the problem ...
These are the contents of
/var/lib/dpkg/info/desktop-file-utils.postinst
...I ran
update-desktop-database -q
from the command line, and it didn't give any output, but it exited with a non-zero return code.I ran it again like this:
update-desktop-database -v
. This time, it gave an error message which stated that theapplications
subdirectory of the path that is contained inXDG_DATA_DIRS
didn't exist. This showed me that I had setXDG_DATA_DIRS
incorrectly.Once I reset
XDG_DATA_DIRS
to a proper value, theupdate-desktop-database
command started exiting with a zero return code, and thedesktop-file-utils
error inapt
that I mentioned above stopped occurring.