Notes on upgrading to Ubuntu 22.04 and ROS2 Humble [Laptop + RPi]

12 min readJan 3, 2023

I have been pushing upgrading to ROS2 Humble Hawsbill for a while and decided to take advantage of holidays and take a plunge. Here are my notes on my experience, hope someone else out there can use it. I’ll talk about two main areas — main laptop upgrade and the Raspberry Pi 4 [mine was 8Gb] upgrade both to Ubuntu 22.04 from 20.04 and from ROS2 Foxy to Humble.

Main Laptop upgrade

I have been a pretty loyal ROS2 Foxy fan and have been running Ubuntu Focal Fossa a.k.a. 20.04 as a dual boot laptop for a while. My laptop has Nvidia RTX 3070 card so it also needs NVidia drivers. Here are the steps I followed.


Of course, started with backing up the Home directory on my Ubuntu 20.04. Basically, just got a 64 Gb SD Card and used the Out of box Ubuntu Backup App to back it up to the SD Card. The Backup utility allows you to also back it up on network drive if you prefer that and you can configure directories to ignore like Downloads directory.

As a precaution, I also took inventory of existing packages [ubuntu, snaps and python] that are installed currently by running following command. This will also help me to compare the ROS2 packages I may be missing that I need to install on Humble.

sudo apt list — installed > ~/yourfilename.txt
sudo pip list > ~/python_pkgs.txt
snap list > ~/snap_pkgs.txt


I read a bunch of articles on upgrading to 22.04 before plunging into it. Lot of articles talked about using command line and few about using the Software Update GUI App. I chose to go with the GUI app.

As soon as I clicked on upgrade button first thing it warned me with big message — that I currently have a ROS2 installation and it may not work with newer Ubuntu version, which is true. ROS2 foxy binaries are distributed specifically for 20.04 and they will stop working after the upgrade. But I knew that so I selected to click OK and move forward with upgrade process.

It will also warn you that it will turn off your auto screen lock while it is going through the upgrade process.

The upgrade process itself was pretty smooth. During the inspection phase Ubuntu generated a very detailed report on which packages/snaps will be upgraded and which ones will be removed which was really nice to see upfront as you can still cancel the upgrade at that point if you are not sure.

I got a few prompts for choosing the current vs new config files for things like Chrony and Grub. For Chrony I modified the config file so I kept my current. For Grub eventhough it showed the file had been touched [by Grub Customizer] it didn’t show me any actual differences so I went with new one.

In addition, it informed me that the firefox will be removed and converted to a snap install.

After that it just went through lot of upgrades and completed after 40–50 mins or so. And asked me to reboot. I crossed my fingers and rebooted. The reboot was successful but I didn’t see the familiar jelly fish background or proper color scheme so I was a bit concerned.

Post Install

After the installation was complete, I tried the standard

sudo apt update && sudo apt upgrade -y

This updated any packages that needed to be upgraded and it also identified a series of packages that could be removed.

I was very excited to install ROS2 Humble right away so I went ahead and used the linorobot/ros2me scripts to upgrade. The script did its job but encounted a series of errors due to incompatibility with already installed libraries or broken packages. I realized that it was not the issue with the script but the fact that I didnot remove old Foxy packages was the main problem.

Please run these commands before you install ROS2 Humble, it will save you a lot of headache.

sudo apt remove ~nros-foxy-* && sudo apt autoremove

sudo apt-get update && sudo apt-get autoclean && sudo apt-get clean && sudo apt-get autoremove

After that you can follow the instructions on ROS2 Humble installation steps page or run the linorobot/ros2me script like this, its the easiest way to install ROS2 Humble. The script automatically detects the correct architecutre, installs the desktop or non-desktop version of ROS2 and shows you how to add the source command to your bash script so everytime you launch a terminal ROS will be sourced from humble directories.

git clone
cd ros2me

In addition to ROS2 Humble Desktop I also installed ROS2 Humble desktop full to get all other tools installed. This also installs latest LTS version of new generation of Ignition Gazebo Fortress. You can also install dev tools so you can do development using tools like colcon etc.

sudo apt install ros-humble-desktop-full
sudo apt install samba chrony i2c-tools libi2c-dev python3-smbus joystick
sudo apt install ros-dev-tools

