Não é possível instalar nenhum pacote via apt-get

2

Então, meu problema é bem fácil de descrever: não consigo instalar nada na minha instalação do Ubuntu. apt-get parou de funcionar depois que eu tentei corrigir alguns outros erros de pacote que estava recebendo. Agora eu não estou em lugar nenhum.

Deixe-me tentar explicar como acabei nessa situação ...

Eu estava tentando instalar o maven2 . Eu fiz sudo apt-get install maven2 e não funcionou. Ele me disse que git-core está faltando uma nova linha no final. Então, o que eu fiz foi procurar esse erro e tentar consertá-lo. Acabei encontrando um script Python que adicionaria novas linhas aos arquivos em /var/lib/dpkg/info . É aí que tudo piorou ... Nada funcionaria mais e os erros são ainda mais!

Este é o script Python:

import os

dpkg_path = '/var/lib/dpkg/info/'
paths = os.listdir(dpkg_path)
for path in paths:
    path = dpkg_path + path
    f = open(path, 'a+')
    data = f.read()
    if len(data) > 1 and data[-1:] != '\n':
        f.write('\n')
        print 'added newline character to:', path
    f.close()  

Agora, quando tento instalar o maven via sudo apt-get install maven (culpei maven2 por esses erros, então tentei com maven apenas), recebi o seguinte erro:

  

Fetched 49.5 MB in 2min 7s (387 kB/s): error processing package dpkg (--configure): ⠀package dpkg is not ready for configuration cannot configure (current status 'half-installed') Errors were encountered while processing: ⠀dpkg E: Sub-process /usr/bin/dpkg returned an error code (1)

Existem alguns outros comandos apt-get que atualmente não posso lembrar que produziram erros ainda mais longos. Eu atualizarei esta questão se os encontrar novamente.

O que eu faço para corrigir isso?

Editar

