Rosanswers logo

I have a raspberry pi 3 compute module that I would like to use with a custom built robot prototype. As this will be a headless and embedded install, I have no use for a GUI and many of the services that are bundled with typical Linux distributions like Ubuntu, so I would like to install it on a minimal Linux distribution in order to reduce CPU and memory usage and boot time. However, I would also like it to be flexible and easy without a steep learning curve, in the interest of time, so a full embedded yocto-based solution isn't what I'm looking for, at least for now. I had initially planned to install ROS to go with raspbian lite (a minimal version of raspbian) however I noticed that ROS was mainly designed for Ubuntu, not raspbian or debian.

The instructions here recommend that I do not go for Raspbian and instead go for Ubuntu and then follow the armhf instructions. While I am willing to do this, I couldn't find a minimal variant of ubuntu suitable for the raspberry pi. The Raspbian option appeals to me because I am able to find a minimal Raspbian image that I can use with the raspberry pi. I also found Ubunutu Core, but I'm not sure if it's suitable or supported by ROS because of the way it emphasizes using snaps.

I'm looking for advice on the easiest and most hassle-free way I can do this. Does it make more sense to continue with minimal raspbian, or should I go with an Ubuntu distribution on Raspberry pi (such as Ubuntu MATE) and install ROS that way?

Originally posted by 9a3eedi on ROS Answers with karma: 63 on 2018-05-28

Post score: 0


1 Answer 1


Rosanswers logo

I highly recommend sticking with a platform / distribution that has ROS binaries available for the sake of maintainability.

I would go with Ubuntu Mate and removing everything you don't need. It's what I'm running on 2 RPis and it is both stable and easy to maintain.

One big drawback of Ubuntu Mate is that you need to connect the RPi to a screen / keyboard / mouse once to do some configuration (setting your user name etc., enabling SSH)

Things to do after installing Ubuntu Mate:

  • Enable and secure SSH server: not enabled by default on most recent distributions. Many people did not change the SSH password and this made a lot of RPis vulnerable, now it is disabled by default.
  • Disable X server (raspi-config is the easiest way to do this)
  • Enable extra functionalities if needed like SPI, I2C etc..(raspi-config again)
  • Remove packages that are not needed and take space (https://www.commandlinefu.com/commands/view/3842/list-your-largest-installed-packages-on-debianubuntu).
  • Control services at startup to boot faster (systemd-analyze blame is probably the best tool for this).
  • Use htop (or top) to debug what is taking RAM / CPU, there shouldn't be much to do after the install.
  • You are probably going to compile and the RPi has limited RAM; if you fill up the RAM you'll have to reboot the RPi by hardware, expect corrupted files; creating a swap file helps preventing such crashes:

Create a 500 Mb swap file, set appropriate rights on this file, configure it as swap, enable swap, show swap info

sudo fallocate -l 500M /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show

Create an entry in /etc/fstab so that the swap partition is automatically mounted at boot:

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

That way you have a clean, pretty minimal install and you will receive ROS updates whenever they are available. I think this solution is the best compromise if you are looking for:

  • Maintainability
  • Ease of use
  • 'Upgradability' (it should be easy to switch to Ubuntu 18.04 Mate)
  • Acceptable booting times (~ 1 minute on my side, what is acceptable highly depends on the application)
  • ROS updates (that is one very important point that will spare you a lot of time)

Originally posted by VictorLamoine with karma: 1505 on 2018-05-28

This answer was ACCEPTED on the original site

Post score: 5

Original comments

Comment by 9a3eedi on 2018-05-29:
Great answer, thanks! Although a 1 minute boot time might be a bit too much for me, but I'm willing to tolerate it if it means less headaches.

Comment by 9a3eedi on 2018-05-31:
Actually, after simply disabling the X server and splash screen, my boot time is approximately 15 seconds. This is great! Only a few seconds more than a Buildroot embedded build!

Comment by VictorLamoine on 2018-05-31:
I run a lot of stuff on my RPi (nginx server, Octoprint, MJPEG webcam streamer, transmission etc...) that is probably why I reach approximately 1 minute, thanks for the feedback.

Comment by Mix_MicDev on 2022-06-16:
How do you use raspi-config on ubuntu-MATE? Do you have to install it? Because when I want to enable I2C, and when I type raspi-config in the terminal I get an error like: raspi-config: command not found


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.