Erro ao instalar o Git com o Apt-Get

11

Quando eu tento instalar o git em uma distribuição de servidor do Ubuntu 11.04, recebo um erro. Eu usei o seguinte comando:

sudo apt-get install git

E isso gerou esse erro:

(Reading database ... 
dpkg: warning: files list file for package 'git' missing, assuming package has no files currently installed.
(Reading database ... 20310 files and directories currently installed.)
Preparing to replace git 1:1.7.4.1-3 (using .../git_1%3a1.7.4.1-3_i386.deb) ...
/var/lib/dpkg/tmp.ci/preinst: 12: dpkg-maintscript-helper: not found
dpkg: error processing /var/cache/apt/archives/git_1%3a1.7.4.1-3_i386.deb (--unpack):
 subprocess new pre-installation script returned error exit status 127
/var/lib/dpkg/tmp.ci/postrm: 14: dpkg-maintscript-helper: not found
dpkg: error while cleaning up:
 subprocess new post-removal script returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/git_1%3a1.7.4.1-3_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Estou usando os seguintes repositórios:

# deb cdrom:[Ubuntu 8.04.3 _Hardy Heron_ - Release i386 (20090713.1)]/ hardy main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://us.archive.ubuntu.com/ubuntu/ natty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ natty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ natty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ natty-updates main restricted


## main & restricted repositories
# deb http://us.archive.ubuntu.com/ubuntu/ lucid main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ lucid main restricted

#deb http://security.ubuntu.com/ubuntu lucid-security main restricted
#deb-src http://security.ubuntu.com/ubuntu lucid-security main restricted

## universe repositories
#deb http://us.archive.ubuntu.com/ubuntu/ lucid universe
#deb-src http://us.archive.ubuntu.com/ubuntu/ lucid universe
#deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe restricted main
#deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe

#deb http://security.ubuntu.com/ubuntu lucid-security universe
#deb-src http://security.ubuntu.com/ubuntu lucid-security universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://us.archive.ubuntu.com/ubuntu/ natty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ natty universe
deb http://us.archive.ubuntu.com/ubuntu/ natty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ natty-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ natty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ natty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ natty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ natty-updates multiverse

Alguém tem alguma ideia do que está acontecendo ou como posso consertar isso e instalar o git?

[edit] Aqui está a saída da política do apt-cache dpkg:

dpkg:
  Installed: 1.15.5.6ubuntu4
  Candidate: 1.16.0~ubuntu7.1
  Version table:
     1.16.0~ubuntu7.1 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty-updates/main Packages
     1.16.0~ubuntu7 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty/main Packages
 *** 1.15.5.6ubuntu4 0
        100 /var/lib/dpkg/status

E agora o apt está completamente quebrado. Eu tentei atualizar o dpkg, porque notei que era um par de versões desatualizadas. Falhou porque não foi possível instalar o git. Eu tentei limpar o apt-get, apt-get clean e apt-get update. Ainda o mesmo problema. Eu tentei remover o git e consegui isto:

Removing git-core ...
dpkg: error processing git (--remove):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
Errors were encountered while processing:
 git
E: Sub-process /usr/bin/dpkg returned an error code (1)
    
por Daniel Bingham 01.02.2012 / 22:08

2 respostas

5

Tudo bem, eu consertei. Eu tive que remover manualmente o pacote e forçar o dpkg a se limpar. Depois eu instalei o git-core e funcionou bem. Para remover manualmente o pacote fui para

/var/cache/apt/archives

E removido o arquivo git_1%3a1.7.4.1-3_i386.deb . Depois disso eu fui para

/var/lib/dpkg/info

E fez um ls | grep git e removeu tudo o que aparecia. Depois, eu corri

sudo dpkg --remove --force-remove-reinstreq git

Para limpar o dpkg do pacote. Uma vez feito isso, consegui instalar o git de git-core em vez do pacote git e funcionou muito bem.

    
por Daniel Bingham 02.02.2012 / 20:18
5

Apenas no caso: é apt-get install git-core , não apenas apt-get install git .

    
por Marc-André Appel 01.02.2012 / 23:00

Tags