Sunday, July 28, 2024

not empty so not removed dpkg

 dpkg: warning: while removing ghostscript, directory '/var/lib/ghostscript/CMap' not empty so not removed


dpkg: warning: while removing ghostscript, directory '/usr/share/man/de/man1' not empty so not removed


dpkg: warning: while removing ghostscript, directory '/etc/ghostscript/cidfmap.d' not empty so not removed



sudo rmdir  --ignore-fail-on-non-empty /var/lib/ghostscript/CMap 

sudo rmdir  --ignore-fail-on-non-empty /usr/share/man/de/man1 

sudo rmdir  --ignore-fail-on-non-empty /etc/ghostscript/cidfmap.d



dpkg: error processing package libpaper1:i386 (--configure):

 installed libpaper1:i386 package post-installation script subprocess returned error exit status 10

Setting up grub-efi-amd64 (2.06-2ubuntu14.5) ...

dpkg: error processing package grub-efi-amd64 (--configure):

 installed grub-efi-amd64 package post-installation script subprocess returned error exit status 10

Setting up foomatic-filters (4.0.17-13) ...

dpkg: error processing package foomatic-filters (--configure):

 installed foomatic-filters package post-installation script subprocess returned error exit status 10

dpkg: dependency problems prevent configuration of grub-efi:

 grub-efi depends on grub-efi-amd64 (>= 2.06-2ubuntu7.2); however:

  Package grub-efi-amd64 is not configured yet.

sudo apt --only-upgrade install grub-efi-amd64-signed


Errors were encountered while processing:

 libpaper1:i386

 grub-efi-amd64

 foomatic-filters

 grub-efi

 grub-efi-amd64-signed


sudo dpkg --configure -a

sudo apt-get -f install

sudo apt install libavahi-glib1 --reinstall


sudo rm -rf  libpaper1:i386  grub-efi-amd64 foomatic-filters grub-efi

 grub-efi-amd64-signed



Manually Removing Corrupt Package Files

We can also resolve this error by removing the problematic package’s entry from the dpkg database. After removing the entry, we can reconfigure the package and fix the broken dependencies. However, manually editing the dpkg status file can be risky and lead to system instability if not done correctly. Therefore, we must back up the file before applying any changes.

To begin editing the file, we first need to open the /var/lib/dpkg/status file in the gedit text editor. This file contains information about all the packages installed on our system.

Let’s open the file with the gedit text editor:

$ sudo gedit /var/lib/dpkg/status

Next, we need to locate the entry for the package that’s causing problems. Then, after finding all the files related to the package, we should carefully delete them one by one.

After we’ve removed the files, we can save the changes to the status file and close gedit.

Next, let’s configure all unpacked and unconfigured packages:

$ sudo dpkg --configure -a

To ensure that all packages are correctly installed, let’s fix the broken dependencies:

$ sudo apt -f install
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status