dpkg 和 apt-get 损毀, 如何修复 ?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
calvin.ngei
帖子: 178
注册时间: 2007-10-14 13:22

dpkg 和 apt-get 损毀, 如何修复 ?

#1

帖子 calvin.ngei » 2009-11-25 21:54

安装 一个deb软件包, 因为 软件包内部 postin 和 prerm 脚本执行出错, 导致dpkg和 apt-get 彻底不能用.
連 synaptic 也不能用,一启动synaptic就报告adobe-flashplugin有问题,然后就退出.
总是提示重新安装该软件包才能remove, 疯了.

代码: 全选

sudo apt-get install remove --purge adobe-flashplugin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package adobe-flashplugin needs to be reinstalled, but I can't find an archive for it.

代码: 全选

sudo dpkg -i adobe-flashplugin_10.0.12.36-1hardy1_i386.deb 
(Reading database ... 123136 files and directories currently installed.)
Preparing to replace adobe-flashplugin 10.0.12.36-1hardy1 (using adobe-flashplugin_10.0.12.36-1hardy1_i386.deb) ...
update-alternatives: error: no alternatives for iceape-flashplugin.
update-alternatives: error: no alternatives for iceape-flashplugin.
dpkg: warning: old pre-removal script returned error exit status 2
dpkg - trying script from the new package instead ...
update-alternatives: error: no alternatives for iceape-flashplugin.
update-alternatives: error: no alternatives for iceape-flashplugin.
dpkg: error processing adobe-flashplugin_10.0.12.36-1hardy1_i386.deb (--install):
 subprocess new pre-removal script returned error exit status 2
postinst called with argument `abort-upgrade'
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 adobe-flashplugin_10.0.12.36-1hardy1_i386.deb

代码: 全选

sudo dpkg -r --force-all adobe-flashplugin
dpkg: warning: overriding problem because --force enabled:
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
(Reading database ... 123135 files and directories currently installed.)
Removing adobe-flashplugin ...
update-alternatives: error: no alternatives for iceape-flashplugin.
update-alternatives: error: no alternatives for iceape-flashplugin.
dpkg: error processing adobe-flashplugin (--remove):
 subprocess installed pre-removal script returned error exit status 2
postinst called with argument `abort-remove'
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 adobe-flashplugin

代码: 全选

sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package adobe-flashplugin needs to be reinstalled, but I can't find an archive for it.
大家说该怎么办?
头像
smallapple
论坛版主
帖子: 7868
注册时间: 2009-03-28 15:12

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#2

帖子 smallapple » 2009-11-25 22:01

把 /var/lib/dpkg/info/ 下面以 adobe-flashplugin 开头的四个文件删除后再试试sudo apt-get -f install 。
calvin.ngei
帖子: 178
注册时间: 2007-10-14 13:22

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#3

帖子 calvin.ngei » 2009-11-25 22:05

qkbeyond 写了:别乱用命令。

新立得直接调用的apt-get 与dpkg 当然有问题。。

试试

代码: 全选

apt-get -f install
你没看清楚, sudo apt-get -f install 己经试过了, 出错!
calvin.ngei
帖子: 178
注册时间: 2007-10-14 13:22

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#4

帖子 calvin.ngei » 2009-11-25 22:08

smallapple 写了:把 /var/lib/dpkg/info/ 下面以 adobe-flashplugin 开头的四个文件删除后再试试sudo apt-get -f install 。
仍然不行!

代码: 全选

sudo dpkg -r adobe-flashplugin
dpkg: error processing adobe-flashplugin (--remove):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
Errors were encountered while processing:
 adobe-flashplugin
头像
smallapple
论坛版主
帖子: 7868
注册时间: 2009-03-28 15:12

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#5

帖子 smallapple » 2009-11-25 22:11

代码: 全选

sudo dpkg -i adobe-flashplugin_10.0.12.36-1hardy1_i386.deb 
呢?
calvin.ngei
帖子: 178
注册时间: 2007-10-14 13:22

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#6

帖子 calvin.ngei » 2009-11-25 22:15

终于解决问题!
这样干的:

按qkbeyond说的,删除 /var/lib/dpkg/info/ 下面以 adobe-flashplugin 开头的四个文件, 然后用 dpkg 把 adobe-flashplugin_10.0.12.36-1hardy1_i386.deb 这个包解开, 删掉 DEBIAN/postin 和 DEBIAN/prerm 两个会导致安装和删除出错的脚本, 重新用 dpkg -b 打包, 重新安装一遍, 再彻底删掉, 就正常了.
calvin.ngei
帖子: 178
注册时间: 2007-10-14 13:22

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#7

帖子 calvin.ngei » 2009-11-25 22:17

smallapple 写了:

代码: 全选

sudo dpkg -i adobe-flashplugin_10.0.12.36-1hardy1_i386.deb 
呢?
你仍然不看清楚1楼的贴子啦~~~
这些基本的我早就试过了, 哼 哼
calvin.ngei
帖子: 178
注册时间: 2007-10-14 13:22

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#8

帖子 calvin.ngei » 2009-11-25 22:22

