2

I was installing some packages and during the install of one, the system hung and the package was not installed. But, the package was added to the list of installed packages. So, I restart the system and I try the following:

  • When I try to remove the package, it doesn't work because it can't find a config file.

  • When I try to install the package, it says the package is already installed, and therefore won't install it

  • When I try to update, it tries to remove the package, and encounters the error above.

So, my question is asking if there's a way to manually remove a package from the list of installed packages, or is there another way to solve this problem?

When I run: sudo apt-get upgrade

Error is:

Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be REMOVED: libglade2.0-cil libglib2.0-cil libgtk2.0-cil 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. 18 not fully installed or removed. After this operation, 2,819 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 119043 files and directories currently installed.) Removing libglade2.0-cil (2.12.26-0xamarin1) ... E: File does not exist: /usr/share/cli-common/packages.d/policy.2.8.glade-sharp.installcligac dpkg: error processing package libglade2.0-cil (--remove): subprocess installed post-removal script returned error exit status 1 Removing libgtk2.0-cil (2.12.26-0xamarin1) ... E: File does not exist: /usr/share/cli-common/packages.d/policy.2.6.gtk-dotnet.installcligac dpkg: error processing package libgtk2.0-cil (--remove): subprocess installed post-removal script returned error exit status 1 Removing libglib2.0-cil (2.12.26-0xamarin1) ... E: File does not exist: /usr/share/cli-common/packages.d/policy.2.6.glib-sharp.installcligac dpkg: error processing package libglib2.0-cil (--remove): subprocess installed post-removal script returned error exit status 1 Errors were encountered while processing: libglade2.0-cil libgtk2.0-cil libglib2.0-cil E: Sub-process /usr/bin/dpkg returned an error code (1) 
1
  • What if you just create the missing file. Does that make the post-removal script happy? Commented Apr 8, 2017 at 18:18

2 Answers 2

4

There are a couple of approaches to try.

The first is to fix /usr/share/cli-common/policy-remove so it doesn’t fail if the policy is absent: edit its last line so that it runs rm -f instead of rm. That should allow the packages to be removed correctly.

If that fails, and since you’re trying to remove all the Mono packages, it should be safe enough to remove the failing postrm scripts:

sudo rm /var/lib/dpkg/info/lib{glade,glib,gtk}2.0-cil.postrm 

The only operation the postrm scripts do is unregister the policies, which you don’t care about since you’re removing everything anyway.

You’re not the only person to have suffered from this issue: it was reported in 2012 as Debian bug 692962.

0

Had the same issue on ubuntu 22 in 2025. Thanks to Stephen Kitt's answer I was able to figure it out.

My issue was not only about libglib but about libnunit too.

To make the uninstall go smoothly I had to trash not only the .postrm files but also the .prerm files of /var/lib/dpkg/info/libnunit*.

And after uninstalling successfuly I took a look at each of those trashed file to try to manually uninstall what I could.

And it turns out that some of those files try to uninstall /usr/share/cli-common/gac-package-remove libnunit-core-interfaces2.6.3-cil by using - instead of .. I was able to fix it by sudo /usr/share/cli-common/policy-remove nunit.core.interfaces 2.6 on the nunit files I had trashed.

Here is the content of those files:

 File: libnunit-console-runner2.6.3-cil.postrm_1 #!/bin/sh set -e # Automatically added by dh_cligacpolicy/UNDECLARED if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/share/cli-common/policy-remove ]; then /usr/share/cli-common/policy-remove nunit-console-runner 2.6 fi # End automatically added section ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── File: libnunit-core2.6.3-cil.postrm #!/bin/sh set -e # Automatically added by dh_cligacpolicy/UNDECLARED if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/share/cli-common/policy-remove ]; then /usr/share/cli-common/policy-remove nunit.core 2.6 fi # End automatically added section ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── File: libnunit-core-interfaces2.6.3-cil.postrm #!/bin/sh set -e # Automatically added by dh_cligacpolicy/UNDECLARED if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/share/cli-common/policy-remove ]; then /usr/share/cli-common/policy-remove nunit.core.interfaces 2.6 fi # End automatically added section ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── File: libnunit-core-interfaces2.6.3-cil.prerm #!/bin/sh set -e # Automatically added by dh_installcligac/UNDECLARED if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/share/cli-common/gac-package-remove ]; then /usr/share/cli-common/gac-package-remove libnunit-core-interfaces2.6.3-cil fi # End automatically added section ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── File: libnunit-framework2.6.3-cil.postrm #!/bin/sh set -e # Automatically added by dh_cligacpolicy/UNDECLARED if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/share/cli-common/policy-remove ]; then /usr/share/cli-common/policy-remove nunit.framework 2.6 fi # End automatically added section ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── File: libnunit-framework2.6.3-cil.prerm #!/bin/sh set -e # Automatically added by dh_installcligac/UNDECLARED if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/share/cli-common/gac-package-remove ]; then /usr/share/cli-common/gac-package-remove libnunit-framework2.6.3-cil fi # End automatically added section ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── File: libnunit-mocks2.6.3-cil.postrm #!/bin/sh set -e # Automatically added by dh_cligacpolicy/UNDECLARED if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/share/cli-common/policy-remove ]; then /usr/share/cli-common/policy-remove nunit.mocks 2.6 fi # End automatically added section ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── File: libnunit-mocks2.6.3-cil.prerm #!/bin/sh set -e # Automatically added by dh_installcligac/UNDECLARED if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/share/cli-common/gac-package-remove ]; then /usr/share/cli-common/gac-package-remove libnunit-mocks2.6.3-cil fi # End automatically added section ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── File: libnunit-util2.6.3-cil.postrm #!/bin/sh set -e # Automatically added by dh_cligacpolicy/UNDECLARED if [ "$1" = "remove" ] || [ "$1" = "upgrade" ] && [ -x /usr/share/cli-common/policy-remove ]; then /usr/share/cli-common/policy-remove nunit.util 2.6 fi # End automatically added section 

You must log in to answer this question.