ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Recommended install for embedded raspberry pi 3 with minimal OS

asked 2018-05-28 05:19:12 -0600

9a3eedi gravatar image

updated 2018-05-28 05:27:02 -0600

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2018-05-28 07:54:56 -0600

VictorLamoine gravatar image

updated 2018-05-28 07:56:35 -0600

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/command... ).
  • 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)
edit flag offensive delete link more

Comments

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.

9a3eedi gravatar image 9a3eedi  ( 2018-05-29 00:27:14 -0600 )edit
1

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!

9a3eedi gravatar image 9a3eedi  ( 2018-05-31 04:01:53 -0600 )edit

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.

VictorLamoine gravatar image VictorLamoine  ( 2018-05-31 04:51:39 -0600 )edit

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

Mix_MicDev gravatar image Mix_MicDev  ( 2022-06-16 16:19:39 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2018-05-28 05:19:12 -0600

Seen: 1,165 times

Last updated: May 28 '18