参考

http://www.khattam.info/2009/08/04/solved-subprocess-pre-removal-script-returned-error-exit-status-2-error/

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

当sudo aptitude install ldap-account-manager

出现如下错误:

  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. 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

出现如下错误:

  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删除,我怎么就没有想到呢?

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

  1. sudo aptitude update
  2. sudo aptitude -f install

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

  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

  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 <post@rolandgruber.de>
  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已经可以正常使用了。

Ubuntu下,dpkg安装出错的修复的更多相关文章

  1. Ubuntu下dpkg安装软件遇到包依赖问题的处理方法

    造冰箱的大熊猫@cnblogs 2019/9/10 向灵魂工程师致敬! 在Ubuntu环境下通过dpkg命令安装deb包时,如果遇到包依赖问题,如 $sudo dpkg -i xxx.deb (Rea ...

  2. Ubuntu使用dpkg安装软件依赖问题解决 ubuntu-tweak ubuntu 16.04 LTS 系统清理

    Ubuntu使用dpkg安装软件依赖问题解决 这里以在ubuntu 16.04安装Ubuntu Tweak为例进行说明,通常安装包依赖问题都可以用这种方法解决: sudo apt-get instal ...

  3. Ubuntu下软件安装方式、PATH配置、查找安装位置

    Ubuntu 18.04, 安装方式 目前孤知道的Ubuntu下安装软件方式有3种(命令): 1.make 2.apt/apt-get 3.dpkg 方式1基于软件源码安装,需要经历配置(可选).编译 ...

  4. Ubuntu下nagios安装(来源官网)

    Ubuntu下nagios安装(来源官网) https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/toc.html h ...

  5. Ubuntu下Zabbix安装及使用问题

    1.configure: error: MySQL library not found MySQL library not found root@kallen:~# apt-get install l ...

  6. Ubuntu下手动安装vscode

    Ubuntu下手动安装vscode1.下载vscodewget https://vscode.cdn.azure.cn/stable/553cfb2c2205db5f15f3ee8395bbd5cf0 ...

  7. [转]:Ubuntu 下Apache安装和配置

    [转]:Ubuntu 下Apache安装和配置_服务器应用_Linux公社-Linux系统门户网站  https://www.linuxidc.com/Linux/2013-06/85827.htm ...

  8. Ubuntu下编译安装postgreSQL 10.5

    Ubuntu下编译安装postgreSQL 10.5 ubuntu 16.04 LTS系统postgreSQL 10.5 安装包准备 1.从PostgreSQL官网下载PostgreSQL的安装包 安 ...

  9. 在Ubuntu下编译安装GreatSQL

    在Ubuntu下编译安装GreatSQL 本次介绍如何利用Docker构建Ubuntu环境,并将GreatSQL源码编译成二进制文件. 1.准备工作 先创建本次Docker的workdir为 /dat ...

随机推荐

  1. Web前端开发笔试&面试_02(others)

    AL>> 1.CSS 3 如何实现旋转图片? 答:transform : rotate 2.写CSS 的工具? 答:LESS.SASS 3.JavaScript 倒计时? 答:setTim ...

  2. Windows WaveIn 录音

    设置采集音频格式 WAVEFORMATEX waveform; //采集音频的格式,结构体 waveform.wFormatTag = WAVE_FORMAT_PCM;//声音格式为PCM wavef ...

  3. OpenXml读取word内容注意事项

    OpenXml读取word内容注意事项 1.使用OpenXml读取word内容,word后缀必须是".docx":如果word后缀是".doc"需要转成&quo ...

  4. 使用fork并发处理多个client的请求和对等通信p2p

    一.在前面讲过的回射客户/服务器程序中,服务器只能处理一个客户端的请求,如何同时服务多个客户端呢?在未讲到select/poll/epoll等高级IO之前,比较老土的办法是使用fork来实现.网络服务 ...

  5. XML基础(一)

    一.简单介绍 1.概念 可扩展标记语言(EXtensible Markup Language),标准通用标记语言的子集,是一种用于标记电子文件使其具有结构性的标记语言.非常类似 HTML.       ...

  6. C# 动态获取代码所在行号

    通过System.Diagnostics.StackTrace获取代码所在行号和文件信息 获取行号信息 /// <summary> /// Get line number of code ...

  7. 修改tmp的临时目录的地址

    https://nkcoder.github.io/2014/04/11/jetty-as-linux-service/ 我们在启动服务的时候添加-Djava.io.tmpdir=/data/jett ...

  8. C++继承 派生类中的内存布局(单继承、多继承、虚拟继承)

    今天在网上看到了一篇写得非常好的文章,是有关c++类继承内存布局的.看了之后获益良多,现在转在我自己的博客里面,作为以后复习之用. ——谈VC++对象模型(美)简.格雷程化    译 译者前言 一个C ...

  9. novas的verdi和debussy是干什么用的(关于debussy的一些介绍)

    source code window: 提供了一个比较友好的界面,将整个设计的source code按设计的层次结构以树状排布,并且可以在代码上反标仿真结果,支持查找.寻找驱动等一些debug常用的操 ...

  10. node js 调试方法

    1. node-debug tutorial 大家对nodejs调试应该都比较头疼,至少我这个不用IDE写js的人很头疼这个,其实node的生态圈非常好 有非常好的工具和非常潮的开发方式 这里总结了3 ...