Which Ubuntu flavor for your ROS2 Foxy Fitzroy Projects

RoboFoundry
6 min readMar 29, 2021

Here is quick summary of my experiences with using different flavors of Ubuntu while working on ROS2 Foxy Fitzroy distribution. I spent quite a few hours trying out different combination and hitting dead ends and some wasted time not knowing which combinations will work and which ones will get me to dead ends.

My requirement was pretty straightforward, I wanted to run — ROS2 Foxy on Raspberry Pi 4 with Ubuntu as foundation.

The main reasoning for this was, I didn’t want to spend time on older versions of Ubuntu or ROS2 distributions when Foxy FitzRoy distribution has been out in the wild for a while. Of course, there is a price to be paid for staying with latest version of ROS2 and I have realized that all the examples in python for ROS2 development are mostly still pointing to ROS1 flavors [although ROS community is very helpful and growing by leaps and bounds] and I’ll have to rollup my sleeves and convert some of that code but description of that experience will be subject of future blog posts.

Getting back to main topic for this blog post, I evaluated 3 different flavors of Ubuntu for ROS2 Foxy development:

  1. Ubuntu Core — this was the one recommended in the First Robot article series by Canonical
  2. Ubuntu Server — this is a minimum distribution to run Ubuntu and has no extra stuff
  3. Ubuntu Desktop — this is a typical version you would run on your main computer like a laptop or desktop and is a bit of overkill for Raspberry Pi 4.

Ubuntu Core

Follow the installation instructions from Canonical to install it on your Raspberry Pi 4.

As explained in the First Robot Series from Canonical, the installation was actually very easy and after you burn the right image on the SD card and boot it first time, the setup wizard actually walks you through the wifi setup and other steps. The wifi is a big deal because it gets you up and running by connecting to it via SSH very quickly.

Another big advantage of this flavor is that it is secured by creating an SSO account on Ubuntu site and setting up your SSH keys on that account. The first time you connect to internet, it will ask you for your email address that you used to register your SSO account and it will automatically download the SSH keys to your Ubuntu Core. So it secure right out of the gate, you don’t need a default login or anything, you just install that SSH key on whichever computer you want to connect from and you will be able to access the Ubuntu on your Raspberry Pi 4 right away.

So what is the problem — The main issue for me was the fact that Ubuntu core does not support apt installation system out of box so you have to use snap for installations. Ubuntu has decent documentation on how to do it and you actually do it by installing classic snap that lets you run all your apt installation commands. However, as I went further into installation part and got to the point where I started to install ROS2 Foxy packages, I started running into all sorts of errors and incompatibility issues while running steps for installing Foxy. I spent a couple of days trying to fight and troubleshoot all the issues but finally realized that I had made a fundamental mistake. ROS2 Foxy distribution assumes that you have Ubuntu 20.04 Focal Fossy running as baseline and when you install classic snap, it comes with Xenial as a base. So all the pain I went through was because of that incompatibility. And the First Robot series has steps that work for installing ROS2 Dashing which is compatible with Xenial but as I said earlier, I did not want to spend time with older distribution of ROS so this was not viable option. If you are Ok with following exact steps for Dashing you’ll be fine using Ubuntu Core.

Now I’m not an expert on the Ubuntu flavors and someday I’ll learn a way to workaround this issue. However, I did not want to burn anymore of my time on chasing a dead end. There must be a way to upgrade the classic snap to Focal Fossy from Xenial but I don’t know how to do it and so I had to abandon that route.

So even though I would have loved to use Ubuntu Core this was a major limitation I ran into and I could not get around it.

Ubuntu Server

Follow these instructions to install Ubuntu Server for Raspberry Pi 4. Make sure to choose 20.04 LTS and 64-bit version.

This option was pretty straightforward as far as installation goes. Canonical has step by step instructions starting from downloading the image and creating SD Card for Ubuntu Server 20.04 Focal Fossy. However, small issue for me was their image burning tool only works on latest version of Mac OS and so I had to use balenaEtcher open source tool to create the SD Card image but other than that it was fine.

One important thing to remember if you are installing it on Raspberry Pi 4 is to choose the image that is arm64. I learned this by watching Sid Faber videos. So this tip will save you some time.

The most challenging part was setting up wifi for my Ubuntu Server. And let me be clear, this was not because the instructions from Canonical were wrong or there was not enough information on the internet on this topic. The main issue was how my own router was configured.

To keep things simple and not run into any issues I would recommend that you just setup the Raspberry Pi using a static IP reserved for wifi MAC Address. The instructions and github repository here with two files the user.data file and network.conf file will get you up and running and connecting to the wifi and internet in no time. One of the interesting things I ran into when I had my router blocking the Raspberry Pi going to internet was that I was able to SSH into the Raspberry Pi from another computer on the same wifi network but since router was blocking it from going out to internet I was not able to install or update any software until I resolved all those issues on my router.

This is where some of the Ubuntu desktop software was useful although it was not necessary in retrospective.

Here are the steps to install the Ubuntu desktop on Ubuntu server:

sudo apt-get update
sudo apt-get install ubuntu-desktop

If you want to disable/enable Ubuntu desktop in future you can use these commands but here is a great article that helped me.

# to disable desktopsudo systemctl set-default multi-usersudo reboot

And to enable it back again:

# to enable desktopsudo systemctl set-default graphical# start gui manually from command linesudo systemctl start gdm3

After running Raspberry Pi 4 with Ubuntu Desktop for a few days, I was running into Raspberry Pi shutting down after certain time period. I tried to research on internet and applied the Power settings in the desktop but the issue never got fixed. Finally, I disabled the desktop GUI using the commands above and the Raspberry Pi is staying up without any interruptions for long periods of time. Otherwise, it was getting very annoying to restart and start punching in all the commands to get back to square on before making any progress in developing code.

Ubuntu Desktop

Follow these instructions to install Ubuntu Desktop on your Raspberry Pi 4.

I’m not going to go into too many details on this because it is pretty much similar to server plus desktop. You can pretty much use GUI to configure your wifi and other things and you will also be able to SSH into it just like it was a server. However, the amount of processing power and RAM used will be a lot more for desktop as it is running all the heavy GUI elements. Based on the experience described in the server option where I had to disable the GUI to make it run reliably, I would not go for this option. At least for the 4 Gb version I have I would not. I don’t know how it will run on 8 Gb RPi4 though YMMV.

Summary

  • Ubuntu Core — you will run into issues related to compatibility for ROS2 Foxy as the snap classic installed on it is Xenial version
  • Ubuntu Server — best option for running ROS2 Foxy Fitzroy
  • Ubuntu Desktop — may be if you have more RAM

--

--