新手问题 只要执行 apt-get 命令,就会出现如下错误,求大神,帮帮忙

fage108 · 2018年03月23日 · 最后由 fage108 回复于 2018年03月28日 · 5078 次阅读
$ sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev

sudo: unable to resolve host lhc-rd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
liblzma-dev is already the newest version (5.1.1alpha+20120614-2ubuntu2).
patch is already the newest version (2.7.5-1).
ruby-dev is already the newest version (1:2.3.0+1).
zlib1g-dev is already the newest version (1:1.2.8.dfsg-2ubuntu4.1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
4 not fully installed or removed.
Need to get 0 B/21.7 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "zh_CN.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
dpkg: error processing package libgvc6-plugins-gtk (--configure):
 package libgvc6-plugins-gtk is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: dependency problems prevent configuration of libgraphviz-dev:
 libgraphviz-dev depends on libgvc6-plugins-gtk (= 2.38.0-12ubuntu2.1); however:
  Package libgvc6-plugins-gtk is not installed.

dpkg: error processing package libgraphviz-dev (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of libmagickcore-6.q16-dev:amd64:
 libmagickcore-6.q16-dev:amd64 depends on libgraphviz-dev; however:
  Package libgraphviz-dev is not configured yet.

dpkg: error processing package libmagickcore-6.q16-dev:amd64 (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of libmagickwand-6.q16-dev:amd64:
 libmagickwand-6.q16-dev:amd64 depends on libmagickcore-6.q16-dev (= 8:6.8.9.9-7ubuntu5.9); however:
  Package libmagickcore-6.q16-dev:amd64 is not configured yet.

dpkg: error processing package libmagickwand-6.q16-dev:amd64 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 libgvc6-plugins-gtk
 libgraphviz-dev
 libmagickcore-6.q16-dev:amd64
 libmagickwand-6.q16-dev:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

ps: 改过 /var/lib/dpkg/info目录,没用,如下:

#先备份原来的,然后重新新建

sudo mv /var/lib/dpkg/info /var/lib/dpkg/info.bak //现将info文件夹更名
sudo mkdir /var/lib/dpkg/info //再新建一个新的info文件夹
sudo apt-get update

#不用解释了吧,修复安装

apt-get -f install xxx
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info.bak

#执行完上一步操作后会在新的info文件夹下生成一些文件,现将这些文件全部移到info.bak文件夹下

sudo rm -rf /var/lib/dpkg/info //把自己新建的info文件夹删掉
sudo mv /var/lib/dpkg/info.bak /var/lib/dpkg/info //把以前的info文件夹重新改回名字


1、备份你的dpkg的status

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

2、编辑status文件

sudo vim /var/lib/dpkg/status

3、查找你出问题的软件包,在本文中就是万恶的libgvc6-plugins-gtk, libgraphviz-dev, libmagickcore-6.q16-dev, libmagickwand-6.q16-dev

在vim中

/ldap-account-manager

[c-sharp] view plain copy

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

4、全删除整个关于libgvc6-plugins-gtk, libgraphviz-dev, libmagickcore-6.q16-dev, libmagickwand-6.q16-dev,保存退出

5、保证格式

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

6、现在已经找不到llibgvc6-plugins-gtk, libgraphviz-dev, libmagickcore-6.q16-dev, libmagickwand-6.q16-dev包了,重新安装
msg7086 回复

感谢您的回复!这个我没试过,我觉得是 OK 的,比我上面解决方法方便太多了。

fage108 关闭了讨论。 07月13日 09:12
需要 登录 后方可回复, 如果你还没有账号请 注册新账号