How to upgrade Ubuntu to 22.04 and kernel to 5.17

Sypalo.com

How to upgrade Ubuntu to 22.04 and kernel to 5.17

In this article, I will show you how to upgrade Ubuntu to 22.04. As a reminder, this is a future release with long term support, but still under development. If you want to upgrade to one of the previous versions, I will also show you how to do it. As a bonus, we will also update kernel to the latest mainline 5.18-rc7 or stable 5.17.8. The latest Ubuntu Jammy 22.04 contains the following improvements:

  • Updated installer
  • Linux Kernel 5.13
  • GNOME 40
  • NVIDIA Closed-Source Driver Now Supports Wayland
  • Zstd compression for packages
  • Firefox Is Now Shipped as a Snap
  • The Yaru Light Theme Is Now Default
  • Multitouch gestures
  • PulseAudio 15 With Bluetooth LDAC Support
  • Graphical Applications in Windows Subsystem for Linux
Before we start I want to let you know that DigitalOcean gives you $100 for free to try their services. You can run VMs or containers, deploy websites and do a lot of cool stuff, including checking how smooth the Ubuntu do 22.04 upgrade will go.
Digital Ocean services

To perform Ubuntu upgrade to 22.04 you will need around 1 hour to follow these steps:

Preparation

  1. Update packages list
    sudo apt-get update
  2. Upgrade packages
    sudo apt-get upgrade
  3. Install update-manager-core package
    sudo apt-get install update-manager-core

Upgrade Ubuntu

  1. Upgrade distro
    sudo apt-get dist-upgrade
  2. Upgrade Ubuntu to the latest LTS release

    In short, it only takes one command to upgrade from one LTS (Long Term Support) version of Ubuntu to another. It is also recommended that you upgrade your Ubuntu to the latest LTS version to avoid the hassle of updating packages to a version that is too new from the one currently installed.
    If your version is 18.x or lower, run the following command (this step will have to be repeated several times until the Ubuntu version is 20.04):

    sudo do-release-upgrade
  3. Change default branch from lts to normal

    Otherwise, if you are already on 20.04 and an experienced Linux user, you can skip this step and go straight to upgrading Ubuntu to Jammy Jellyfish 22.04. (These are the same steps you need to take when upgrading Ubuntu to a short-term support (odd-numbered) version, as well as a development version like 22.04 now.)

    sudo sed -i 's/lts/normal/g' /etc/update-manager/release-upgrades
  4. Change default distro from your current
    • 14.04 - trusty
    • 16.04 - xenial
    • 18.04 - bionic
    • 18.10 - cosmic
    • 19.04 - disco
    • 19.10 - eoan
    • 20.04 - focal
    • 20.10 - groovy
    • 21.04 - hirsute
    • 21.10 - impish
    • 22.04 - jammy (development branch)

    in the example below, we are upgrading from Ubuntu 20.04 (focal) to 22.04 (jammy)

    sudo sed -i 's/focal/jammy/g' /etc/apt/sources.list
  5. Update packages list
    sudo apt-get update
  6. Upgrade packages
    sudo apt-get upgrade
  7. Run full upgrade
    sudo apt-get dist-upgrade
  8. If any error re-run
    sudo apt-get update
    sudo apt-get dist-upgrade
  9. Run cleanup
    sudo apt-get autoremove
    sudo apt-get clean
  10. Reboot the system
    sudo shutdown -r now

Upgrade kernel

  1. Change current directory to /tmp
    cd /tmp
  2. Download kernel
  3. Install new kernel
    sudo dpkg -i *.deb
  4. Reboot the system
    sudo shutdown -r now

Finishing up

  1. Update packages list
    sudo apt-get update
  2. Upgrade packages
    sudo apt-get upgrade
  3. Reboot the system if needed
    sudo shutdown -r now
  4. Check the OS distro
    lsb_release -a
  5. Check kernel version
    uname -r

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