← Back to Plugins
Channels

Raspberry Pi Optimization

Danieldlr13 By Danieldlr13 👁 7 views ▲ 0 votes

Unofficial: start OpenClaw on a Raspberry Pi 4 (4 GB) in ~77 s instead of ~8.6 min by bundling four plugins. Unmaintained.

GitHub

README

# OpenClaw optimization for Raspberry Pi 4 (4 GB)

> **Unofficial.** Not affiliated with or endorsed by the OpenClaw project or the OpenClaw Foundation.
> Provided as is, with no warranty and **no ongoing maintenance**. Read [Limitations](docs/LIMITATIONS.md) first.

[Léelo en español](README.es.md)

On the author's Raspberry Pi 4 (4 GB, SD card), the [OpenClaw](https://github.com/openclaw/openclaw) gateway took
**about 8.6 minutes** to have WhatsApp ready, and the process used about 2 GB of RAM. With this project the **same OpenClaw
release** (`2026.11.10`) had WhatsApp ready in **77 seconds** on the same Pi. The code of OpenClaw is not modified; the
change is in how four plugins are packaged.

| Measured on the author's Pi 4 (4 GB, SD) | Official package | With this project |
| --- | --- | --- |
| Plugin loading at startup | 279 s | 11 s |
| Gateway listening | 429 s | 60 s |
| WhatsApp ready | ~518 s | 77 s |
| Module preparation: whatsapp / amazon-bedrock / codex / duckduckgo | 185 / 263 / 60 / 57 s | < 0.01 s |

Memory is **not** a clean comparison and the gain is modest: see [Results](docs/RESULTS.md) before quoting any number.
This is one user on one Pi. Your mileage will vary.

**Verification status**

| What | Status |
| --- | --- |
| Build, install, start and rollback on ARM64 (transient, ordinary and user systemd units), with simulated credentials | automated in CI |
| WhatsApp working after the install | **tested by the author on his own Pi** (self-reported; not independently verified) |
| OpenAI model replies after the install (the author uses a ChatGPT/Codex login) | **tested by the author on his own Pi** (self-reported) |
| The Bedrock fallback after the install | **not confirmed** |

## Why it is slow, in three sentences
OpenClaw ships `whatsapp`, `amazon-bedrock`, `codex` and `duckduckgo` as separate npm packages instead of inside the main
package. At every start the gateway prepares each external plugin by capturing its code and dependencies (thousands of files),
which on a slow SD card took minutes. Packaging those four plugins *inside* the OpenClaw package, using OpenClaw's own
`--bundle-plugin` option, removes that work. Details and code references: [How it works](docs/HOW-IT-WORKS.md).

## What you get
- A GitHub Actions workflow that builds that package from an official OpenClaw release tag and tests it on ARM64.
- `scripts/install.sh`: installs it on your Pi **with a backup first**, and `scripts/rollback.sh` to go back.
- Optional memory settings (`MALLOC_ARENA_MAX=2`, `--max-semi-space-size=4`) that cut the startup memory peak.
- Measurement scripts so you can compare before and after on your own Pi.

**No binaries are published.** You build the package yourself in your own fork. Why: [Trust and security](docs/TRUST-AND-SECURITY.md).

## Before you start (requirements)

| You need | Why |
| --- | --- |
| A Raspberry Pi running **64-bit** Raspberry Pi OS (`uname -m` prints `aarch64`) | OpenClaw needs a 64-bit OS. Tested only on a Pi 4 with 4 GB |
| **Node.js 24.x** (what OpenClaw itself requires) and `npm` | check with `node --version` |
| A working **OpenClaw 2026.11.10** already installed and running | the installer swaps a package for the *same* version; it never upgrades or downgrades. Check with `openclaw --version` |
| A **GitHub account** | you build the package in your own fork with GitHub Actions (free on public forks) |
| Shell access to the Pi as **the user that owns the OpenClaw install**, with passwordless `sudo` if the gateway runs as a system service | the installer needs to write to the npm global folder and to `~/.openclaw`, and to stop/start the service |
| About **1.5 GB free disk** and a **maintenance window** | the assistant is offline while it installs; the first install can take a long time (npm downloads dependencies, the first start builds a cache) |
| To know **how your gateway runs** | see the table in step 4 |

