52

I've been trying to upgrade my version of Ubuntu 18.04 to 20.04. I've run all the steps from updating and upgrading both apt and apt-get, changing the settings in update manager and all of the steps described in this link. Yet I keep getting the error:

Please install all available updates for your release before upgrading.

Is there something special about trying to upgrade from 18.04 to 20.04 that's causing this error? Do I maybe need to update to 19.04 first?

EDIT: I just noticed something that might be important. When I run sudo apt-get update I get the following notice at the end of the output:

The following packages have been kept back:
  colord gimagereader python-sane sane simple-scan
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

Might that be causing the issue?

ModalBro
  • 675
  • 3
    The update from 18.04LTS to 20.04LTS won't happen until 20.04.1 is released. In the mean time, do sudo apt-get update and sudo apt-get upgrade. – heynnema Apr 26 '20 at 19:56
  • Will this get me to 19.04, (after running do-release-upgrade)? – ModalBro Apr 26 '20 at 21:24
  • I don't think so. Just wait until 20.04.1 is released. – heynnema Apr 26 '20 at 21:51
  • 1
    To deal with packages being kept back try sudo apt install -f to fix errors. – WinEunuuchs2Unix Apr 27 '20 at 00:30
  • @karel unfortunately not, when I try do-release-upgrade, I get the following error: Checking for a new Ubuntu release Please install all available updates for your release before upgrading. – ModalBro Apr 27 '20 at 02:07
  • 1
    The issue regarding kept back packages is one I recently ran into myself and reported in the Ubuntu bug tracker at https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1874927. It'd be helpful if you were to report a bug about ubuntu-release-upgrader using 'ubuntu-bug ubuntu-release-upgrader' so that I can have a look at your log files and try and sort out why those packages are kept back. Thanks! – Brian Murray May 07 '20 at 18:23
  • 1
    You can see the list of packages that can still be upgraded by sudo apt list --upgradable Then if the list looks good, upgrade by sudo apt dist-upgrade -y – zdave Dec 11 '21 at 23:12
  • In my case, it was VSCode that could not be updated. Release 1.87 was available, however under 18.04 VSCode was only supported up to version 1.85 and therefore could not do the update. However, the new version was seen as available, so the system was reporting that there was an update that I hadn't done (ARRGGGG!!!). The solution I gave was to uninstall VSCode and then proceeded with the upgrade to 20.04. – zerzevul Apr 02 '24 at 17:02

12 Answers12

45

I was also experiencing the same issue. However, when I ran the usual upgrade commands (sudo apt upgrade, sudo apt full-upgrade, sudo apt-get dist-upgrade), they were all reporting that there are no packages to upgrade and no held packages:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

In the end, I copied the file /usr/bin/do-release-upgrade to my home and modified it as follows:

for pkg in upgradable:
    if 'Phased-Update-Percentage' in pkg.candidate.record:
        # P-U-P does not exist if it is fully phased
        continue
    else:
        install_count += 1
        print(pkg)   # <--- ADD THIS LINE
        # one upgradeable package is enough to stop the dist-upgrade
        # break      # <--- COMMENT THIS LINE OUT to get all packages

This change will print the names of all packages that need to be upgraded.

When I ran sudo ~/do-release-upgrade, a package from an external repository was printed that had an update available, but the newer version depended on a library that was not available, which caused the package to not upgrade.

Still not sure why it wasn't reported as not upgraded by apt upgrade.

Edit: The following code snippet can be run in the Python console to list all upgradeable packages - thanks @jferard!

import apt

cache = apt.Cache() cache.open() print([pkg for pkg in cache if pkg.is_upgradable])

piit79
  • 609
30

sequence from 18.04 to 20.04

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt autoremove
sudo do-release-upgrade -d -f DistUpgradeViewGtk3

Follow onscreen instruction. Good luck!

SlyTom
  • 325
  • 18
    Still unable to install updated version – Amit Dwivedi Oct 23 '20 at 05:31
  • 9
    This didn't work for me either. – Brian Piercy Nov 10 '20 at 20:35
  • 2
    This didn't work for me as it relates to a specific package that is not being upgraded. See my answer below for a generic solution. – piit79 Dec 17 '20 at 09:16
  • I came here via https://ubuntu.com/blog/ubuntu-on-wsl-2-is-generally-available. The "Good luck!" is so Linux-indicative. Thanks, the list works (minus the -f ... on my side) –  Mar 10 '21 at 22:54
  • 1
    I think it was the sudo apt dist-upgrade part that resolved it for me, what does that actually do that apt update, apt upgrade, apt autoremove does not cover? – Jarl Mar 17 '21 at 07:29
  • To me sudo apt dist-upgrade and sudo apt autoremove, followed by reboot fixed the issue. – marw Jan 14 '23 at 13:48
13

First in your terminal:

sudo apt dist-upgrade

Then you will get

The following packages have been kept back:

mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools

0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

All you have to do is to use

sudo apt install < Packages Names >

The result will be like:

