When I upgraded from 18.10 to 19.04, and again when I upgraded from 19.04 to 19.10, I had to manually reinstall all of the packages I installed through dpkg, apt, etc. (I do not recall the precise details of how I went about either upgrade.) Is there a less painful route to upgrade Ubuntu 19.10 to 20.04?

Closely related: When I was a macOS user and upgraded my system software, I could export a list of installed Mac Ports, and then reinstall after the system upgrade using that exported list. Is there a similar kind of functionality for dpkg or apt? I would find this kind of solution to be "less painful" in case there is not a simple and direct way to accomplish an upgrade to 20.04 without losing installed packages. :)

3 Answers 3


Before proceeding you can save the list of installed packages by using

dpkg -l | grep ^ii | awk '{print $2}' > dpkg-l_installed.txt
dpkg --get-selections > dpkg--get-selections.txt

As usual the ordinary GUI method would be

update-manager -d # '-d' because of 20.04 is just released today

or use terminal based method

sudo do-release-upgrade -d

The PPAs and third-party repositories will be disabled as usual, other stuff will remain.

  • 1
    Thank you, N0rbert. Do the PPAs and third-party repositories get saved using the dpkg commands you supplied at the top of your answer?
    – Lexible
    Apr 23, 2020 at 18:10
  • 2
    The packages lists will be saved, the original sources of packages will remain in /etc/apt/sources.list and /etc/apt/sources.list.d/*.list but will become commented by adding "#" at start of each line. You can re-enable such sources later.
    – N0rbert
    Apr 23, 2020 at 18:11
  • just to emphasize that the -d is for the development version and should not be used in general Simply sudo do-release-upgrade May 20, 2020 at 9:48
  • Right, but 20.04.1 is not yet released. This for whom who is in hurry.
    – N0rbert
    May 20, 2020 at 10:08

I don't know if such functionality exists in ubuntu.

Provided your terminal history span across a sufficient (read: long enough) periode of time, You could always browse your terminal history and spot all the packages you installed using apt:

sudo cat .bash_history | grep "apt install"

This might work: open the update center in Ubuntu and then check for updates. If it asks you if you want to update to 20.04 select yes and you shouldn't (I'm not sure) lose any packages (although some packages might become obsolete). I highly recommend backing up your data to an external drive regardless. Déjà Dup is a fantastic tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.