Ubuntu强制卸载软件Package is in a very bad inconsistent state - you should reinstall it before attempting a removal
简介
解决卸载或安装软件包时,出现错误 “Package is in a very bad inconsistent state - you should reinstall it before attempting a removal.”
先执行下述命令 卸载XXXXXX
1 | sudo dpkg --remove --force-remove-reinstreq XXXXXX |
之后可以根据需求 选择执行下述命令
1 2 3 4 5 | sudo apt-get install XXXXXX //此条为安装命令 sudo apt-get purge XXXXXX //此条为卸载命令 |
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | root@lhrubuntu1404:/# apt list --installed | grep post WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts. postfix/now 2.11.0-1ubuntu1.2 amd64 [installed,upgradable to: 2.11.0-1ubuntu1.2] root@lhrubuntu1404:/# dpkg -r postfix dpkg: error processing package postfix (--remove): package is in a very bad inconsistent state; you should reinstall it before attempting a removal Errors were encountered while processing: postfix root@lhrubuntu1404:/# dpkg -L postfix Package 'postfix' does not contain any files (!) root@lhrubuntu1404:/# dpkg --remove --force-remove-reinstreq postfix dpkg: warning: overriding problem because --force enabled: dpkg: warning: package is in a very bad inconsistent state; you should reinstall it before attempting a removal (Reading database ... 33745 files and directories currently installed.) Removing postfix (2.11.0-1ubuntu1.2) ... root@lhrubuntu1404:/# apt list --installed | grep post WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts. root@lhrubuntu1404:/# aptitude install -y git make gcc apt-utils vim bzip2 gnupg2 libtinfo5 No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 3 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used. |