0

I cannot upgrade ubuntu because there are some packages being kept back:

au464956@dnaseq1:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  gcc-5-base gcc-6-base libdatetime-locale-perl libdatetime-timezone-perl
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

I have tried some other solutions to this problem with no success, including running sudo apt-get dist-upgrade (this still keeps the packages back), sudo apt install gcc-5-base or the other kept back packages, which leads to a long message threatening to remove apt, libapt-pkg5.0, and libstdc++6 which would obviously be too destructive, and running sudo apt-get --with-new-pkgs upgrade.

Running sudo apt-cache policy for the kept back packages results in:

gcc-5-base:
  Installed: 5.4.0-6ubuntu1~16.04.11
  Candidate: 5.5.0-12ubuntu8
  Version table:
     5.5.0-12ubuntu8 500
        500 http://us.archive.ubuntu.com/ubuntu cosmic/universe amd64 Packages
 *** 5.4.0-6ubuntu1~16.04.11 500
        500 http://dk.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     5.4.0-6ubuntu1~16.04.10 500
        500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
     5.3.1-14ubuntu2 500
        500 http://dk.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
gcc-6-base:
  Installed: 6.0.1-0ubuntu1
  Candidate: 6.4.0-22ubuntu1
  Version table:
     6.4.0-22ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu cosmic/universe amd64 Packages
 *** 6.0.1-0ubuntu1 500
        500 http://dk.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
libdatetime-locale-perl:
  Installed: 1:1.02-1
  Candidate: 1:1.22-1
  Version table:
     1:1.22-1 500
        500 http://us.archive.ubuntu.com/ubuntu cosmic/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu cosmic/universe i386 Packages
 *** 1:1.02-1 500
        500 http://dk.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://dk.archive.ubuntu.com/ubuntu xenial/universe i386 Packages
        100 /var/lib/dpkg/status
libdatetime-timezone-perl:
  Installed: 1:1.95-1+2016a
  Candidate: 1:2.19-1+2018e
  Version table:
     1:2.19-1+2018e 500
        500 http://us.archive.ubuntu.com/ubuntu cosmic/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu cosmic/universe i386 Packages
 *** 1:1.95-1+2016a 500
        500 http://dk.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://dk.archive.ubuntu.com/ubuntu xenial/universe i386 Packages
        100 /var/lib/dpkg/status

UPDATE: Output of sudo apt dist-upgrade

Reading package lists... Done
Building dependency tree        
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  gcc-5-base gcc-6-base libdatetime-locale-perl libdatetime-timezone-perl
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

Output of the attempt to run the upgrade sudo do-release-upgrade:

Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.
Ian Marshall
  • 101
  • 1
  • 1
    If I'm not mistaken, when you run the command to actually do the upgrade, the packages that have been kept back will be upgraded anyway. – You'reAGitForNotUsingGit Jun 26 '19 at 13:22
  • 1
    As far I see, you try to upgrade xenial to cosmic. You overleap some versions. – nobody Jun 26 '19 at 13:32
  • Please post the complete output of a dist-upgrade. – user535733 Jun 26 '19 at 15:00
  • @AndroidDev Unfortunately this doesn't seem to be the case, I've added the output from `do-release-upgrade` to the question. – Ian Marshall Jun 27 '19 at 04:48
  • @user535733 I have now added the output of `do-release-upgrade` to the question. – Ian Marshall Jun 27 '19 at 04:49
  • @user966203 Do you think that would help? How could this be achieved? According to [this question](https://unix.stackexchange.com/questions/463126/upgrade-ubuntu-to-a-specific-release) an intermediate upgrade to version 17 would not help. – Ian Marshall Jun 27 '19 at 04:53
  • 1
    Are you upgrading to cosmic directly from xenial? What approach are your following? Have you edited sources.list manually? – Kulfy Jun 27 '19 at 05:13
  • @Kulfy yes, direct from cosmic to xenial. I am attempting to follow [this guide](https://www.google.com/amp/s/www.zdnet.com/google-amp/article/how-to-upgrade-from-ubuntu-linux-16-04-to-18-04/). Sources.list has not been edited. – Ian Marshall Jun 27 '19 at 05:38
  • @IanMarshall Please [edit] your question and include what you **exactly** did. The link you have provided tells how to upgrade to 18.04 not 18.10. – Kulfy Jun 27 '19 at 07:36

2 Answers2

0

Backup first. Download Ubuntu Release you want. Ubuntu bionic is current newest LTS (with long term support) while Ubuntu disco is the current newest STS (short term support) Create a bootable DVD or USB stick. Start a Live-session and test if everything is running.

I would like to advocate fresh installation. Your guide describes a release-upgrade from xenial to bionic. This is supported.

sudo apt install --reinstall gcc-5-base=5.5.0-12ubuntu8 gcc-6-base=6.4.0-22ubuntu1 libdatetime-locale-perl=1:1.22-1 libdatetime-timezone-perl=1:2.19-1+2018e

This way we tell apt which package version we want. No, errors? sudo dpkg --configure -a && sudo apt -f install

Control with dpkg -l | egrep -v '^ii|rc' if all packages are in good condition. No output is gut.

Now purge during the upgrade removed packages. Without any manually config the config-files stays on your System. sudo apt purge $(dpkg -l | egrep '^rc' | awk '{print $2}')

Take a look in /etc/apt/sources.list that all entries points to cosmic. I never use do-release-upgrade, I prefer an other way.

sudo apt install apt-show-versions

It help's to identfy packages are not longer available because the name changed for example.

apt-show-versions | fgrep 'No available'

If you want to get rid all of them. sudo apt purge $(apt-show-vesions | fgrep 'No available' | awk '{print $1}')

Note: This could work, but not with guarantee.

Kulfy
  • 17,416
  • 26
  • 64
  • 103
nobody
  • 5,149
  • 5
  • 22
  • 43
  • Thanks for your insight! Unfortunately this did not work. The first command `sudo apt install --reinstall gcc-5-base=5.5.0-12ubuntu8 gcc-6-base=6.4.0-22ubuntu1 libdatetime-locale-perl=1:1.22-1 libdatetime-timezone-perl=1:2.19-1+2018e` gives the same output as `sudo apt install gcc-5-base` or for any of the other kept-back packages, specifically threatening to delete essential packages `apt libapt-pkg5.0 (due to apt) libstdc++6 (due to apt)` if this is continued. `sudo dpkg --configure -a && sudo apt -f install` does not help. – Ian Marshall Jun 27 '19 at 09:46
  • [link to the question's chatroom](https://chat.stackexchange.com/rooms/95448/upgrade-xenial-to-cosmic) – karel Jun 27 '19 at 10:23
0

The immediate problem of gcc-5-base and gcc-6-base being kept back was solved by adding this repository, inspired by this question:

sudo add-apt-repository ppa:ubuntu-toolchain-r/
sudo apt update
sudo apt upgrade

I then purged the other kept-back packages (perl packages) as these wouldn't remove any non-essential packages with the idea that I should be able to reinstall them following the release upgrade.

The release upgrade has failed for other reasons that I'm still working on, but the immediate problem of packages being kept back that this question is about has been solved.

Ian Marshall
  • 101
  • 1