
Install Ubuntu 20.04 on Jetson Nano
Last updated: January 30, 2022
Introduction.
The Jetson Nano comes with an Ubuntu 18.04 version. In some situations, you need Ubuntu 20.04. Especially when Python 3.8 is required, as is the case with the popular ROS2 software. This guide discusses the upgrade to Ubuntu 20.04 on the Jetson Nano. We are going to use the standard upgrade mechanism of Ubuntu operating systems.

Please, find a complete Jetson Nano with a pre-installed Ubuntu 20.04, OpenCV, TensorFlow and PyTorch image on our GitHub page. Download the zip file, unzip and flash the image on a 32 GB SD-card, and enjoy!
Preparations.
First of all, make sure you have enough space on your SD card to perform the upgrade. You need at least 16 GB of free space.
The following action is to remove any software packages you don't need right away, such as LibreOffice. It slows down the whole procedure and you can easily reinstall them if needed.
Chromium should also be removed as it will interfere with Snap installs. You can do this by using the software updater or by command line.

Once removed, update, upgrade and clean your system.
# remove Chromium and OpenCV
$ sudo apt-get remove --purge chromium-browser chromium-browser-l10n
# refresh your system
$ sudo apt-get update
# need nano for editing some files
$ sudo apt-get install nano
$ sudo apt-get upgrade
$ sudo apt-get autoremove
Next, you need to enable distribution upgrades in the update manager by settting prompt=normal in the /etc/update-manager/release-upgrades file.
As usual, close with <Ctrl>+<X>, <Y> and <Enter>.
$ sudo nano /etc/update-manager/release-upgrades

With the update manager set, we need to refresh the software database again. Once done, you can reboot.
# refresh your system again
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo reboot
Upgrade to Ubuntu 20.04.
With all preparations made, it's time for the upgrade to Ubuntu 20.04. It will take several hours. Unfortunately, some input is required throughout the procedure as there are questions to be answered. Check your screen now and then. Answer all questions with the suggested default value.
# upgrade to Ubuntu 20.04
$ sudo do-release-upgrade

After entering <y>, the transformation will take place. As mentioned, some questions are asked during the process. Always confirm the default value. There may also be a notification that a new Ubuntu version is available, the Hirsute Hippo 21.04 version. Please cancel that notification, as we won't be installing that version for a while.
When Ubuntu 20.04 is installed, all obsolete files can be removed from your drive, as the screen shows.

Now that the packages have been removed, Ubuntu will ask for a restart. Don't reboot now! That's really important.

You need to check some files and make some changes before Ubuntu can reboot. If you forget this, you will get a warning every time Ubuntu starts. So do it right away.
First, check that WaylandEnable=false is uncommented in the /etc/gdm3/custom.conf file.

Uncomment (remove the hash before the line) Driver "nividia" in the file /etc/X11/xorg.conf.

Finally, reset the upgrade manager to never.

Now you can safely reboot the system.
# check and editing some files
$ sudo nano /etc/gdm3/custom.conf
$ sudo nano /etc/X11/xorg.conf
$ sudo nano /etc/update-manager/release-upgrades
$ sudo reboot
Starting Ubuntu 20.04 on your Nano.
A few preparations are needed before you can fully enjoy Ubuntu 20.04 on your Jetson Nano.
Start with the well-known update, upgrade and autoremove cycle. You will get probably no upgrades as Ubuntu is just installed. However, autoremove will free a lot of memory by deleting obsolete files.
Next, delete the directory /usr/share/vulkan/icd.d to prevent lavapipe warnings when using Jtop. It looks the folder is removed in the latest Jetpack as well.
# remove icd.d
$ sudo rm -rf /usr/share/vulkan/icd.d
Remove also an annoying circular symbolic link in /usr/share/applications that makes the same app appear 86 times in your software overview.
# prepare your system
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get autoremove
# remove circular symlink
$ sudo rm /usr/share/applications/vpi1_demos
# remove distorted nvidia logo in top bar
$ cd /usr/share/nvpmodel_indicator
$ sudo mv nv_logo.svg no_logo.svg
The last action is to re-enable the original NVIDIA repositories, which were disabled during the upgrade. In the folder /etc/apt/sources.list.d/ you will find the five files that needed to be changed. Open each file with $ sudo nano and remove the hash in front of the line to activate the repository.

gcc-8.
Ubuntu 20.04 comes with gcc version 9.3.0.

Some software packages, especially the CUDA software, requires a gcc version 8. We shall install this version besides the already available version 9. With a simple command, you can now switch between the two versions. The gcc compiler is always accompanied by the corresponding g++ compiler. The latter will also be installed.
# install gcc and g++ version 8
$ sudo apt-get install gcc-8 g++-8
# setup the gcc selector
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8
# setup the g++ selector
$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9
$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8
# if you want to make a selection use these commands
$ sudo update-alternatives --config gcc
$ sudo update-alternatives --config g++
Always select the two corresponding versions at the same time. Otherwise, very obscure errors may occur during compilation. As mentioned, if you want to compile software that requires CUDA or cuDNN, such as OpenCV, choose version 8.
Your choice is saved and applied system-wide. Even after a reboot, the selected pair is still active. The only way to change the versions is to resubmit the command.

The same goes for the clang compilers. In this case, the CUDA and cuDNN need version 8, while Ubuntu installs default version 10. You can either install version 8 right away with $ sudo apt-get install clang-8 or install more versions and create an sudo update-alternatives --config just like above.
Warnings.
- Do not install Chromium as it will interfere with the Snap installation. Use the preinstalled Morzilla Firefox.
Upgrading.
You may run into problems upgrading Ubuntu 20.04 on your Jetson Nano after a while. The Software Updater cannot install all the packages listed. When you run $ sudo apt-get upgrade you will see the following screen.

The problem is the wrong version of the nvidia-l4t-init file. Since many other packages depend on this file, the entire upgrade process terminates.
You must first install the correct version before any further upgrade can succeed.
The command $ sudo apt --fix-broken install gives you the following information.

It seems that /etc/systemd/sleep.conf is blocking the upgrade. The easiest solution is to force the upgrade with the command $ sudo dpkg -i --force-overwrite. Note, the location of the nvidia-l4t-init file is given in the output of the previous fix-broken command.

As you can see, the sleep.conf is overwritten, and nvidia-l4t-init is installed successfully.
Now you can upgrade your Ubuntu 20.04 with the usual command $ sudo apt-get upgrade.
Final remarks.
Ubuntu 20.04 is now fully functional on your Jetson Nano. You can customize the installation further to your own needs.
We were surprised by how long it takes for some assignments to complete. When we set up the dphys swap mechanism for the OpenCV installation, it took five nerve-wracking minutes for the reboot to complete. We stare at a blank screen all the time. So be patient is the advice in such cases.
We also had to disable the power-saving blank screen option in the settings as it gives unstable results when rebooting from sleep mode.

There are reasons why Nvidia doesn't ship Ubuntu 20.04 with its JetPacks. It certainly has to do with the little added value compared to version 18.04. But there will also be other reasons. Therefore, see this Ubuntu 20.04 version as an experiment. That's why it comes without any warranty, and we cannot provide (technical) support in any way.
We would like to thank Bob Davis for his contribution to this page. Without his input, this page would not be published.