重新安装必须先解开原来的 deb 包, 删除会导致执行出错的 postin 和 prerm 两个脚本, 重新建立新的 deb 包.
而且在重新安装上一步自己修改过的 deb 包之前还必须把 /var/lib/dpkg/info/ 下面以 adobe-flashplugin 开头的四个文件全部删除.

这两个步骤少任何一个都不行.
头像
smallapple
论坛版主
帖子: 7868
注册时间: 2009-03-28 15:12

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#9

帖子 smallapple » 2009-11-25 22:32

calvin.ngei 写了:
smallapple 写了:

代码: 全选

sudo dpkg -i adobe-flashplugin_10.0.12.36-1hardy1_i386.deb 
呢?
你仍然不看清楚1楼的贴子啦~~~
这些基本的我早就试过了, 哼 哼
意思是先把四个文件删除再sudo dpkg -i adobe-flashplugin_10.0.12.36-1hardy1_i386.deb
你也没看清楚。
calvin.ngei
帖子: 178
注册时间: 2007-10-14 13:22

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#10

帖子 calvin.ngei » 2009-11-26 6:32

smallapple 写了:
calvin.ngei 写了:
smallapple 写了:

代码: 全选

sudo dpkg -i adobe-flashplugin_10.0.12.36-1hardy1_i386.deb 
呢?
你仍然不看清楚1楼的贴子啦~~~
这些基本的我早就试过了, 哼 哼
意思是先把四个文件删除再sudo dpkg -i adobe-flashplugin_10.0.12.36-1hardy1_i386.deb
你也没看清楚。
这早就试过了。
把四个文件删除掉之后,dpkg -i 重装之前必须先把 adobe-flashplugin_10.0.12.36-1hardy1_i386.deb 里面的 postin 和 prerm 脚本去掉,重新建立 deb 包再安装。否则仍然出错。
头像
dash08
帖子: 99
注册时间: 2009-06-15 18:20

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#11

帖子 dash08 » 2009-11-27 11:09

进来学习一下的, :em03
markhsu
帖子: 1
注册时间: 2018-03-27 15:23
系统: ubuntu 16.04

Re: dpkg 和 apt-get 损毀, 如何修复 ?

#12

帖子 markhsu » 2018-03-27 15:25

我也有遇到類似的問題,但還是不知道怎麼處裡。

代码: 全选

mark@mark-GL62M-7RC:~$ sudo apt-get -f install
[sudo] password for mark: 
正在讀取套件清單... 完成
正在重建相依關係          
正在讀取狀態資料... 完成
升級 0 個,新安裝 0 個,移除 0 個,有 1 個未被升級。
5 個沒有完整得安裝或移除。
需要下載 0 B/15.5 kB 的套件檔。
此操作完成之後,會多佔用 0 B 的磁碟空間。
dpkg: error processing package ros-kinetic-voxel-grid (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
No apport report written because the error message indicates its a followup error from a previous failure.
                          No apport report written because the error message indicates its a followup error from a previous failure.
                                                    dpkg: 因相依問題,無法設定 ros-kinetic-costmap-2d:
 ros-kinetic-costmap-2d 相依於 ros-kinetic-voxel-grid﹔然而:
  ros-kinetic-voxel-grid 套件尚未設定。

dpkg: error processing package ros-kinetic-costmap-2d (--configure):
 相依問題 - 保留未設定
dpkg: 因相依問題,無法設定 ros-kinetic-range-sensor-layer:
 ros-kinetic-range-sensor-layer 相依於 ros-kinetic-costmap-2d﹔然而:
  ros-kinetic-costmap-2d 套件尚未設定。

dpkg: error processing package ros-kinetic-range-sensor-layer (--configure):
 相依問題 - 保留未設定
dpkg: 因相依問題,無法設定 ros-kinetic-social-navigation-layers:
 ros-kinetic-social-navigation-layers 相依於 ros-kinetic-costmap-2d﹔然而:
  ros-kinetic-costmap-2d 套件尚未設定。

dpkg: error processing package ros-kinetic-social-navigation-layers (--configure):
 相依問題 - 保留未設定
dpkg: 因相依問題,無法設定 ros-kinetic-navigation-layers:
 ros-kinetic-navigation-laNo apport report written because MaxReports is reached already
        No apport report written because MaxReports is reached already
                                                                      yers 相依於 ros-kinetic-range-sensor-layer﹔然而:
  ros-kinetic-range-sensor-layer 套件尚未設定。
 ros-kinetic-navigation-layers 相依於 ros-kinetic-social-navigation-layers﹔然而:
  ros-kinetic-social-navigation-layers 套件尚未設定。

dpkg: error processing package ros-kinetic-navigation-layers (--configure):
 相依問題 - 保留未設定
處理時發生錯誤:
 ros-kinetic-voxel-grid
 ros-kinetic-costmap-2d
 ros-kinetic-range-sensor-layer
 ros-kinetic-social-navigation-layers
 ros-kinetic-navigation-layers
E: Sub-process /usr/bin/dpkg returned an error code (1)
回复