Ubuntu – How to upgrade ubuntu 16.04 LTS to 18.04 LTS

16.0418.04upgrade

I am facing issues in upgrading ubuntu from 16.04 LTS to 18.04 LTS.
I followed all online sources but could not pass through the initial stages

Got the following error when I tried from the terminal

$ /usr/lib/ubuntu-release-upgrader/check-new-release-gtk
/usr/lib/ubuntu-release-upgrader/check-new-release-gtk:30: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version(‘Gtk’, ‘3.0’) before import to ensure that the right version gets loaded.
from gi.repository import Gtk

tried all possible help online

Link1
Link2
Link3

It stops in the highlighted step, as shown in image
image

Can any one help?

Closed: Reinstalled 16.04 and upgraded

Best Answer

Step 1: Upgrade the packages to the latest version for 16.04 decreases the chance of something going wrong during the upgrade to version 18.04. Run the command below

sudo apt update && sudo apt upgrade

Step 2: Install the Ubuntu Update Manager.

sudo apt install update-manager-core

Step 3: Upgrade Ubuntu

sudo do-release-upgrade

After you enter the upgrade command, you will be asked to confirm that you want to update via SSH. Type Y to continue.

Step 4: After the upgrade is complete, a restart will be required.

Step 5:To check what version of Ubuntu is currently installed, use the command below.

lsb_release -a

Edit:

You will have to remove the PPA which were added to the system

Step 1: List the PPAs

find /etc/apt/sources.list.d -type f -name "*.list" -print0 | \
    while read -d $'\0' file; do awk -F/ '/deb / && /ppa\.launchpad\.net/ {print "sudo ppa-purge ppa:"$4"/"$5}' "$file"; done

Step 2: Now, remove them

find /etc/apt/sources.list.d -type f -name "*.list" -print0 | \
    while read -d $'\0' file; do awk -F/ '/deb / && /ppa\.launchpad\.net/ {system("sudo ppa-purge ppa:"$4"/"$5)}' "$file"; done

Step 3: Install bleachbit and gtkorphan

sudo apt install bleachbit
sudo apt install gtkorphan

Step 4: Run bleachbit and gtkorphanas root

Step 5: Now, run the command

sudo do-release-upgrade

Edit

Step 1: Edit apt configuration

Press Ctrl Alt T to open terminal Now, type

sudo nano /etc/apt/apt.conf

Step 2: Change the config:

APT::Default-Release *;

Note If the apt.conf file does not exist, create your own user file in /etc/apt/apt.conf.d so you can guarantee that it won't be overwritten by package updates. Use the command to create the file

sudo touch /etc/apt/apt.conf.d/apt.conf

Then to edit your file run

sudo nano /etc/apt/apt.conf.d/apt.conf

Add this line to thee file

 APT::Default-Release *;