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

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,696
nobody
  • 5,437
  • 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
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