80

I would like to know how to upgrade from my current version of Ubuntu to the next stable from the Command line interface?

Braiam
  • 67,791
  • 32
  • 179
  • 269
myusuf3
  • 34,189
  • The other answers doesn't address this question. – Braiam Feb 18 '14 at 15:58
  • 2
    Well, they do, but command line is only mentioned as "Run do-release-upgrade in a terminal", as it's that simple, after general steps ("take backups"). – Olli Feb 18 '14 at 16:50
  • 1
    What worked for me is /usr/lib/ubuntu-release-upgrader/check-new-release -d and then do-release-upgrade -d works for me – Max Coplan Oct 19 '19 at 20:32
  • For Ubuntu 20.04+, I had to do sudo apt-get update + sudo apt-get upgrade -y + sudo apt-get dist-upgrade and finally sudo do-release-upgrade. – Bruno Leveque Feb 21 '22 at 22:31

3 Answers3

124

You'll first need to make sure update-manager-core is present (it may already be installed):

sudo apt-get install update-manager-core

Next, run:

sudo do-release-upgrade

You may need to check /etc/update-manager/release-upgrades and change the line:

Prompt=lts

to:

Prompt=normal

for the release to show up.

Jorge Castro
  • 71,754
Meta Bergman
  • 2,221
  • I have Ubuntu 17.10 installed. Apparently the update-manager-core package has been added to the core packages since the answer was given, as trying to install it yields the output update-manager-core is already the newest version (1:17.10.13)., and the command do-release-upgrade is available. However, giving this command on the command line produces the output No new release found., even though release 18.04 was released last week. (I do have the line Prompt=normal in file /etc/update-manager/release-upgrades.) – Teemu Leisti Apr 30 '18 at 12:03
  • @TeemuLeisti the /etc/update-manager/release-upgrades documentation says normal - Check to see if a new release is available. If more than one new release is found, the release upgrader will attempt to upgrade to the supported release that immediately succeeds the currently-running release. – Max Coplan Oct 19 '19 at 20:17
  • So it seems that setting Prompt=normal is NOT enough to update to the latest version. This will only update you to the second-to-latest version – Max Coplan Oct 19 '19 at 20:18
  • 1
    I found running /usr/lib/ubuntu-release-upgrader/check-new-release -d and then do-release-upgrade -d works for me – Max Coplan Oct 19 '19 at 20:30
13

If you run the command sudo do-release-upgrade -d through SSH then use a GNU Screen, because the upgrade process will turn off SSH -> close the default port and open a new one (it will inform you of this new port), so:

$ ssh USER@HOST

$ screen -S upgrade
$ sudo do-release-upgrade -d

open a new terminal on client computer:

$ ssh -p PORT USER@HOST

$ screen -d
$ screen -r upgrade
techraf
  • 3,316
PetterA
  • 131
  • 4
    sudo do-release-upgrade -d is for devel release If you want to do LTS to the next one just use: sudo do-release-upgrade without the "-d" switch – user228759 Feb 17 '14 at 04:27
  • 2
    As of Ubuntu 14.04 (and possibly ealier), do-release-upgrade now automatically creates a screen for you to make it easier to recover a failed upgrade. It also starts a secondary ssh server for the same reason. So this advice is no longer necessary. – Daniel Cassidy Aug 23 '19 at 20:45
  • I have been trying for months to upgrade from Mate 16.04 to 18.04 but have been completely blocked by Blue Ray software & hardware upgrade errors. The Java component wouldn't install, so I did so from terminal. Now a base portion of the program which the others are dependencies of. It won't upgrade stating a major error. Attempting to remove it also removes the Mate desktop and all of it's dependencies. What must I do? Remove it & Mate then update to 18.04 & reinstall Mate from only terminal? – monkeyman_stones Nov 04 '19 at 15:31
5

You can do

sudo do-release-upgrade

for command line updating

(This is actually the same as for Ubuntu Server)

Peter Smit
  • 7,587