Not sure whether it is safe for you? It makes a backup first, has a `--dry-run` that changes nothing, and `scripts/rollback.sh` restores
your config and credentials. Still, read [Limitations](docs/LIMITATIONS.md) and [Trust and security](docs/TRUST-AND-SECURITY.md) first.

## Setup

**1. Build the package (on your computer, in your GitHub account).**
Fork this repository, open the **Actions** tab, choose the **build** workflow and press *Run workflow* (keep the default tag
`v2026.11.10`). It takes roughly 15 minutes to build, plus the tests. When it is green, open the run and download the artifact
**`openclaw-lite-tgz`** (a zip with `openclaw-2026.11.10-lite-linux-arm64.tgz` and `SHA256SUMS`). You must be signed in to GitHub to download it.

**2. Get the package and the scripts onto the Pi.**
```bash
# On the Pi: get the scripts (use your fork's URL)
git clone https://github.com/<your-user>/<your-fork>.git openclaw-pi && cd openclaw-pi
# From your computer: copy the two files from the artifact to the Pi, for example
#   scp openclaw-2026.11.10-lite-linux-arm64.tgz SHA256SUMS <pi-user>@<pi-address>:~/openclaw-pi/
sha256sum -c SHA256SUMS          # must print: ...lite-linux-arm64.tgz: OK
```

**3. Read before you run.** Open `scripts/install.sh` and `scripts/rollback.sh` and read them. They run with your privileges, and the
gateway they touch holds your messaging session and model keys.

**4. Rehearse (changes nothing).** Make `openclaw`, `node` and `npm` available in your `PATH`, then pick the line that matches how your
gateway runs:

| Your gateway runs as | Rehearsal command |
| --- | --- |
| the standard user service (`openclaw gateway install`) | `bash scripts/install.sh openclaw-2026.11.10-lite-linux-arm64.tgz --dry-run` |
| another systemd unit named `NAME` | `bash scripts/install.sh <package.tgz> --service NAME --system --dry-run` (or `--user`) |
| a unit created by your own launcher with `systemd-run` ("transient") | `bash scripts/install.sh <package.tgz> --service NAME --system --start-cmd 'YOUR START COMMAND' --dry-run` |
| something else | stop it yourself and use `--no-service` (then start it yourself) |

It must end with `DRY RUN FINISHED: nothing was changed`. An `ERROR` means it refused before touching anything: fix what it names.

**5. Install.** Run the same command **without** `--dry-run`. It backs up your config, credentials and state under
`~/pi-lite-backups/<timestamp>/`, stops the gateway, installs the package, runs `openclaw doctor --fix`, patches the config, writes a systemd
drop-in, starts the gateway and waits for it to answer. **Write down the backup path it prints.**

**6. Check that it worked.**
```bash
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:18789/startupz     # 200
bash scripts/measure/startup-report.sh <your-unit> [--user]                  # timings and memory
```
In the report, `plugins.runtime-post-bind` should be seconds, not hundreds of seconds, and the `modulePreparationMs` of whatsapp, amazon-bedrock,
codex and duckduckgo should be close to 0. **If it is still slow, the idea did not work on your system: roll back.**
Then send a real WhatsApp message and a prompt that uses your model provider. CI cannot test this (it has no real accounts). WhatsApp and
OpenAI worked on the author's Pi, but check them with **your** accounts.

**7. Go back, if you need to.**
```bash
bash scripts/rollback.sh ~/pi-lite-backups/<timestamp>        # add --start-cmd '...' if your unit is transient
```
It reinstalls the official package, restores your config and credentials and removes the drop-in. Startup will be slow again.

More detail: [docs/INSTALL.md](docs/INSTALL.md) (options and troubleshooting) and [docs/examples/transient-unit.md](docs/examples/transient-unit.md).
If you let a coding agent do the install, give it [docs/AGENT-INSTRUCTIONS.md](docs/AGENT-INSTRUCTIONS.md).

## License
[MIT](LICENSE). OpenClaw is MIT-licensed by the OpenClaw Foundation; packages built here include its license and notices. See [NOTICE](NOTICE.md).
channels

Comments

Sign in to leave a comment

Loading comments...