How to upgrade Ubuntu including kernel to the latest stable release

Sergey Sypalo

page.title | Devops

In this article, I will show you how to upgrade your Ubuntu 20.04. As a bonus, we will also update the kernel to the latest stable version 5.6.15 or mainline 5.7 of your choice, which contains the following improvements:

  • WireGuard Support
  • New processor cooling driver
  • USB4 support
  • Amazon Echo Support
  • Improved hardware support
  • VirtualBox Folder Sharing
  • F2FS data compression using LZO / LZ4

And here is a short list of what's new in Ubuntu 20.04:

  • Best and fastest GNOME 3.36 desktop with dark theme support
  • Improved support for 4K monitors and zoom
  • New themes and visual settings
  • Quick install, fast boot
  • Global do not disturb
  • Best Thunderbolt Support
  • Best support for nVidia graphics cards

To upgrade Ubuntu to the latest stable release 20.04, follow these steps:

			# Update packages list            
			sudo apt-get update
			
			# Upgrade packages
			sudo apt-get upgrade

			# Install update-manager-core package
			sudo apt-get install update-manager-core

			# Upgrade distro
			sudo apt-get dist-upgrade

			# Update Ubuntu
			sudo do-release-upgrade	   
		

To upgrade Ubuntu to non-lts release (e.g. from 18.04 to 19.10), follow these steps:

			# Update packages list            
			sudo apt-get update
			
			# Upgrade packages
			sudo apt-get upgrade

			# Install update-manager-core package
			sudo apt-get install update-manager-core

			# Upgrade distro
			sudo apt-get dist-upgrade

			# Change default branch from lts to normal
			sudo sed -i 's/lts/normal/g' /etc/update-manager/release-upgrades            
			
			# Change default distro from your current
			# 18.04 - bionic            
			# to
			# 19.04 - disco
			# 19.10 - eoan
			# in the example below we are upgraing from ubuntu 18.04 (bionic) to 19.10 (eoan)
			sudo sed -i 's/bionic/eoan/g' /etc/apt/sources.list            

			# Update packages list            
			sudo apt-get update
			
			# Upgrade packages
			sudo apt-get upgrade
			
			# Run full upgrade
			sudo apt-get dist-upgrade

			# If any error re-run
			sudo apt-get update 
			sudo apt-get dist-upgrade

			# Run cleanup
			sudo apt-get autoremove 
			sudo apt-get clean
		   
			# Reboot the system
			sudo shutdown -r now
		

To Upgrade Ubuntu kernel to the latest 5.6.15 build, follow the steps:

			# Change current directory to /tmp
			cd /tmp/

			# Download new kernel
			# if links below won't work, go to https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6.15
			# and get new ones for your system, typically amd64
			wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6.15/linux-headers-5.6.15-050615_5.6.15-050615.202005271638_all.deb
			wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6.15/linux-headers-5.6.15-050615-generic_5.6.15-050615.202005271638_amd64.deb
			wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6.15/linux-image-unsigned-5.6.15-050615-generic_5.6.15-050615.202005271638_amd64.deb
			wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6.15/linux-modules-5.6.15-050615-generic_5.6.15-050615.202005271638_amd64.deb
		

And if you want to be on the last branch of the update and want to upgrade the Ubuntu kernel to the latest version 5.7-rc7, follow these steps:

			# Go to the /tmp directory
			cd /tmp/

			# Download the new kernel
			# if the links below do not work, go to https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7
			# and get new ones for your system, usually amd64
			wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7/linux-headers-5.7.0-050700_5.7.0-050700.202005312130_all.deb
			wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7/linux-headers-5.7.0-050700-generic_5.7.0-050700.202005312130_amd64.deb
			wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7/linux-image-unsigned-5.7.0-050700-generic_5.7.0-050700.202005312130_amd64.deb
			wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7/linux-modules-5.7.0-050700-generic_5.7.0-050700.202005312130_amd64.deb
		

Next, the steps will be the same regardless of the kernel branch to which you are updating, stable or the last:

			# Install new kernel
			sudo dpkg -i *.deb

			# Reboot the system
			sudo shutdown -r now

			# Update packages list            
			sudo apt-get update
			
			# Upgrade packages
			sudo apt-get upgrade

			# Reboot the system if needed
			sudo shutdown -r now

			# Check the OS distro
			lsb_release -a

			# Check the kernel version
			uname -r
		

That's it, now you should be running on the latest best-looking Ubuntu 20.04 and most secure Linux Kernel.