0

So recently I upgraded from xenial to zesty, trying to get more familiar with Ubuntu. I used to use arch so I regularly type sudo apt-get update && sudo apt-get upgrade to check for updates to any packages. But today I got a weird output:

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.

I'm still unfortunately not very comfortable with apt-get so I decided to follow the instructions on this page but still haven't gotten it. I kind of tried doing a lot of the recommendations on the page but it still doesn't seem to work.

Here's what I've done so far and the various outputs I've gotten:

$ 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
Zeke
  • 101
  • Does apt-cache policy cpp cpp-5 shed any light? – steeldriver Oct 17 '17 at 11:12
  • I added the output of that into the bottom of the file. I'm not sure what it means, just that it seems odd that for cpp the Installed option is behind the Candidate option by a bit much. – Zeke Oct 17 '17 at 12:36
  • apt is trying to install packages for Ubuntu 16.04 xenial in your 17.04 zesty which indicates that you need to restore the default repositories in /etc/apt/sources.list and /etc/apt/sources.list.d/ in your Ubuntu 17.04. – karel Feb 20 '22 at 08:18

0 Answers0