That should get you to a place where you are able to run the ros2 command and also be able to test demo talker node from examples.

One last problem area was that NVidia graphics card was just not getting recognized on the new 22.04 system even after I followed several articles to upgrade the drivers and so on.

The main issue I had was my laptop is a dual boot machine and it has UEFI Secure boot option enabled. It took me a while to figure out that the new NVidia driver installer was not promting me to enroll into the MOK signing process which was then resulting in rejection of the NVidia driver and it fell back to Intel drivers each time. I tried to enable the secure boot with several different commands but had no good luck with it. So finally I gave up and disabled the secure boot in the BIOS and then the NVidia drivers loaded correctly at the time of system boot. It will be a follow up item for me to tinker with it later to figure out what needs to be done to make it work with secure boot enabled.

Raspberry Pi upgrade

For the RPi upgrade I had two choices whether to upgrade the existing 20.04 SD Card or just build a new one. Since it is an SD Card I went with new Card that way I have a full backup of working ROS2 Foxy in the original card.

I thought this would be easier than laptop but it actually turned out to be a lot harder and took me at least 3 different trials of building the SD Card from the scratch. More on those issues later.


Even though you do have full original SD card that is going to be left untouched because we are going to build a new card from scratch, it is still important to backup a series of files so that we can copy those over after the RPi boots first time.

I backed up following items from RPi to laptop via a samba share that I’m able to access from laptop for files that need to be backed up from RPi.

  • samba config — this will be /etc/samba/smb.conf
  • chrony config — /etc/chrony/chrony.conf [this allows me to sync up time for RPi with laptop so ROS doesn’t drop any messages]
  • list of python, ubuntu and snap packages installed — just direct the list command outputs to separate files to keep it for reference
  • user groups — groups <username> to note the groups that the current RPi user is part of so that we can do the same on the new SD Card
  • udev rules — all the rules files from /etc/udev/rules.d directory
  • swap file config — /etc/fstabs
  • bash files — ~/.bashrc and ~/.bash_aliases
  • boot config for any changes — /boot/firmware/config.txt
  • .ssh folder and any ssh keys — this will be a lot easier if you have created ssh keys to connect with RPi and also any keys to connect with your git server

Build SD Card

I had two options here as well, I believe any of them should work. I tried to build using the Real Time Kernel image available here. Thanks to @kamathsblog for pointing this real time kernel repo to me. Nice thing about this is, it already comes with ROS2 Humble installed and it supposed to be better for working with real time applications like high frequency sensors and such.

I used RPIImager app [you can either do debian install or snap install for it] for building both RT image based SD Card as well as standard ubuntu server based SD Card. Cool thing is you can click on the gear icon on RPiImager and it lets you setup your own username/pwd for default user as well as Wifi credentials so as soon as you boot up RPi, you can immediately connect to it via ssh from your laptop and you are in business.

However, first time I tried using an SD Card built using RT Kernel image, I ran into lot of freezing and hanging issues with RPi when I tried to compile my big robot workspace that had 17 different packages, some of them included complex packages like depthai and its examples

I thought I was doing something wrong so I tried building it two times using the RT Kernel image for humble and I ran into same freezing issues on RPi where the RPi would just freeze and ssh connection from command line or VS code would be disconnected. This was very risky because that meant I had to hard power down the RPi and that always had a risk of corrupting the SD Card if you don’t do proper shutdown command.

At this point I gave up on Real Time Kernel image and downloaded the Ubuntu 22.04 image directly from Ubuntu RPiImager and built the SD card third time from scratch. After completing the Ubuntu load and humble install and trying to compile the same robot project, same freezing issue happened again.

At this time I reached out to my robotics friends on twitter and they reported that it could have been possibly Humble Deskop package. I was also suspecting that it was something missing in ssh timeouts or other configurations Or something wrong with not having enough swap memory or simply VS Code having issues. However, this same exact setup of RPi for Ubuntu 20.04 + Foxy has worked for me for almost 3 years without any problems so it is a bit painful to see these issues.

After eliminating things step by step, it came down to the fact that there is some issue with combination of Ubuntu 22.04 + ROS2 Humble while using colcon build. I found a couple of posts on ROS discourse where folks ran into similar issues with RPi4 while running colcon build, see references.

