res*_*ing 5 10.04 command-line apt dpkg git
运行后sudo apt-get install git-core,我得到
Unpacking git-core (from .../git-core_1%3a1.7.4.1-3_all.deb) ...
Errors were encountered while processing:
/var/cache/apt/archives/git_1%3a1.7.4.1-3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
因此,我按照使用 Apt-Get 安装 Git 时出错中的说明进行操作,但这也不起作用。
运行后我遇到了这个sudo dpkg --remove --force-remove-reinstreq git:
dpkg: warning: overriding problem because --force enabled:
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.
(Reading database ...
dpkg: warning: files list file for package `git' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `git-man' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `git-core' missing, assuming package has no files currently installed.
(Reading database ... 79719 files and directories currently installed.)
Removing git ...
Run Code Online (Sandbox Code Playgroud)
在某些时候,我被要求跑去sudo apt-get -f install修理东西,但它说它要安装 git
The following extra packages will be installed:
git
Suggested packages:
git-doc git-el git-arch git-cvs git-svn git-email git-daemon-run git-gui gitk gitweb
The following NEW packages will be installed:
git
0 upgraded, 1 newly installed, 0 to remove and 480 not upgraded.
1 not fully installed or removed.
Need to get 4,658kB of archives.
After this operation, 10.9MB of additional disk space will be used.
Run Code Online (Sandbox Code Playgroud)
并且点击yes后,错误再次出现:
Do you want to continue [Y/n]? y
Get:1 http://ubuntu.mirror.cambrium.nl/ubuntu/ natty/main git 1:1.7.4.1-3 [4,658kB]
Fetched 4,658kB in 5s (907kB/s)
Selecting previously deselected package git.
(Reading database ...
dpkg: warning: files list file for package `git-man' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `git-core' missing, assuming package has no files currently installed.
(Reading database ... 79719 files and directories currently installed.)
Unpacking git (from .../git_1%3a1.7.4.1-3_amd64.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_amd64.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_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
由于某些原因,当我这样做时dpgk --get-selections | grep git,我得到:
git install
git-core install
git-man install
Run Code Online (Sandbox Code Playgroud)
所以我陷入了这个循环。我该如何解决?
在 Ubuntu 10.04.4 LTS 上
试试这个,大多数时候对我有用
$ sudo apt-get remove git-core
$ sudo apt-get autoremove
$ cd /var/cache/apt/archives
Run Code Online (Sandbox Code Playgroud)
并删除导致管理员权限出现问题的 git 文件。
$ rm git_1%3a1.7.4.1-3_amd64.deb
Run Code Online (Sandbox Code Playgroud)
或对应的文件。
然后运行
$ sudo apt-get update
Run Code Online (Sandbox Code Playgroud)
和
$ sudo apt-get install git-core
Run Code Online (Sandbox Code Playgroud)
如果问题仍然存在,请尝试删除 /var/cache/apt/archives 中的所有文件
$ sudo rm /var/cache/apt/archives/*
Run Code Online (Sandbox Code Playgroud)
然后运行
$ sudo apt-get update
$ sudo apt-get install git-core
Run Code Online (Sandbox Code Playgroud)