Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1758864
  • 博文数量: 323
  • 博客积分: 5970
  • 博客等级: 大校
  • 技术积分: 2764
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-03 23:13
文章分类

全部博文(323)

文章存档

2018年(2)

2017年(11)

2016年(10)

2015年(27)

2014年(2)

2013年(30)

2012年(197)

2011年(44)

分类: LINUX

2016-12-03 20:54:11

Ubuntu下,dpkg安装出错的修复

参考

 

我在ubuntu上安装ldap-account-manager的时候出错,

当sudo aptitude install ldap-account-manager

出现如下错误:


[c-sharp] view plain copy
 print?
  1. Reading package lists... Done  
  2. Building dependency tree  
  3. Reading state information... Done  
  4. Reading extended state information  
  5. Initializing package states... Done  
  6. Building tag database... Done  
  7. The following NEW packages will be automatically installed:  
  8.   "" class='replace_word' title="PHP知识库" target='_blank' style='color:#df3434; font-weight:bold;'>PHP-fpdf php5 php5-ldap  
  9. The following NEW packages will be installed:  
  10.   php-fpdf php5 php5-ldap  
  11. 0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.  
  12. Need to get 108kB of archives. After unpacking 868kB will be used.  
  13. Do you want to continue? [Y/n/?] y  
  14. Writing extended state information... Error!  
  15. E: I wasn't able to locate file for the ldap-account-manager package. This might mean you need to manually fix this package.  


当我sudo dpkgdpkg -i ldap-account-manager2.4.all.deb

出现如下错误:


[c-sharp] view plain copy
 print?
  1. Selecting previously deselected package ldap-account-manager.  
  2. (Reading database ... 44030 files and directories currently installed.)  
  3. Preparing to replace ldap-account-manager 2.4.0-1 (using ldap-account-manager2.4.all.deb) ...  
  4. Unpacking replacement ldap-account-manager ...  
  5. dpkg (subprocess): unable to execute old post-removal script: Exec format error  
  6. dpkg: warning - old post-removal script returned error exit status 2  
  7. dpkg - trying script from the new package instead ...  
  8. dpkg: error processing ldap-account-manager2.4.all.deb (--install):  
  9.  subprocess new post-removal script returned error exit status 10  
  10. dpkg: error while cleaning up:  
  11.  subprocess post-removal script returned error exit status 10  
  12. Errors were encountered while processing:  
  13.  ldap-account-manager2.4.all.deb  


这时候,

apt-get remove --purge,apt-get -f install

都不管用了

后来看了一人的解决方案,甚是感激啊。

其实就是将dpkg的status删除,我怎么就没有想到呢?

 

首先,确定以下命令不能用


[java] view plain copy
 print?
  1. sudo aptitude update  
  2. sudo aptitude -f install  


然后,确定以下命令不能用


[java] view plain copy
 print?
  1. sudo dpkg --force all --remove  


如果都不行,恭喜你,你的dpkg真的有问题了。

现在开始

1、备份你的dpkg的status

sudo cp /var/lib/dpkg/status ~/backup/dpkg/

2、编辑status文件

sudo vim /var/lib/dpkg/status

3、查找你出问题的软件包,在本文中就是万恶的ldap-account-manager

在vim中

/ldap-account-manager


[c-sharp] view plain copy
 print?
  1. 6474 Package: ldap-account-manager  
  2. 6475 Status: deinstall reinstreq half-installed  
  3. 6476 Priority: extra  
  4. 6477 Section: web  
  5. 6478 Installed-Size: 12268  
  6. 6479 Maintainer: Roland Gruber   
  7. 6480 Architecture: all  
  8. 6481 Version: 2.4.0-1  
  9. 6482 Depends: php5 (>= 5.1), php5-ldap, apache | apache-ssl | apache-perl | apache2 | httpd, php-fpdf, debconf (>= 0.2.26) | debconf-2.0  
  10. 6483 Suggests: ldap-server, php5-mcrypt, ldap-account-manager-lamdaemon, perl  
  11. 6484 Conffiles:  
  12. 6485  /etc/ldap-account-manager/shells newconffile  
  13. 6486  /etc/ldap-account-manager/config.cfg newconffile  
  14. 6487  /etc/ldap-account-manager/passwordMailTemplate.txt newconffile  
  15. 6488  /etc/ldap-account-manager/apache.conf newconffile  
  16. 6489 Description: webfrontend for managing accounts in an LDAP directory  
  17. 6490  LDAP Account Manager (LAM) runs on an existing webserver.It manages user, group  
  18. 6491  and host accounts. Currently LAM supports these account types:  
  19. 6492  Samba 2 and 3, Unix, Kolab 2, address book entries, NIS mail  
  20. 6493  aliases and MAC addresses. There is a tree viewer included to  
  21. 6494  allow access to the raw LDAP attributes. You can use templates  
  22. 6495  for account creation and use multiple configuration profiles.  
  23. 6496  Account information can be exported as PDF file. There is also  
  24. 6497  a script included which manages quotas and homedirectories.  
  25. 6498 Homepage: http://lam.sourceforge.NET/  


4、全删除整个关于ldap-account-manager的package,保存退出

5、保证格式

保证下一个package和上一个package中间有一行空行。

6、现在已经找不到ldap-account-manager包了,重新安装。当然aptitude已经可以正常使用了。

阅读(2872) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~