Eu fiz o que me foi perguntado na seção de comentários (tentando instalar maven e, em seguida, executar sudo apt-get install -f e esta é toda a saída no terminal:

bash: /etc/bash_completion.d/git: No such file or directory
dugi@Dugi:~$ sudo apt-get install maven
[sudo] password for dugi: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libantlr-java libcommons-validator-java libdoxia-sitetools-java
  libjdependency-java libmaven-archiver-java libmaven-clean-plugin-java
  libmaven-compiler-plugin-java libmaven-dependency-tree-java
  libmaven-filtering-java libmaven-install-plugin-java
  libmaven-jar-plugin-java libmaven-plugin-tools-java
  libmaven-reporting-impl-java libmaven-resources-plugin-java
  libmaven-shade-plugin-java libplexus-compiler-java libplexus-digest-java
  libplexus-velocity-java libwerken.xpath-java velocity
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libaether-java libaopalliance-java libasync-http-client-java libcdi-api-java
  libcglib-java libgeronimo-interceptor-3.0-spec-java libguice-java
  libjackrabbit-java libjcommander-java libmaven-parent-java libnetty-java
  libplexus-classworlds2-java libplexus-cli-java libplexus-containers1.5-java
  libplexus-utils2-java libsisu-guice-java libsisu-ioc-java libwagon2-java
  libyaml-snake-java testng
Suggested packages:
  libaopalliance-java-doc libasync-http-client-java-doc libjcommander-java-doc
  libplexus-classworlds2-java-doc libplexus-cli-java-doc
  libplexus-utils2-java-doc
The following NEW packages will be installed:
  libaether-java libaopalliance-java libasync-http-client-java libcdi-api-java
  libcglib-java libgeronimo-interceptor-3.0-spec-java libguice-java
  libjackrabbit-java libjcommander-java libmaven-parent-java libnetty-java
  libplexus-classworlds2-java libplexus-cli-java libplexus-containers1.5-java
  libplexus-utils2-java libsisu-guice-java libsisu-ioc-java libwagon2-java
  libyaml-snake-java maven testng
0 upgraded, 21 newly installed, 0 to remove and 129 not upgraded.
78 not fully installed or removed.
Need to get 0 B/49.5 MB of archives.
After this operation, 12.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: error processing package dpkg (--configure):
 package dpkg is not ready for configuration
 cannot configure (current status 'half-installed')
Errors were encountered while processing:
 dpkg
E: Sub-process /usr/bin/dpkg returned an error code (1)
dugi@Dugi:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  fop java-wrappers libantlr-java libatinject-jsr330-api-java libbatik-java
  libclassworlds-java libcommons-configuration-java libcommons-io-java
  libcommons-jexl2-java libcommons-jxpath-java libcommons-net2-java
  libcommons-validator-java libcommons-vfs-java libdom4j-java libdoxia-java
  libdoxia-sitetools-java libfop-java libganymed-ssh2-java libguava-java
  libhttpclient-java libhttpcore-java libitext1-java libjaxen-java
  libjdependency-java libjdom1-java libjetty-java libjsoup-java libjsr305-java
  libmaven-archiver-java libmaven-clean-plugin-java
  libmaven-compiler-plugin-java libmaven-dependency-tree-java
  libmaven-filtering-java libmaven-install-plugin-java
  libmaven-jar-plugin-java libmaven-plugin-tools-java
  libmaven-reporting-impl-java libmaven-resources-plugin-java
  libmaven-scm-java libmaven-shade-plugin-java libmaven2-core-java
  libmodello-java libnetbeans-cvsclient-java libplexus-ant-factory-java
  libplexus-archiver-java libplexus-bsh-factory-java libplexus-build-api-java
  libplexus-cipher-java libplexus-classworlds-java libplexus-compiler-java
  libplexus-container-default-java libplexus-containers-java
  libplexus-digest-java libplexus-i18n-java libplexus-interactivity-api-java
  libplexus-interpolation-java libplexus-io-java libplexus-sec-dispatcher-java
  libplexus-utils-java libplexus-velocity-java libqdox-java libslf4j-java
  libwagon-java libwerken.xpath-java libxbean-java libxmlgraphics-commons-java
  libxpp2-java libxpp3-java velocity
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 129 not upgraded.
78 not fully installed or removed.
Need to get 0 B/41.3 MB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: error processing package dpkg (--configure):
 package dpkg is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libbsh-java (--configure):
 package libbsh-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package bsh (--configure):
 package bsh is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libjaxp1.3-java (--configure):
 package libjaxp1.3-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libxalan2-java (--configure):
No apport report written because MaxReports is reached already
                                                              No apport report written because MaxReports is reached already
                                            No apport report written because MaxReports is reached already
                           package libxalan2-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libbsf-java (--configure):
 package libbsf-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libavalon-framework-java (--configure):
 package libavalon-framework-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libcommons-io-java (--configure):
 package libcommons-io-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package java-wrappers (--configure):
 package java-wrappers is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libbatik-java (--configure):
 package libbatik-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libxmlgraphNo apport report written because MaxReports is reached already
                        No apport report written because MaxReports is reached already
      No apport report written because MaxReports is reached already
                                                                    No apport report written because MaxReports is reached already
                                                  No apport report written because MaxReports is reached already
                                No apport report written because MaxReports is reached already
              No apport report written because MaxReports is reached already
                                                                            ics-commons-java (--configure):
 package libxmlgraphics-commons-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libfop-java (--configure):
 package libfop-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package fop (--configure):
 package fop is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libantlr-java (--configure):
 package libantlr-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libatinject-jsr330-api-java (--configure):
 package libatinject-jsr330-api-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libclassworlds-java (--configure):
 package libclassworlds-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: erNo apport report written because MaxReports is reached already
                                                                      No apport report written because MaxReports is reached already
                                                    No apport report written because MaxReports is reached already
                                  No apport report written because MaxReports is reached already
                No apport report written because MaxReports is reached already
                                                                              No apport report written because MaxReports is reached already
                                                            ror processing package libcommons-configuration-java (--configure):
 package libcommons-configuration-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libcommons-jexl2-java (--configure):
 package libcommons-jexl2-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libcommons-jxpath-java (--configure):
 package libcommons-jxpath-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libcommons-net2-java (--configure):
 package libcommons-net2-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libcommons-validator-java (--configure):
 package libcommons-validator-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libcommons-vfs-java (--configure):
 package libcommNo apport report written because MaxReports is reached already
                                                                              No apport report written because MaxReports is reached already
                                                            No apport report written because MaxReports is reached already
                                          No apport report written because MaxReports is reached already
                        No apport report written because MaxReports is reached already
      No apport report written because MaxReports is reached already
                                                                    No apport report written because MaxReports is reached already
                                                  ons-vfs-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libjaxen-java (--configure):
 package libjaxen-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libxpp2-java (--configure):
 package libxpp2-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libxpp3-java (--configure):
 package libxpp3-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libdom4j-java (--configure):
 package libdom4j-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libhttpcore-java (--configure):
 package libhttpcore-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libhttpclient-java (--configure):
 package libhNo apport report written because MaxReports is reached already
                                                                           No apport report written because MaxReports is reached already
                                                         No apport report written because MaxReports is reached already
                                       No apport report written because MaxReports is reached already
                     No apport report written because MaxReports is reached already
   No apport report written because MaxReports is reached already
                                                                 ttpclient-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libitext1-java (--configure):
 package libitext1-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package liblog4j1.2-java (--configure):
 package liblog4j1.2-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libplexus-interpolation-java (--configure):
 package libplexus-interpolation-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libplexus-utils-java (--configure):
 package libplexus-utils-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libplexus-container-default-java (--configure):
 package libplexus-container-default-java is not ready for configuration
 cannot configure (current status 'half-inNo apport report written because MaxReports is reached already
                        No apport report written because MaxReports is reached already
      No apport report written because MaxReports is reached already
                                                                    No apport report written because MaxReports is reached already
                                                  No apport report written because MaxReports is reached already
                                No apport report written because MaxReports is reached already
              stalled')
dpkg: error processing package libjsr305-java (--configure):
 package libjsr305-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libguava-java (--configure):
 package libguava-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libplexus-classworlds-java (--configure):
 package libplexus-classworlds-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libxbean-java (--configure):
 package libxbean-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libplexus-containers-java (--configure):
 package libplexus-containers-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libplexus-i18n-java (--configure):
 package libplexus-i18n-java is not ready for conNo apport report written because MaxReports is reached already
                               No apport report written because MaxReports is reached already
             No apport report written because MaxReports is reached already
                                                                           No apport report written because MaxReports is reached already
                                                         No apport report written because MaxReports is reached already
                                       No apport report written because MaxReports is reached already
                     No apport report written because MaxReports is reached already
   figuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libdoxia-java (--configure):
 package libdoxia-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libexcalibur-logkit-java (--configure):
 package libexcalibur-logkit-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libjdom1-java (--configure):
 package libjdom1-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libwerken.xpath-java (--configure):
 package libwerken.xpath-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package velocity (--configure):
 package velocity is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libplexus-velocity-java (--configure):
 package libplexuNo apport report written because MaxReports is reached already
                                                                               No apport report written because MaxReports is reached already
                                                             No apport report written because MaxReports is reached already
                                           No apport report written because MaxReports is reached already
                         No apport report written because MaxReports is reached already
       No apport report written because MaxReports is reached already
                                                                     s-velocity-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libdoxia-sitetools-java (--configure):
 package libdoxia-sitetools-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libganymed-ssh2-java (--configure):
 package libganymed-ssh2-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libjdependency-java (--configure):
 package libjdependency-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libslf4j-java (--configure):
 package libslf4j-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libjetty-java (--configure):
 package libjetty-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package libjsoup-java (--configure):
 package libjsoup-java is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: too many errors, stopping
Errors were encountered while processing:
 dpkg
 libbsh-java
 bsh
 libjaxp1.3-java
 libxalan2-java
 libbsf-java
 libavalon-framework-java
 libcommons-io-java
 java-wrappers
 libbatik-java
 libxmlgraphics-commons-java
 libfop-java
 fop
 libantlr-java
 libatinject-jsr330-api-java
 libclassworlds-java
 libcommons-configuration-java
 libcommons-jexl2-java
 libcommons-jxpath-java
 libcommons-net2-java
 libcommons-validator-java
 libcommons-vfs-java
 libjaxen-java
 libxpp2-java
 libxpp3-java
 libdom4j-java
 libhttpcore-java
 libhttpclient-java
 libitext1-java
 liblog4j1.2-java
 libplexus-interpolation-java
 libplexus-utils-java
 libplexus-container-default-java
 libjsr305-java
 libguava-java
 libplexus-classworlds-java
 libxbean-java
 libplexus-containers-java
 libplexus-i18n-java
 libdoxia-java
 libexcalibur-logkit-java
 libjdom1-java
 libwerken.xpath-java
 velocity
 libplexus-velocity-java
 libdoxia-sitetools-java
 libganymed-ssh2-java
 libjdependency-java
 libslf4j-java
 libjetty-java
 libjsoup-java
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
dugi@Dugi:~$ 
    
por Aborted 12.06.2014 / 19:12

1 resposta

1

Aqui está um script para desfazer as alterações:

     #!/bin/sh
     files="/var/lib/dpkg/info/*"
     mkdir /tmp/backup
     for i in $files
     do
        cp $i /tmp/backup                # save file in case of errors
        sed '$d' $i > $i.out             # remove last line and put result in .out
        mv  $i.out $i                    # rename file as original
     done

Salvar script em arquivo e exec:

     sudo sh file

Para verificar o resultado, tente

     diff -r /var/lib/dpkg/info /tmp/backup

Se e somente se o diff mostrar apenas uma linha em branco, tente novamente:

     sudo dpkg --configure -a

else restaura o arquivo de / tmp / backup

    
por Lety 12.06.2014 / 23:41