The solution turned out to be fairly simple for now, just using the following command to compile your workspace as this minimizes the CPU processing and builds each package sequentially as opposed to running a few in parallel as colcon seems to be doing by default.

MAKEFLAGS="-j1 -l1" colcon build --symlink-install --executor sequential

In summary, it probably should not make any difference whether you go with Real Time Image or Out of box Ubuntu Server image since the issue seems to be related to some sort of defaults for colcon on 22.04 + Humble. I have kept the out of box Ubuntu server based SD Card for now. But when I get sometime to test the RT image based SD card again, I’ll update this article. Some posts on ROS discourse also implied that it may be related to the setuptools version 59 and they were able to resolve it by installing 58.2.0 version so you may want to try that as well.

Post Install

Here are the post install steps after building the new SD Card for Ubuntu 22.04.1 server. If you chose the Real Time kernel path you don’t have to install Humble although you may have to install dev tools and other packages. You can also consider using linorobot/ros2me script [if you go with plain Ubuntu server image as starting point] even on RPi as it will install ROS2 Humble with correct versions once it detects Ubuntu 22.04 on arm architecture.

After the basic SD card is ready make sure to follow these steps although some these may vary for you depending on your own setup and your robot.

  1. sudo apt update && sudo apt upgrade -y
  2. Add a swap file — follow swap file creation section of my article here. I added 1Gb swap file and updated the fstab file to make it permanent
  3. Restore all the config files you backed up during backup stage e.g. bash files, chrony config, samba config, udev rules and ssh files
  4. Git comes installed out of box for Ubuntu so you don’t need to install separately. However, make sure to set the git global config to your choice of user, email etc so when you try to work with git, you don’t get stopped
  5. One additional step that I have seen other folks recommend and I did as well is to install the setuptools v 58.2.0 instead of latest 59 as this fixes lot of warning and other compiler errors [pip install setuptools==58.2.0]
  6. After all the above steps are done, goto your robot workspace root folder and do rosdep init and rosdep update. This will install all the package dependencies that you may be missing that didn’t get installed for some reason when you installed Humble, including things like ros2_control packages and other dependencies that your packages may have.

At this point I was able to get a build with just a few compile errors for my custom hardware_interface package I created for dynamixel motors. Apparently, the interfaces have some breaking changes from foxy to galactic to humble. So I had to get and update my code, it took a couple of hours to do the merges carefully and commit changes back into my repos but everything worked during compilation after that.

The only runtime error I got when I launched by robot first time was the fact that for ros2_controller spawning the has now been renamed to simply spawn so once I updated that in launch file, the robot came up with all the expected ros2 topics.

One more thing I want to do as a follow up item is to convert my robot to use the new Ignition Gazebo instead of old classic Gazebo but it will take sometime to figure out all the steps needed to do that and again that one will be on the main laptop machine not on the RPi as you don’t want to run heavy simulator stuff on the RPi.

This was probably the biggest “surprise” for me while doing the upgrade to Humble. Humble does not come with binary distribution of old Gazebo Classic. If you want to install Gazebo Classic, you’ll have to install it from source for Humble. This also means that if you are like me and did not invest time in learning about Ignition Gazebo before you upgrade to Humble, you’ll have to do it quickly. Good news is, its not that difficult but it does take sometime to first get used to running/launching world and spawning your robot in the Ignition Gazebo. There are some examples in the documentation on how to use URDF to launch your robot in new Ignition Gazebo, however it seems that the preferred method going forward is going to be SDF file format but I could be wrong. Again, good news is Ignition Gazebo comes with out of box tools to convert your URDF file to SDF file format, however if your original URDF file was organized is several xacro files that were compiled at run time into complete URDF, you’ll have to first compile the complete URDF file on xacro command line and then input that into ign gazebo command line to convert it to SDF. I have not checked it myself but it may be possible to wire up these steps in launch file. May be this is a subject for future blog article on getting robot up and running with Ignition Gazebo.

Hope some of the pain I went through helps you make a little less troublesome upgrade to ROS2 Humble for your robot and main machine.

Hopefully it will last for another three years or so. Enjoy!!

Goodbye trusty old friend — ROS2 Foxy!!!