# Squeezing Every Megabyte: Optimizing an 8GB NVIDIA Jetson Orin Nano for Headless ROS 2 and Edge-AI

> Source: <https://dev.to/shaifurcodes/squeezing-every-megabyte-optimizing-an-8gb-nvidia-jetson-orin-nano-for-headless-ros-2-and-edge-ai-3cch>
> Published: 2026-07-14 00:52:26+00:00

When building an autonomous robot, compute efficiency is everything. If you are running on an **NVIDIA Jetson Orin Nano (8GB)**, you are dealing with **Unified Memory (UMA)**—meaning your CPU and GPU share the exact same physical RAM pool.

Out of the box, JetPack 7.2 running Ubuntu 24.04 LTS boots a full GNOME graphical desktop that devours **1.5 GB to 2.0 GB of RAM** just idling. If you are loading an Edge-AI model (like Gemma 2B), running dual IMX219 CSI cameras, processing 2D LiDAR data, and running a ROS 2 navigation stack, that desktop environment is a luxury you cannot afford.

In this guide, we will walk through a complete, step-by-step engineering log to:

When working on a mobile robot, you rarely want an HDMI monitor dangling off your vehicle. Connecting to your Jetson headlessly over a direct Ethernet link or the USB-C device port is the gold standard.

Ubuntu uses the Avahi mDNS stack. Instead of searching for IP leases in your router's client list, you can connect directly using your Jetson's hostname:

```
ssh username@your-jetson-hostname.local
```

*Tip: If you are connecting via a direct Ethernet cable between your laptop and the Jetson, ensure your laptop's Ethernet interface is set to "Link-Local Only" or "Share to other computers" to auto-assign compatible IP addresses.*

Let's look at the actual optimization path. Our starting point on a fresh, graphical JetPack 7.2 installation was **913 MiB** of active RAM usage (with no monitor attached, using SSH). We want to bring this down as low as possible.

The single biggest RAM culprit is the graphical environment. Since our robot is autonomous and headless, we can safely instruct systemd to boot directly to a text-only target.

```
# Set the default system target to multi-user (headless)
sudo systemctl set-default multi-user.target

# Instantly terminate the active desktop manager session
sudo systemctl isolate multi-user.target
```

*Result: Idle memory drops instantly from **913 MiB** to **699 MiB**, saving over **200 MiB**.*

Even in headless mode, standard desktop Ubuntu environments run helper programs, network daemons, and background profiling tools that are completely useless on an embedded robot.

Let's list running services:

```
systemctl list-units --type=service --state=running
```

Based on this analysis, we can safely disable several heavy-hitting daemons.

`lttng-sessiond.service`

`iperf3.service`

`smbd.service`

& `nmbd.service`

`kerneloops.service`

`bluetooth.service`

Disable them all in one command:

```
sudo systemctl disable --now lttng-sessiond.service iperf3.service smbd.service nmbd.service kerneloops.service bluetooth.service
```

`nvargus-daemon.service`

`nvfancontrol.service`

`jtop.service`

`jetson-stats`

—virtually zero footprint, but indispensable for system profiling.Because the Jetson uses flash storage (like an NVMe SSD), aggressive swapping can wear down your drive and introduce latency. By default, Linux has a high "swappiness" value (`60`

), meaning it starts swapping idle memory pages early.

We want to lower this value to `10`

, telling the kernel to swap only as an absolute last resort:

```
# Temporarily set swappiness to 10
sudo sysctl vm.swappiness=10

# Make it permanent
echo "vm.swappiness=10" | sudo tee -a /etc/etc/sysctl.conf
```

Additionally, you can manually drop inactive system file caches to clear up immediate memory blocks right before loading high-impact AI pipelines:

```
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
```

With our OS footprint optimized, we now have a perfect foundation for **ROS 2 Jazzy Jalisco** (the Tier-1 supported LTS release for Ubuntu 24.04).

Since we are running a headless robot, we will opt for the `ros-base`

package installation. This avoids bringing back any desktop GUI tools (like RViz or rqt) which would pull in hundreds of megabytes of heavy X11/Qt visual dependencies.

```
# 1. Ensure locales are configured for UTF-8
sudo apt update && sudo apt install locales -y
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

# 2. Enable the Ubuntu Universe repository
sudo apt install software-properties-common -y
sudo add-apt-repository universe -y

# 3. Add the ROS 2 GPG key
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

# 4. Add the repository to your sources list
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt install ros-jazzy-ros-base ros-dev-tools -y
```

To make the ROS 2 tools available automatically every time you log in via SSH:

```
echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc
source ~/.bashrc
```

Verify your installation:

```
ros2 --help
```

With all of these steps completed, let's look at our final memory profile:

``` bash
mdshaifur@shaifur-orin-nano:~$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.4Gi       607Mi       6.2Gi        12Mi       817Mi       6.8Gi
Swap:           15Gi          0B        15Gi
```

By transitioning to headless mode and optimizing background services, our baseline memory plummeted to an astonishing **607 MiB**!

This leaves you with **6.8 GiB of fully available, ultra-fast unified memory**. You are now in the perfect position to safely run:

`llama.cpp`

using ~1.5–2 GB of VRAM on the Jetson's GPU.Optimizing your hardware limits isn't just about resource conservation—it is what makes robust, low-latency, and reliable edge robotics possible!

*Have you optimized your Jetson platform for edge-AI or robotics? Let me know your favorite tricks in the comments below!*
