How to Upgrade Ubuntu 16.10/17.04 to Ubuntu 18.04 From Command Line

This tutorial will be showing you how to upgrade Ubuntu 16.10/17.04 to Ubuntu 18.04. Ubuntu 16.10/17.04 reached end of life but some users are still using it and have problems in upgrading to Ubuntu 18.04.

For those who don’t know, normal Ubuntu releases are supported for 9 months, whereas LTS releases are supported for 5 years. (LTS stands for Long Term Support)  There are 3 LTS now: Ubuntu 14.04, Ubuntu 16.04 and Ubuntu 18.04. If you prefer stability over new software, then you should choose LTS and only upgrade it when the next LTS comes out. If you prefer newer software, then remember to upgrade your system every 9 months.

When an Ubuntu release reaches its “end of life” it receives no further maintenance updates, including critical security upgrades. Ubuntu 16.10 and Ubuntu 17.04 both reached end of life so users of these two releases can’t install software from standard repository any more. Running an update command will result in 404 error.

upgrade ubuntu 16.10 to 18.04

If you open software updater, it tells you to upgrade to Ubuntu 17.10.

upgrade ubuntu 16.10 to 18

But later you will find this is not supported.

upgrade ubuntu 17.04 to 18.04

How to Upgrade Ubuntu 16.10/17.04 to Ubuntu 18.04 From Command Line

The method I will tell you is the same method for upgrading a Debian system and is how Ubuntu update manager works under the hood. The difference is that Ubuntu update manager refuses to change code name on an obsolete release like Ubuntu 16.10, but we’re going to manually change the code name. Personally I don’t think there’s more risk in doing this than upgrading Ubuntu 16.04 to Ubuntu 18.04. That being said, be sure to back up your important data before following the instructions below.

First, we need to run the following command to change all instances of yakkety to bionic in the source list file (/etc/apt/sources.list). The former is the code name for Ubuntu 16.10, whereas bionic is the code name for Ubuntu 18.04.

sudo sed -i 's/yakkety/bionic/g' /etc/apt/sources.list

If you are using Ubuntu 17.04, then run this command instead.

sudo sed -i 's/zesty/bionic/g' /etc/apt/sources.list

After that, update software sources and upgrade software to the latest version available in the Ubuntu 18.04 repository. This step is called minimal upgrade.

sudo apt update

sudo apt upgrade

Once minimal upgrade is finished, run the following command to begin full upgrade.

sudo apt dist-upgrade

If you see this error:

Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Then run the following command to fix the error.

sudo apt update

And re-run

sudo apt dist-upgrade

After that, you can remove obsolete/unneeded software packages from your Ubuntu system.

sudo apt autoremove

sudo apt clean

Finally, reboot the system.

sudo shutdown -r now

You should now see the Ubuntu 18.04 GNOME login screen. GNOME is the default desktop environment, but you can choose Unity desktop on the login screen.

upgrade ubuntu 16.10 to 18.04 command line

Once logged in, the Ubuntu 18.04 welcome screen pops up.

upgrade ubuntu 17.04 to 18.04 command line

You can open up terminal window and check your Ubuntu version.

lsb_release  -a

You should see the following text.

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04 LTS
Release:        18.04
Codename:       bionic

Congrats! You have successfully upgraded Ubuntu 16.10/17.04 to Ubuntu 18.04. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care.

Rate this tutorial
[Total: 23 Average: 4.6]

15 Responses to “How to Upgrade Ubuntu 16.10/17.04 to Ubuntu 18.04 From Command Line

  • Dr. Mike Hughes
    3 months ago

    How do I upgrade my Web Server from 16.04 LTS to 18.04 LTS.

  • Thank you so much for this. Saved me a ton of time and it was painless. Worked perfect.

  • Your are a star Man,
    Thanks for this, you saved my life.
    God bless.
    Plz keep on posting post like this.

  • I still get an error of Hash Sum mismatch even after I ‘sudo apt get update’ and ‘sudo apt dist-upgrade’ over again and again.. Please help!

  • Thank you! I upgraded from 17.04 to 18.04.

  • Hi Can you share your sources.list file

    • This is the sources.list file for Ubuntu 18.04 on my computer.

      deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
      deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
      deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
      deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
      deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
      deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
      deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
      deb http://security.ubuntu.com/ubuntu bionic-security main restricted
      deb http://security.ubuntu.com/ubuntu bionic-security universe
      deb http://security.ubuntu.com/ubuntu bionic-security multiverse
      
  • Flattop
    4 weeks ago

    It didnt work for me. I got this error: sudo apt update
    Ign:1 http://old-releases.ubuntu.com/ubuntu bionic InRelease
    Ign:2 http://old-releases.ubuntu.com/ubuntu bionic-updates InRelease
    Ign:3 http://old-releases.ubuntu.com/ubuntu bionic-backports InRelease
    Hit:4 http://archive.canonical.com/ubuntu bionic InRelease
    Ign:5 http://old-releases.ubuntu.com/ubuntu bionic-security InRelease
    Err:6 http://old-releases.ubuntu.com/ubuntu bionic Release
    404 Not Found
    Err:7 http://old-releases.ubuntu.com/ubuntu bionic-updates Release
    404 Not Found
    Err:8 http://old-releases.ubuntu.com/ubuntu bionic-backports Release
    404 Not Found
    Err:9 http://old-releases.ubuntu.com/ubuntu bionic-security Release
    404 Not Found
    Reading package lists… Done
    E: The repository ‘http://old-releases.ubuntu.com/ubuntu bionic Release’ does not have a Release file.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: The repository ‘http://old-releases.ubuntu.com/ubuntu bionic-updates Release’ does not have a Release file.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: The repository ‘http://old-releases.ubuntu.com/ubuntu bionic-backports Release’ does not have a Release file.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: The repository ‘http://old-releases.ubuntu.com/ubuntu bionic-security Release’ does not have a Release file.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:13
    W: Target Sources (restricted/source/Sources) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:13
    W: Target Sources (universe/source/Sources) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:21
    W: Target Sources (multiverse/source/Sources) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list:31
    W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list:40
    W: Target Sources (restricted/source/Sources) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list:40
    W: Target Sources (universe/source/Sources) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list:40
    W: Target Sources (multiverse/source/Sources) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list:40
    W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
    W: Target Sources (restricted/source/Sources) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
    W: Target Sources (universe/source/Sources) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:53
    W: Target Sources (multiverse/source/Sources) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:55

    • Looks like you have edited the /etc/apt/sources.list file before following this tutorial. Maybe you should replace the content in that file with the following lines:

      deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
      deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
      deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
      deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
      deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
      deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
      deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
      deb http://security.ubuntu.com/ubuntu bionic-security main restricted
      deb http://security.ubuntu.com/ubuntu bionic-security universe
      deb http://security.ubuntu.com/ubuntu bionic-security multiverse
  • linux-newbie
    1 week ago

    Hello, does this work for Lubuntu distro? I am using Lubuntu 16.10 and it is similar to Ubuntu but it is lore lightweight because of LXDE.

    • The upgrade procedure is the same for all Ubuntu flavors, including Lubuntu. The desktop environment doesn’t matter.

  • Georgi Merhi
    7 days ago

    Hello, so I was trying your method. Everything was going fine but halfway through the minimal upgrade I suddenly got a black screen and it still persists until now.

    I have no idea what went wrong… Can you provide a solution?

  • Nataly
    6 days ago

    Hello, after reboot I have got only black screen. Sorry 🙁 I do not know, what solution better: a new computer or mind of smart man 😯

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • * Some of my previous answers are lost after I uninstalled Disqus comment system from my website. I try to recover those answers whenever I can.