How to Resolve Ubuntu System Freezing When Building Ouster ROS2 Driver

How to Resolve Ubuntu System Freezing When Building Ouster ROS2 Driver

Problem Statement

Some users, particularly on laptops with 16 GB RAM running Ubuntu 22.04 with ROS 2 Humble, report that their system freezes when attempting to build the Ouster ROS2 driver using the following command:

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

Upon inspection, tools like htop show that CPU and RAM usage maxes out, causing a full system hang that requires a reboot. This issue is typically caused by memory exhaustion due to complex ROS2 dependencies like PCL (Point Cloud Library).


Who Is Affected


Root Cause

This is not a bug in the Ouster driver, but a result of resource exhaustion during the build process of dependencies like PCL. It can affect various ROS2 packages and is especially visible when building large packages without memory limits.


Recommended Workarounds

1. Limit Parallel Build Jobs

Try limiting workers to reduce RAM usage:

colcon build --parallel-workers 2 --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

2. Sequential Build Execution

colcon build --executor sequential --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

These methods reduce RAM load but may not always resolve the issue on low-memory machines.


Alternative Solutions

Option 1: Expand Virtual Memory (Swap)

If your system is using all physical RAM, add a swap file:

sudo dd if=/dev/zero of=/swapfile bs=1M count=10240 sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile
  • This creates a 10 GB swap file.

  • Slower than RAM, but prevents crashes.

Option 2: Build on a More Powerful Machine

Build the driver on another machine with 32 GB RAM or more, then copy the install/ folder to your target system.

Option 3: Use a Prebuilt Binary (Coming Soon)

(Near future but don't have exact date)