Ошибка установки Git с помощью Apt-Get

Когда я пытаюсь установить git на серверный дистрибутив Ubuntu 11.04, я получаю сообщение об ошибке. Я использовал следующую команду:

sudo apt-get install git

И это породило эту ошибку:

(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)

Я использую следующие репозитории:

# 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

У кого-нибудь есть Идея, что происходит или как я могу это исправить и заставить git установить?

[edit] Вот вывод политики 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

И теперь apt полностью сломан , Я попытался обновить dpkg, потому что заметил, что это была пара устаревших версий. Это не удалось, потому что не удалось установить git. Я попытался очистить apt-get, apt-get clean и apt-get update. Все та же проблема. Я попытался удалить git и получил это:

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)
11
задан 2 February 2012 в 20:55

2 ответа

На всякий случай: это apt-get install git-core, а не просто apt-get install git.

0
ответ дан 2 February 2012 в 20:55

Хорошо, я все исправил. Мне пришлось вручную удалить пакет, а затем заставить dpkg очистить себя. После этого я установил его из git-core, и это работало нормально. Чтобы вручную удалить пакет, я пошел в

/var/cache/apt/archives

и удалил git_1%3a1.7.4.1-3_i386.deb файл. После этого я пошел в

/var/lib/dpkg/info

и сделал ls | grep git и удалил все, что оказалось. После этого я запустил

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

Для очистки dpkg пакета. Когда это было сделано, я смог установить git из git-core вместо пакета git, и он работал просто отлично.

0
ответ дан 2 February 2012 в 20:55

Другие вопросы по тегам:

Похожие вопросы: