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: 7 Average: 4.7]

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

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.