Upgrade Ubuntu Desktop

2 minute read

Published:

Blog Post #10

Upgrading Ubuntu 20.04 to 22.04

Step0:
lsb_release -a
Cmd to check the current Ubutnu version

df -H
Cmd to check storage, better to have 25GB or above before upgrading


Step1:

sudo apt update -y && sudo apt upgrade -y

sudo apt dist-upgrade

Make sure to update & upgrade all the packages before upgrading the whole system

sudo apt autoremove

Cmd to remove unnecessary installation package

sudo apt install update-manager-core

sudo reboot


Step2:

sudo do-release-upgrade --check-dist-upgrade-only

sudo do-release-upgrade -d --allow-third-party

Troubleshooting #1

Ideally, it should start to upgrade. But if you encounter error like please install all available updates for your release before upgrading, that’s mean you haven’t update all the packages with the sudo apt update -y && sudo apt upgrade -y, to solve the problem, you will need to manually update ALL of them in Software Updater until your computer is up to date like below:

Troubleshooting #2

After reboot, if you can’t even turn it on and a similar screen pop up like below, maybe there is a contradiction between the newly updated system and the driver of the graphic card (not sure whether you will face the same error, but at least it is for my case). To check whether you are in this case, please follow the steps below:

Firstly, power on the computer in recovery mode, then press Ctrl + Alt + F4 and login as sudo user, run cmd sudo apt update -y && sudo apt upgrade -y, if you encounter errors related to the driver descripted above, you may refer to the steps below to solve the problem.

cd /var/lib/dpkg
sudo mv info info.bak
sudo mkdir info
sudo apt-get upgrade

After that, sudo reboot now it, it should work fine now.

Troubleshooting #3

After upgrading and login successfully, running nvidia-smi brings you error msg NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver.It means it still can’t recognise the Nvidia Driver. Please follow the steps below to solve the issue.

sudo apt update
sudo apt upgrade
sudo apt install ubuntu-drivers-common
sudo ubuntu-drivers devices

Since it recommends nvidia-driver-535, so you may install it by sudo apt install nvidia-driver-535

However, if you face gcc-11-base library contradictioon between the old UbuntuOS and the newly updated UbuntuOS, please delete all the gcc-11-base library via sudo apt remove gcc-11-base And finally sudo reboot it


References

  1. https://www.kwchang0831.dev/dev-env/ubuntu/upgrade-from-20.04-to-22.04
  2. https://ubuntu.com/tutorials/upgrading-ubuntu-desktop#1-before-you-start
  3. https://blog.csdn.net/mathematican/article/details/119673647
  4. https://www.youtube.com/watch?v=5ipmJIVJSho&t=229s
  5. https://www.cherryservers.com/blog/install-cuda-ubuntu