sudo apt install mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-tools

Finally, go with:

sudo do-release-upgrade
  • mine specifically sudo apt install libc++1 libodbc1 – caduceus Oct 24 '22 at 10:13
  • Worked like a charm. Beautiful. And after I had tried the selected answer, I got the dreaded How to fix error No module named 'apt_pkg' ` – Colin May 20 '24 at 02:17
8

The problem is your repo is not updated, so you need to remove these five repos: colord gimagereader python-sane sane simple-scan

Do sudo add-apt-repository -r ppa:<ppa to remove> or edit /etc/apt/sources.list to remove all of these repos.

Then you can run update-manager

6

just removed wine through sudo apt-get remove --auto-remove winehq-stable and it worked for me after reusing sudo do-release-upgrade

3

Real example with solution (sorry for russian output examples, will translate it as soon as I can):

$ sudo do-release-upgrade -d
...
Please install all available updates for your release before upgrading.

$ sudo apt install Чтение списков пакетов… Готово Построение дерева зависимостей
Чтение информации о состоянии… Готово Обновлено 0 пакетов, установлено 0 новых пакетов, для удаления отмечено 0 пакетов, и 2 пакетов не обновлено. // ... 2 packages are not updated

$ apt list --upgradable Вывод списка… Готово # list output... Done wine-stable-amd64/bionic 6.0.0~bionic-1 amd64 [может быть обновлён с: 4.0.1~bionic] wine-stable-i386/bionic 6.0.0~bionic-1 i386 [может быть обновлён с: 4.0.1~bionic]

The last command showed me what packages are not updated. In my case I removed the packages (it was trash after experiments), then I ran sudo do-release-upgrade -d again. There was no problem, update started.

2

I had this issue on a Digital Ocean droplet recently, but apt update and apt *upgrade returned 404s when attempting to download things. Running sudo rm -rf /var/lib/apt/lists/* and then re-running sudo do-release-upgrade again got me going.

Leaving this here for anyone else that gets stuck.

Rich
  • 21
1

You have to update your current version with the latest patches / updates. Run:

  • sudo apt update
  • sudo apt upgrade

Then force the upgrade to 20.04 by running:

  • sudo update-manager -d

Until first point release of 20.04 ... 20.04.1 ... upgrade will not be presented automatically. Until then the -d option is needed.

As @heynnema writes below -d means "development version". Right now there are no development version for next ubuntu (20.10). Since upgrading from 18.04 or 19,10 to 20.10, you should get a warning about that. If this happens, let go of -d and try without it.

Soren A
  • 7,190
  • Doesn't -d get the development version? – heynnema Apr 26 '20 at 21:51
  • @heynnema, at least for now there are no 20.10 development version, so -d do no harm. – Soren A Apr 26 '20 at 23:58
  • The OP states that he went through the standard steps. The issue is most likely the presence of third-party package repositories. Simply unchecking their boxes in the update-manager (and then letting it update its caches) will probably be enough. I just did this myself. – Arnaud Meuret Jul 27 '20 at 03:51
1

As posted here

Just remove all the content of /var/lib/apt/lists directory:

sudo rm -rf /var/lib/apt/lists/*

then follow here:

sudo apt-get clean
sudo apt update && sudo apt upgrade

Reboot the Ubuntu Linux system by tying the following command:

sudo reboot

Install the Ubuntu update tool, run:

sudo apt install update-manager-core

Start the upgrade procedure, run:

sudo do-release-upgrade

Reboot the box, run:

sudo reboot

and I found this helpful, from here or here, to remove those pesky 'ERROR' messages during updates

sudo apt-get remove graphicsmagick 

where graphicsmagick is the package/software no longer supported etc

rdfleay
  • 31
0

First upgrade the packages:

sudo apt update && sudo apt upgrade

You will see a message similar to this:

The following packages have been kept back:
  mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded

Install the kept back packages manually.

sudo apt install package_name(s)

In my case it was:

sudo apt install mongodb-org-shell mongodb-org-tools

After this run sudo apt update && sudo apt upgrade again to ensure that everything is working fine.

karel
  • 122,695
  • 134
  • 305
  • 337
  • 4
    If you wonder why you got a negative points - 1) you did not answer the original problem 2) you have an uncomplete command 3) you have a typo in the commandline 4) you advice to install a database tools, which hardly helps with upgrade to new LTS version. But dont be dissapointed, read better the question and pay more attention next time. – jaromrax Aug 04 '20 at 11:54
  • @jaromrax He mentions that held packages need to be updated.... (just reading the code blocks can get confusing though...) – Gert van den Berg Aug 07 '24 at 07:15
  • apt-mark unhold '*' (following by another dist-upgrade) might be the easier way without mentioning specific package names... – Gert van den Berg Aug 07 '24 at 07:18
0

Go to Ubuntu Software Update and check any pending updates. Update them and you're done. Some updates do not execute using sudo apt-get update.

Ravexina
  • 57,426
-1

You have to do sudo apt update and sudo apt upgrade first.