Important Settings

Ubuntu Server 20.04 LTS

  1. Upgrade your local Ubuntu Server from 20.04 to 22.04 LTS

Keep a backup of your most sensitive data to avoid unnecessary risks.

Update your system with the following command

sudo apt update
sudo apt upgrade
sudo apt autoremove   #Removes all obsolete packages from your system

Check the system version

cat /etc/os-release
lsb_release -a   # another command 

Normally, the update-manager-core package should be installed, but you’d better be sure

apt install update-manager-core

Now do the upgrade with the command

do-release-upgrade

You may see a screen where you will be asked if you want to automatically restart the services.

Restart Services during package upgrades without asking?

Select "yes" and proceed.

You will then be informed of the number of new packages to install and how long it may take.

You will then be asked about obsolete packages and if you want to remove them.

Finally, if all goes well, you will see this message stating that the process was successful and that to enjoy the new system, you will need to reboot your computer.

After rebooting check the ubuntu version installed/system version with

cat /etc/os-release  
lsb_release -a   # another command 

Packaging problem with 22.04. After upgrading to Ubuntu Server 22.04 you may get this message - " libssl.so.1.1: cannot open shared object file: No such file or directory".

Fix this with:

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb

sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb

PS: If the link is expired, check http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/?C=M;O=D for a valid one.

Current version is: libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb

  1. Set Grub2 bootloader to remember the last boot choice in your dual boot operating system

Edit the grub file with text editor:

sudo nano /etc/default/grub

GRUB_DEFAULT=0

GRUB_TIMEOUT_STYLE=hidden

GRUB_TIMEOUT=10

GRUB_DISTRIBUTION='lsb_release -i -s 2> /dev/null || echo Debian'

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

GRUB_CMDLINE_LINUX=" "

Put the following two lines and save the file:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then run:

sudo update-grub
  1. Check Kernel Version

You can use any of the following three commands to check the kernel version

uname -srm
hostnamectl
cat /proc/version
  1. How to boot into a specific kernel version

Get the currently installed kernel menu entries using the command below.

sudo grub-mkconfig | grep -iE "menuentry 'Ubuntu, with Linux" | awk '{print i++ " : "$1, $2, $3, $4, $5, $6, $7}'

1 : menuentry 'Ubuntu, with Linux 5.4.0-80-generic (recovery mode)'

2 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic' --class ubuntu

3 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic (recovery mode)'

4 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic' --class ubuntu

5 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic (recovery mode)'

Modify the GRUB_DEFAULT=0 value as per your need.

Currently my server booted with 5.4.0-80-generic

uname -srn

Linux ubuntu 5.4.0-80-generic

So i want to boot my system with 4.15.0-45-generic which is menu entry 4.

Modify GRUB_DEFAULT="1>4" value in /etc/default/grub

Execute below command to regenerate a grub config file with modified GRUB_DEFAULT settings.

sudo update-grub

Reboot the ubuntu system.

sudo systemctl reboot

Post reboot my ubuntu server booted with old kernel 4.15.0-45-generic

uname -srn

Linux ubuntu 4.15.0-45-generic

5. Uninstall specific kernel version

As root, issue the following commands:

dpkg -l | grep linux-image

Find the kernel image you want to remove, which should be linux-image-5.11.0-38-generic (be sure it is). Then

apt-get remove linux-image-5.11.0-38-generic 

I don't think a GRUB update is needed, it should just disappear from the GRUB menu. If you get any errors with GRUB just issue, also as root, update-grub.

Last updated