所以最近我从 xenial 升级到了 zesty,试图更熟悉 Ubuntu。我以前用过 arch,所以我经常输入命令sudo apt-get update && sudo apt-get upgrade
来检查任何软件包的更新。但今天我得到了一个奇怪的输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.10.0-33 linux-headers-4.10.0-33-generic linux-image-4.10.0-33-generic
linux-image-extra-4.10.0-33-generic linux-signed-image-4.10.0-33-generic
Use 'sudo apt autoremove' to remove them.
The following packages have been kept back:
cpp g++ gcc
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
不幸的是,我仍然不太熟悉 apt-get,所以我决定按照这一页但还是没得到。我尝试按照页面上的建议做了很多,但似乎还是没用。
以下是我迄今为止所做的工作以及得到的各种输出:
$ sudo apt-get install cpp
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
cpp : Depends: cpp-6 (>= 6.3.0-9~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
。
$ sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
g++ : Depends: cpp (>= 4:6.3.0-2ubuntu1) but 4:5.3.1-1ubuntu1 is to
be installed
Depends: gcc (>= 4:6.3.0-2ubuntu1) but 4:5.3.1-1ubuntu1 is to be installed
Depends: g++-6 (>= 6.3.0-9~) but it is not going to be installed
Depends: gcc-6 (>= 6.3.0-9~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
。
$ sudo apt-get install gcc
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
gcc : Depends: cpp (>= 4:6.3.0-2ubuntu1) but 4:5.3.1-1ubuntu1 is to be installed
Depends: gcc-6 (>= 6.3.0-9~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
。
$ sudo cat /etc/apt/sources.list
# deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial 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/ zesty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ zesty restricted multiverse main universe #Added by software-properties
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ zesty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ zesty-updates restricted multiverse main universe #Added by software-properties
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. 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/ zesty universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb http://us.archive.ubuntu.com/ubuntu/ zesty-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-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/ zesty multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://us.archive.ubuntu.com/ubuntu/ zesty-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ zesty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ zesty-backports main restricted universe multiverse #Added by software-properties
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://security.ubuntu.com/ubuntu zesty-security main restricted
deb-src http://security.ubuntu.com/ubuntu zesty-security restricted
multiverse main universe #Added by software-properties
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu zesty-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu zesty-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb http://archive.canonical.com/ zesty partner
# deb-src http://archive.canonical.com/ xenial partner
# deb-src http://archive.canonical.com/ xenial partner
# deb-src http://archive.canonical.com/ xenial partner
。
# ll /etc/apt/sources.list.d/
total 8
drwx------ 2 root root 4096 Oct 6 19:26 ./
drwxr-xr-x 7 root root 4096 Oct 6 19:26 ../
。
$ sudo apt-cache policy cpp cpp-5
cpp:
Installed: 4:5.3.1-1ubuntu1
Candidate: 4:6.3.0-2ubuntu1
Version table:
4:6.3.0-2ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu zesty/main amd64 Packages
*** 4:5.3.1-1ubuntu1 100
100 /var/lib/dpkg/status
cpp-5:
Installed: 5.4.1-8ubuntu1
Candidate: 5.4.1-8ubuntu1
Version table:
*** 5.4.1-8ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu zesty/main amd64 Packages