想知道是否有人知道 dist-upgrade 想要删除 git。FWIW,这是一个非常简单的盒子,主要用于 web 开发。
$ uname -a
Linux precise64 3.2.0-61-generic #93-Ubuntu SMP Fri May 2 21:31:50 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ git --version
git version 1.9.2
$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
git git-core
The following NEW packages will be installed:
linux-headers-3.2.0-63 linux-headers-3.2.0-63-generic linux-image-3.2.0-63-generic
The following packages will be upgraded:
git-man linux-headers-server linux-image-server linux-server phpmyadmin
5 upgraded, 3 newly installed, 2 to remove and 0 not upgraded.
Need to get 58.8 MB of archives.
After this operation, 199 MB of additional disk space will be used.
Do you want to continue [Y/n]?
编辑:包括更多信息:
$ apt-cache policy git
git:
Installed: 2:1.9.2-0avh1~precise
Candidate: 2:2.0.0-0avh2~precise
Version table:
2:2.0.0-0avh2~precise 0
500 http://ppa.launchpad.net/pdoes/ppa/ubuntu/ precise/main amd64 Packages
*** 2:1.9.2-0avh1~precise 0
100 /var/lib/dpkg/status
1:1.7.9.5-1 0
500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
$ apt-cache policy git-core
git-core:
Installed: 2:2.0.0-0avh2~precise
Candidate: 2:2.0.0-0avh2~precise
Version table:
*** 2:2.0.0-0avh2~precise 0
500 http://ppa.launchpad.net/pdoes/ppa/ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
1:1.7.9.5-1 0
500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
$ apt-cache policy git-man
git-man:
Installed: 2:1.9.2-0avh3~precise
Candidate: 2:2.0.0-0avh2~precise
Version table:
2:2.0.0-0avh2~precise 0
500 http://ppa.launchpad.net/pdoes/ppa/ubuntu/ precise/main amd64 Packages
*** 2:1.9.2-0avh3~precise 0
100 /var/lib/dpkg/status
1:1.7.9.5-1 0
500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
编辑:清除git
、git-core
和git-man
,并尝试重新安装git
(注意,这给我带来了糟糕的情况,因为我依赖和git
;virtualenvwrapper
所以我将这台机器恢复到以前/工作状态):
$ sudo apt-get purge git git-core git-man
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
git* git-core* git-man*
0 upgraded, 0 newly installed, 3 to remove and 4 not upgraded.
After this operation, 20.9 MB disk space will be freed.
Do you want to continue [Y/n]? y
$ sudo apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libjs-underscore python-virtualenv wwwconfig-common libjs-jquery javascript-common libjs-sphinxdoc
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
git-man
Suggested packages:
git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs
git-mediawiki git-svn
The following packages will be REMOVED:
bash-completion virtualenvwrapper
The following NEW packages will be installed:
git git-man
0 upgraded, 2 newly installed, 2 to remove and 4 not upgraded.
Need to get 10.3 MB of archives.
After this operation, 19.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? n
=====
最后编辑,关于Saiarcot895 的解决方案:该虚拟机来自PuPHPet Vagrant 配置,确实使用了pdoes 为 Git 提供的 PPA(到目前为止我还没有注意到这一点)。为了理清事情,我刚刚从系统中删除了该 PPA,并从主存储库安装了 Git 版本:
# apt-add-repository --remove ppa:pdoes/ppa
# apt-get update && apt-get install git -y
# apt-cache policy git
git:
Installed: 1:1.7.9.5-1
Candidate: 1:1.7.9.5-1
Version table:
*** 1:1.7.9.5-1 0
500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
显然,这是 Git 的旧版本,但它仍然完全符合我的需求。之后,我就可以apt-get dist-upgrade
毫无问题地运行了。
答案1
git
、、git-core
和git-man
是这里的相关包。
在打包中,git-man
和git-core
被声明为与体系结构无关的包,这意味着这些包可以构建一次并在任何体系结构上使用。git
另一方面,必须为每个体系结构构建一次(毕竟包中有可执行文件)。
这里最有可能发生的事情是,当您/计算机运行 时sudo apt-get update
,独立于体系结构的软件包已构建(它们是使用 i386 二进制文件构建的),而依赖于体系结构的软件包尚未构建。假设您使用的是 amd64,这意味着有git-core
和的较新版本git-man
,但没有git
。由于指定的依赖项的性质,您不能拥有不匹配的三个软件包的版本。因此,apt
决定升级git-man
并删除git
和git-core
。
解决方案是等待一两个小时,然后再次运行sudo apt-get update
,sudo apt-get dist-upgrade
或者(如果您现在真的想要/需要进行顶部升级)运行sudo apt-get upgrade
,这将升级尽可能多的软件包而不删除软件包。
编辑:这里使用的 PPA(https://launchpad.net/~pdoes/+archive/ppa) 有一个Breaks
条件(至少在 Precise 版本中)bash-completion (<< 1:1.90-1)
。问题是:bash-completion
在 Precise 中是1:1.3-1ubuntu8.1
。因此,git
如果不使用另一个 PPA 以获取较新版本的 ,则无法在 Ubuntu Precise 中安装此 PPA bash-completion
。一些具有较新版本的 PPAbash-completion
是这,这, 和这。