How to Run OpenClaw on a Raspberry Pi with Android OS
LineageOS 23.2 brought Android 16 to the Raspberry Pi 5 in May 2026, which means you can now run OpenClaw's Node.js gateway inside Termux on Pi hardware instead of using Raspberry Pi OS. The setup works, but it stacks two unofficial layers (community Android ROM plus community Termux path) on top of a $60 single-board computer.
Why Android on a Raspberry Pi for OpenClaw
Community-maintained mobile OpenClaw nodes grew from 12,500 in Q4 2025 to 45,200 by Q1 2026, a 261% increase driven largely by developers repurposing old Android phones as always-on agents. That growth exposed a gap: phones have batteries and cellular radios but limited cooling and expansion, while Raspberry Pis have GPIO, NVMe support, and passive cooling but no touchscreen or Android app ecosystem. Running Android on a Pi is an attempt to get both.
The idea is straightforward. Flash a community Android ROM (LineageOS) to your Pi, install Termux from F-Droid, set up Node.js inside Termux, and run the OpenClaw gateway. Your Pi becomes an Android device that can host the OpenClaw gateway and run Android-native automation tools at the same time.
Before you commit to this path, understand the support landscape. The official OpenClaw Raspberry Pi docs specify "64-bit Raspberry Pi OS (required)" as the only supported Pi OS. The official Android page describes Android as a companion node, not a gateway host. Running the gateway on Android via Termux is a community-supported path with known rough edges: hardcoded /tmp paths that conflict with Termux, os.homedir() returning /home instead of Termux's actual home directory, and mDNS broadcast failures on Android's network stack.
None of those are dealbreakers. The community has documented workarounds for each one. But you should go in knowing that this is a two-layer experiment (unofficial ROM plus unofficial runtime path) rather than a supported deployment.
What Hardware and Software You Need
The hardware floor is set by LineageOS and OpenClaw's combined demands, not either one alone.
Raspberry Pi Hardware - Raspberry Pi 5 (4 GB or 8 GB) or Raspberry Pi 4 (4 GB or 8 GB). The 8 GB models give you comfortable headroom once Android, Termux, Ubuntu proot, and OpenClaw are all resident
- 32 GB+ microSD card (Class 10 or better). The LineageOS image alone occupies 15.5 GB, and you need room for Termux, Node.js, and OpenClaw's conversation history
- NVMe SSD via HAT+ (recommended for Pi 5). SD cards have limited write endurance, and OpenClaw writes to memory files, logs, and conversation history constantly. An SSD is the single biggest performance improvement you can make
- Ethernet cable or USB Wi-Fi adapter. LineageOS supports the Pi's onboard Wi-Fi, but Ethernet is more reliable for an always-on agent
- USB-C power supply (5V 5A for Pi 5, 5V 3A for Pi 4)
Software Stack
- LineageOS 23.2 (Android 16) for Raspberry Pi. Built by KonstaKang, these are unofficial builds not supported by the LineageOS team. Available for Pi 4, Pi 5, Pi 500, and Compute Module 5
- Termux from F-Droid. The Google Play version is outdated and unmaintained. You need the F-Droid build
- proot-distro with Ubuntu (recommended) or native Termux with Node.js (leaner but requires more manual configuration)
- Node.js 22 or 24. OpenClaw requires Node 22.19+ minimum, with Node 24 recommended
- OpenClaw (latest release). The gateway, CLI, and onboarding wizard
What You Lose vs. Pi OS
LineageOS on Pi runs with SELinux in permissive mode and does not support userdata encryption. CSI camera modules have various issues. Commercial use is restricted by non-commercial licensing on certain binary components. If any of those matter for your use case, stick with Raspberry Pi OS.
How to Flash LineageOS and Prepare the Pi
Start by downloading the LineageOS 23.2 image for your Pi model from KonstaKang's build page. The Pi 4 and Pi 5 have separate images, so make sure you grab the right one.
Flash the Image
Open Raspberry Pi Imager, click "Choose OS," then select "Use custom" and point it to the downloaded LineageOS image file. Insert your microSD card (or NVMe SSD if you have an adapter), select it under "Storage," and click "Next" to begin writing.
First Boot
Insert the card into your Pi and power it on. LineageOS will walk you through initial Android setup: language, Wi-Fi, and Google account (optional). If you want Google apps, you will need to flash NikGapps separately, since OpenGapps is no longer maintained for current Android versions.
Expand Storage
The default partition does not use your full card. Open Settings, navigate to System, and use the built-in resize tool to expand the partition. On a 32 GB card, this gives you roughly 16 GB of usable space after the OS.
Enable Developer Options
Go to Settings, then About Phone, and tap the build number seven times. Back in Settings, open Developer Options and enable USB Debugging. This gives you ADB access from another machine, which is useful for troubleshooting Termux issues. You can also enable root access via ADB or install Magisk for persistent root.
Network Configuration
For an always-on agent, Ethernet is the right choice. Plug in a USB-to-Ethernet adapter (Pi 5's onboard Ethernet works natively with LineageOS) and verify connectivity. Set a static IP through Settings or your router's DHCP reservation so the agent's address does not change.
Persistent storage for your Raspberry Pi agent's output
Your OpenClaw agent generates files that outlive any single session. Fastio gives it 50 GB of indexed, searchable workspace storage with MCP access, no credit card, no expiration.
How to Install OpenClaw via Termux
This is where the Android path diverges most from the standard Pi OS installation. On Pi OS, you SSH in and run the installer directly. On Android, you work through Termux, which provides a Linux-like environment without root.
Install Termux
Open the F-Droid app (install it first if needed), search for Termux, and install it. Launch Termux and run the initial update:
pkg update && pkg upgrade -y
Choose Your Runtime Path
You have two options. The proot path is more compatible but slower. The native path is leaner but requires manual fixes.
Option A: Ubuntu via proot (recommended for first-time setup)
pkg install proot-distro -y
proot-distro install ubuntu
proot-distro login ubuntu
apt update && apt upgrade -y
apt install curl git build-essential -y
Then install Node.js inside the Ubuntu environment:
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs
Option B: Native Termux
pkg install nodejs-lts git -y
This is faster but you may hit issues with packages that expect standard Linux paths.
Install OpenClaw
Inside your chosen environment:
npm install -g openclaw@latest
openclaw --version
Fix the Network Interface Issue
Android's network stack confuses Node.js. Create a file at /root/hijack.js (proot path) or $HOME/hijack.js (native) that overrides the network interface lookup, then add it to your shell profile:
export NODE_OPTIONS="-r $HOME/hijack.js"
The exact contents of this file vary by community guide. The core fix forces Node.js to bind to 127.0.0.1 instead of trying to enumerate Android's virtual network interfaces.
Run Onboarding
openclaw onboard
Select 127.0.0.1 when asked for the gateway bind address. Choose your model provider (Anthropic, OpenAI, or Google) and enter your API key. The Pi does not run models locally. It sends prompts to cloud APIs and orchestrates the responses.
Start the Gateway
openclaw gateway --verbose
Access the dashboard at http://127.0.0.1:18789 from a browser on the same device, or forward the port over SSH or Tailscale for remote access.
How to Keep the Agent Running Past Android Battery Traps
Android is designed to aggressively manage battery by killing background processes, throttling CPUs under heat, and suspending Wi-Fi when the screen is off. Every one of these behaviors will break your OpenClaw agent. This section is where most people's setups fail.
Termux Wake Lock
Run termux-wake-lock before starting the gateway. This acquires an Android wake lock that prevents the CPU from entering deep sleep. Without it, your agent will freeze within minutes of the screen turning off.
Battery Optimization Open Android Settings, go to Apps, find Termux, select Battery, and choose "Unrestricted" (or "Don't optimize" depending on your LineageOS build). This stops Android from killing Termux's process when it thinks the app is idle.
Keep the Pi Plugged In This sounds obvious for a Raspberry Pi (they do not have batteries), but it matters because Android's power management still behaves as if it is running on a phone. Some LineageOS builds will trigger battery-saver mode based on software states, not actual hardware. Disabling all power-saving modes in Settings prevents unexpected throttling.
Wi-Fi Keep-Alive
If you are using Wi-Fi instead of Ethernet, Android will drop the Wi-Fi connection during sleep unless you explicitly tell it not to. In Developer Options, look for "Keep Wi-Fi on during sleep" and set it to "Always."
Auto-Restart on Boot
If the Pi loses power and restarts, LineageOS will boot into Android but will not automatically launch Termux or start the OpenClaw gateway. You need Tasker or a similar Android automation app to launch Termux on boot and run a startup script. This is another layer of complexity that Pi OS avoids entirely, since you can just add a systemd service.
Monitoring
The OpenClaw dashboard at port 18789 shows gateway health, connected channels, and recent conversations. For remote monitoring, Tailscale gives you a persistent, encrypted connection to your Pi without port forwarding.
Pi OS vs Android OS for OpenClaw Agents
The honest comparison matters more than the setup instructions. Here is how the two paths stack up.
Raspberry Pi OS Lite (64-bit) is the officially supported path. The OpenClaw install script targets it explicitly. systemd manages the gateway process, so it starts on boot, restarts on crash, and logs to journalctl. Idle RAM consumption is around 177 MiB, leaving maximum headroom for the gateway. NVMe, GPIO, CSI cameras, and every Pi HAT work without driver hunting. SSH gives you remote access immediately.
LineageOS (Android 16) gives you the Android app ecosystem. If your agent needs to interact with Android apps, read notifications, use the camera through Android APIs, or use phone-specific automation tools like Tasker, that is the reason to choose this path. You also get the Android OpenClaw companion app, which provides a native chat interface, voice input, and camera integration directly on the device.
Where Android wins: touchscreen interface for local interaction, Android app automation, native OpenClaw companion app with voice and camera, Google Play ecosystem for additional tools.
Where Pi OS wins: official support and tested install path, lower RAM overhead (177 MiB vs. 400+ MiB for Android idle), systemd process management, simpler auto-restart on power loss, full hardware compatibility including cameras and HATs, no battery management workarounds needed.
Where both are equal: cloud API inference speed (the Pi is an orchestrator, not an inference engine), channel integrations (WhatsApp, Telegram, Discord, Slack), network throughput for file transfers.
For most people building an always-on OpenClaw agent, Raspberry Pi OS is the better choice. Android on Pi makes sense in a narrower set of scenarios: when you specifically need Android app integration, when you want a touchscreen-driven local interface, or when you are already deep in the Android automation ecosystem and want to reuse those skills.
Where Fastio Fits Either Path
Whether your OpenClaw gateway runs on Pi OS or Android, it generates files that need to live somewhere persistent: conversation logs, tool outputs, downloaded attachments, generated reports. Local storage on an SD card is fragile and not accessible from other devices.
Fastio provides the persistent workspace layer. Your agent writes files to a Fastio workspace through the MCP server, and those files are immediately available to your team through the web interface, mobile apps, or API. Intelligence Mode auto-indexes everything for semantic search and RAG chat, so you can ask questions about your agent's output without digging through folders.
The free plan includes 50 GB of storage, included credits, and 5 workspaces with no credit card required. For an OpenClaw agent generating a few hundred files a month, that is more than enough to start. When you need to hand off a workspace to a client or colleague, ownership transfer moves the whole workspace without losing history or permissions.
Frequently Asked Questions
Can OpenClaw run on Android?
Yes, but through a community-supported path. The official OpenClaw Android app is a companion node that connects to a gateway running elsewhere. To host the gateway itself on Android, you install Termux from F-Droid, set up Node.js (either natively or through a proot Ubuntu environment), and run the OpenClaw gateway process. This works on both Android phones and on Raspberry Pis running LineageOS. The OpenClaw team does not officially support this configuration, but the community has documented workarounds for the known issues with paths, home directory resolution, and mDNS.
How do I install Android on a Raspberry Pi?
Download the LineageOS 23.2 (Android 16) image for your specific Pi model from KonstaKang's build page. Use Raspberry Pi Imager to flash the image to a microSD card by selecting "Use custom" under the OS menu. Insert the card, power on the Pi, and complete the Android setup wizard. The builds support Pi 4, Pi 5, Pi 500, and Compute Module 5, and require at least 2 GB of RAM. These are unofficial community builds not supported by the LineageOS team, so expect some rough edges.
Is Android or Raspberry Pi OS better for AI agents?
Raspberry Pi OS Lite (64-bit) is better for most AI agent deployments. It idles at roughly 177 MiB of RAM versus 400+ MiB for Android, supports systemd for automatic process management, and is the only OS officially supported by OpenClaw on Pi hardware. Android makes sense if you need touchscreen interaction, Android app automation, or the native OpenClaw companion app with voice and camera features. For headless, always-on agents that run 24/7, Pi OS avoids the battery management workarounds and boot automation complexity that Android requires.
What Raspberry Pi model is best for OpenClaw with Android?
The Raspberry Pi 5 with 8 GB of RAM is the best choice. LineageOS plus Termux plus the proot Ubuntu environment plus OpenClaw can easily consume 2 to 3 GB of RAM before your agent does any real work. The 4 GB Pi 5 works but leaves little headroom. The Pi 4 with 8 GB is also viable but has a slower CPU and no NVMe support without a separate adapter. An NVMe SSD is strongly recommended regardless of model, since OpenClaw writes frequently and SD cards degrade under sustained write loads.
Does OpenClaw on Android need an internet connection?
Yes, for practical use. The Pi does not run large language models locally. OpenClaw acts as a gateway that routes prompts to cloud APIs like Anthropic Claude, OpenAI GPT, or Google Gemini, then orchestrates the responses. Without internet, the gateway starts but cannot complete any inference. For offline-capable setups, the official Pi OS path supports connecting to locally hosted models via Ollama, llama.cpp, or LocalAI, though performance on Pi hardware is limited.
How do I keep OpenClaw running after the screen turns off?
Run termux-wake-lock in Termux before starting the gateway to prevent CPU sleep. Then open Android Settings, go to Apps, find Termux, and set its battery optimization to Unrestricted. For Wi-Fi setups, enable "Keep Wi-Fi on during sleep" in Developer Options. To survive reboots, install Tasker or a similar automation app to launch Termux and run a startup script on boot. On Pi OS, you would instead create a systemd service that handles all of this automatically.
Related Resources
Persistent storage for your Raspberry Pi agent's output
Your OpenClaw agent generates files that outlive any single session. Fastio gives it 50 GB of indexed, searchable workspace storage with MCP access, no credit card, no expiration.