Are you trying to update Ubuntu from 16.04 to 18.04 via command line?
This guide will help you.
You can upgrade from one Ubuntu release to another without reinstalling your operating system. If you're running an LTS version of Ubuntu, you'll only be offered new LTS versions with the default settings—but you can change that. We recommend backing up your important files before continuing.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Ubuntu related tasks.
In this context, we shall look into the steps to upgrade the Ubuntu version.
What's new in Ubuntu 18.04 ?
Here are the different features that are available in the Ubuntu version 18.04:
i. The Linux kernel 4.5 now includes better features like AMD secure memory encryption support, CPU controller for the cgroup v2 interface, the latest MD driver with software RAID enhancements, and improved power management for systems.
ii. The new kernel also includes some Ubuntu-specific updates, Linux security module stacking support, and the signing of POWER host and NV kernels is now supported.
iii. Welcome screen and improved help pages
iv. It installs Python 3.6
v. Apache updates to version 2.4.29 and supports HTTP/2.
vi. Nginx updates to version 1.14.0.
vii. PHP updates from version 7.1 to 7.2.
viii. 32-bit PowerPC support is dropped.
ix. Easier live patching.
A few known issues of Ubuntu 18.04
i. In the partitioning step, you will be allowed to configure LVM across multiple devices without you to create a separate boot partition. This might lead to the bootloader installation to fail or cause failures to boot.
ii. With the new Ubiquity installer, importing SSH keys for GitHub or Launchpad won’t work.
iii. Removal of the LVM group is not possible if volume groups of the same name are found during installation. So make sure to format the drives before installing.
How to update Ubuntu from 16.04 to 18.04 command line ?
Below is the procedure to follow to update the Ubuntu version:
1. The first step is to create a backup of your environment.
2. The next step is to upgrade all the already installed packages of current Ubuntu version 16.04. For that, we run the command
$ sudo apt-get update && sudo apt-get upgrade
You will be asked for the confirmation of the upgrade. Enter Y to continue.
You can reboot the Linux if the kernel updates.
$ sudo reboot
3. Run the below command to install the Update Manager in your server.
$ sudo apt install update-manager-core
4. Upgrading Ubuntu
Now we upgrade Ubuntu by running the command:
$ sudo do-release-upgrade
As a result, of the above command, you will be asked for the confirmation of upgrade via SSH. Enter Y and hit enter.
The installation will take some time to complete. In between the installation, you will see some prompts that will require your interaction so make sure you are available to respond to those prompts.
Once the upgrade completes, a restart is required.
During the restart, you will be logged out. Make sure to login back and check the ubuntu version by running the below command.
$ uname -r
Also, ensure that the necessary ports are open using ss or netstat command as shown below.
$ sudo ss -tulpn
$ sudo netstat -tulpn
You can make use of grep/egrep command or tail/cat command to verify the error logs.
$ tail -f /path/to/log/files
Finally, remove the TCP port 1022 via ufw.
$ sudo ufw delete allow 1022/tcp
How to tackle the Ubuntu 16.04 to 18.04 update errors ?
To update Ubuntu from 16.04 to 18.04, we used the below command,
Using this method, we came across a known bug which doesn’t allow to continue with the upgrade. Instead, it throws an error.
In case, if you come across an error message, then run the below commands to fix this error.
$ sudo apt-get update
$ sudo apt-get upgrade -y
$ sudo apt-get dist-upgrade
$ sudo do-release-upgrade
After running the above commands, continue with the Ubuntu upgrade process.