Method 1: Reconfigure Package Database
The first method you can try is to reconfigure the package database. Probably the database got corrupted while installing a package. Reconfiguring often fixes the problem.sudo dpkg --configure -a
Method 2: Use force install
If a package installation was interrupted previously, you may try to do a force install.sudo apt-get install -f
Method 3: Try removing the troublesome package
If it’s not an issue for you, you may try to remove the package manually. Please don’t do it for Linux Kernels (packages starting with linux-).sudo apt remove
Method 4: Remove post info files of the troublesome package
This should be your last resort. You can try removing the files associated to the package in question from /var/lib/dpkg/info. for example the package name is "desktop-base"ls -l /var/lib/dpkg/info | grep -i desktop-base
sudo rm -rf /var/lib/dpkg/info/desktop-base*
Use the sudo apt update and then you should be able to install software as usual.
reference article: https://itsfoss.com/dpkg-returned-an-error-code-1/
0 Comments:
Post a Comment