Score:0

Cannot upgrade Ubuntu because of `gcc-8-base` "Please install all available updates for your release before upgrading."

jp flag
Tom

I try to upgrade my Ubuntu from 18.04 to 20.04 with the following workflow:

sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y # intelligently handles changing dependencies with new versions
sudo apt autoremove -y
sudo apt install -y update-manager-core # should already be installed
sudo reboot

After the reboot I check if LTS is selected:

grep -i 'Prompt=lts' /etc/update-manager/release-upgrades

And enable the SSH recovery port

sudo iptables -I INPUT -p tcp --dport 1022 -j ACCEPT # allow SSH recovery port

ERROR: Then when I try to start the distro upgrade it says

> sudo do-release-upgrade -f DistUpgradeViewNonInteractive
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.

Output from update and upgrade:

> sudo apt update
Hit:1 https://packages.icinga.com/ubuntu icinga-bionic InRelease
Hit:2 https://download.docker.com/linux/ubuntu bionic InRelease                                                                                                                                                                                                                                       
Hit:3 https://repos.influxdata.com/ubuntu bionic InRelease                                                                                                                                                                                       
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease                                                                                                                                                                     
Hit:5 http://ppa.launchpad.net/fish-shell/release-3/ubuntu bionic InRelease                    
Hit:6 http://archive.ubuntu.com/ubuntu jammy InRelease                                         
Ign:7 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 InRelease
Hit:8 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 Release
Reading package lists... Done                     
Building dependency tree       
Reading state information... Done
28 packages can be upgraded. Run 'apt list --upgradable' to see them.
> sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  libpcre2-32-0
Learn more about Ubuntu Pro at https://ubuntu.com/pro
The following packages have been kept back:
  gcc-8-base
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

I did NOT install the package again because it would remove nearly all packages from my system which seems wrong: see https://askubuntu.com/a/602/538482

Link to image of the log: > sudo apt install gcc-8-base

When I tried sudo apt install --only-upgrade gcc-8-base I got the same output as with sudo apt install gcc-8-base. Same with sudo apt install --reinstall gcc-8-base

I tried the --with-new-pkgs flag: see https://askubuntu.com/a/862799/538482

> sudo apt --with-new-pkgs upgrade gcc-8-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... 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:
 libgcc1 : Depends: gcc-8-base (= 8.4.0-1ubuntu1~18.04) but 8.4.0-3ubuntu2 is to be installed
 libstdc++6 : Depends: gcc-8-base (= 8.4.0-1ubuntu1~18.04) but 8.4.0-3ubuntu2 is to be installed
E: Broken packages

I checked if I can unhold it: see https://askubuntu.com/a/1316387/538482

> apt-mark showhold
> apt-mark showhold gcc-8-base
> sudo apt-mark unhold gcc-8-base
gcc-8-base was already not hold.
> sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  libpcre2-32-0
Learn more about Ubuntu Pro at https://ubuntu.com/pro
The following packages have been kept back:
  gcc-8-base
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
> apt list gcc-8-base -a
Listing... Done
gcc-8-base/focal 8.4.0-3ubuntu2 amd64 [upgradable from: 8.4.0-1ubuntu1~18.04]
gcc-8-base/now 8.4.0-1ubuntu1~18.04 amd64 [installed,upgradable to: 8.4.0-3ubuntu2]

I found that users could fix by installing aptitude but for me it did not work: see https://askubuntu.com/a/18694/538482

> sudo apt-get install aptitude -y
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:
 aptitude : Depends: libapt-pkg6.0 (>= 1.9.11~) but it is not installable
            Depends: libboost-iostreams1.74.0 (>= 1.74.0) but it is not installable
            Depends: libc6 (>= 2.33) but 2.27-3ubuntu1.6 is to be installed
            Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
            Depends: libgcc-s1 (>= 3.3.1) but it is not installable
            Depends: libncursesw6 (>= 6.1+20180210) but it is not installable
            Depends: libsigc++-2.0-0v5 (>= 2.8.0) but it is not installable
            Depends: libstdc++6 (>= 9) but 8.4.0-1ubuntu1~18.04 is to be installed
            Depends: libtinfo6 (>= 6.1+20180210) but it is not installable
            Depends: libxapian30 (>= 1.4.17~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Still the package is kept back:

> sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  gcc-8-base
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

Only thing that finally worked:

sudo rm -rf /var/lib/apt/lists/* # Clear apt repository cache

After that, the sudo do-release-upgrade -f DistUpgradeViewNonInteractive worked.

My question: Why is that working? Will it have any downsides after the upgrade?

PS: I tried this on 15 equal Ubuntu VMs and the problem occurred on every single one.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.