ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

Installing Ubuntu 18.04 arm64v8 on Raspberry Pi 3

bouncy
raspberrypi
ros2
arm

#1

Would anyone else like to see a arm64v8 image of Ubuntu 18.04 image for the Raspberry Pi 3 Model B? I gave a good stab at it Sunday afternoon, but got a little lost in the weeds given its been awhile since I made a 14.04 image for my old Raspberry Pi 1, and trying to catch up with the changes of things.

I have a majority of a one-line install image build script, but just can’t get over irregularities with ubuntu’s server install scripts and patching grub bootloader. My hacked together script thus far:

My goal was to make a Ubuntu image I could use to test the arm64 ROS2 Boncy binaries on, and do some profiling and testing on; as I didn’t feel like building or cross compiling ROS2 myself. But this has sort of turned into a deeper rabbit hole. Figured I’d share my stalled progress with the embedded folks here, or find out if anyone else already has a working image.

Other recent related discussions/wikis:

https://www.raspberrypi.org/forums/viewtopic.php?t=220079
https://lb.raspberrypi.org/forums/viewtopic.php?t=215438
https://wiki.ubuntu.com/ARM/RaspberryPi#Building_Raspberry_Pi_3_images


#2

I actually did spend some time getting ROS2 working on the Raspberry Pi 3b+ a few months ago. I took two different paths to get there:

  1. I recompiled all of ROS2 on the 32-bit Raspberry Pi distribution that is the default for Ubuntu 18.04. This worked fine, with the caveat that you have to build everything sequentially since some things take too much memory. I ended up using MAKEFLAGS="-j1 -l1" colcon build --executor sequential. The big downside to this approach is that the ROS2 CI doesn’t regularly build or test against 32-bit ARM, so things may not work exactly as expected.
  2. I switched the Ubuntu 18.04 distribution running on the Raspberry Pi 3b+ over to 64-bit, and then was able to install ARM64 packages. Unfortunately, this is a bit of a process (it took me about 2 hours to do). The basic steps are:
    1. Follow the instructions at https://wiki.ubuntu.com/ARM/RaspberryPi to install Ubuntu 18.04 32-bit on the Raspberry Pi 3b+ (this is a bit of a process on its own, but just follow through that guide)
    2. Once you have successfully booted the 32-bit distribution, we can start the steps to switch to 64-bit. The basic instructions for switching the processor mode and kernel over to 64-bit are also at https://wiki.ubuntu.com/ARM/RaspberryPi#Ubuntu_arm64.2FAArch64
    3. After rebooting, you’ll be running a 32-bit userland on a 64-bit kernel. To switch to a 64-bit userland, you need to manually install all of the :arm64 versions of the packages and removing the equivalent :armhf versions. I ended up starting with leaf packages and making my way towards core packages, but it may be easier to start the other way around. In any case, after dealing with some minor fallout from doing that, and rebooting, I had a full 64-bit kernel and userland that I was able to install ROS2 packages arm64 packages on.

Hope this helps a bit; let me know if you need additional information, since I elided my detailed notes here for brevity.


#3

Any reason to use ubuntu instead of debian ?

Otherwise there is a debian arm64 for raspberry pi 3 :


I do not test it for the latest pi 3b but there is a fork for it.

The installation of the OS is straight forward. Then we can install ros2 directly from the ros2 repo :

If it is on any helps…


#4

This https://1drv.ms/u/s!AvHY_kl4hMB4gQHfDAh2SYG_Q4Bt Xubuntu 18.04 installs and works pretty fine on Raspberry Pi 3 B+

Follow the instructions here: https://ubuntu-mate.community/t/aarch64-on-raspberry-pi-2-rev-1-2-3b-3b/16853
note: The installer is designed to be run from a flash usb drive and installed to another device (SD card, hard drive).

To make it lightweight, you will have to manually remove all the packages that you don’t need.


#5

I built a ROS 1 image for Turtlebot 3 on Gentoo that was 64 bit a while back, I’ll link here once I dig up the post.

I think @ruffsl was attempting to make an Ubuntu image, though, and was hoping for 64 bit.

I’ll say, however, that 64 bit arm is not necessarily a great thing on the raspberry pi… The main benefits: you get 16 more registers than 32 bit mode and you get better compiler optimizations (the pi 3 has vectorization, if you turn it on), but you only have the < 1 GB of RAM which makes doing most things in a 64 bit system quite difficult… I think this is one of the reasons the raspberry pi people don’t use 64 bit mode by default.

Don’t get me wrong: I use my raspberry pi 3 in 64 bit mode, have compiled ROS on Gentoo, and have been able to do a full GMapping demo with Turtlebot3. It’s not useless, and it’s not painfully slow. But doing any memory-intensive thing is awful.


#6

I have to concur. I don’t see the necessity for 64bit on the Pi3, the downsides outweigh any perceived benefits. FWIW there is also a semi-official Ubuntu Core 18 64bit Pi3 image but for the reasons @allenh1 and more have listed, we haven’t pursued an official release.