Running OpenClaw on Raspberry Pi: Complete Guide + Fixing Silent Drops
Raspberry Pi is perfect for OpenClaw: cheap, quiet, low power, always on. Many people run their AI assistant on a $35 computer that costs $1/month in electricity.
But there’s a catch. And I’m going to tell you about it upfront so you don’t waste hours debugging.
The Silent Drop Problem
The most common issue with OpenClaw on Raspberry Pi is silent connection drops. The gateway appears running, health checks pass, but Slack/Discord/Telegram messages stop being processed.
This happens because:
- Pi’s WiFi can be flaky
- WebSocket connections die silently
- Default health checks don’t catch it
I’ll show you how to fix this later in the guide.
Hardware Requirements
Minimum (Will Work)
- Raspberry Pi 4 (2GB RAM)
- 16GB microSD card
- Power supply
- Internet connection (Ethernet recommended)
Recommended (Will Work Well)
- Raspberry Pi 4 or 5 (4GB+ RAM)
- 32GB+ microSD card (or SSD via USB)
- Ethernet connection (not WiFi)
- Official power supply
Why Ethernet Over WiFi?
WiFi on Pi is notoriously unreliable for always-on services. You’ll get:
- Random disconnects
- Higher latency
- More silent drops
If you must use WiFi, expect to deal with more connection issues.
Initial Setup
Step 1: Install Raspberry Pi OS
Use Raspberry Pi Imager:
- Download from raspberrypi.com
- Choose “Raspberry Pi OS Lite (64-bit)” - no desktop needed
- Click the gear icon to:
- Enable SSH
- Set username/password
- Configure WiFi (if needed)
- Flash to SD card
Step 2: First Boot and SSH
- Insert SD card, connect Ethernet, power on
- Find Pi’s IP address (check your router)
- SSH in:
ssh pi@YOUR_PI_IP
Step 3: Update Everything
sudo apt update && sudo apt upgrade -y
Step 4: Install Node.js
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
Verify:
node --version # Should show v22.x
Step 5: Install OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
exec bash # Reload shell
Step 6: Run Onboarding
openclaw onboard --install-daemon
Follow the prompts to:
- Set up your AI provider (Anthropic/OpenAI)
- Connect messaging channels
- Configure basic settings
Optimizing for Raspberry Pi
Use a Lighter Model
Raspberry Pi doesn’t run the AI locally (that happens in the cloud), but parsing large responses uses CPU/memory.
For smoother operation:
- Default to Claude Haiku or GPT-4o mini
- Use heavier models (Sonnet/Opus) only when needed
Reduce Memory Usage
Edit your config to limit memory:
gateway:
maxMemoryMB: 512 # Limit memory usage
Use an SSD
SD cards are slow and can corrupt. For reliability:
- Get a USB SSD ($20-30)
- Boot from SSD instead of SD card
- Much faster, more reliable
Fixing Silent Connection Drops
Now for the main event: fixing the silent drop problem.
The Problem Explained
OpenClaw’s WebSocket connections (to Slack, Discord, etc.) can fail without crashing the process. The built-in health check only verifies HTTP API tokens, not actual WebSocket state.
Result: openclaw gateway status shows “ok” but messages aren’t being processed.
The Solution: Log-Based Watchdog
Create a script that monitors logs and restarts when it detects a silent drop.
Create the watchdog script:
sudo nano /usr/local/bin/openclaw-watchdog.sh
#!/bin/bash
# OpenClaw Silent Drop Watchdog
# Monitors logs and restarts gateway if connection appears dead
LOG_WINDOW_MINUTES=5
RESTART_IF_ALL_TRUE=true
# Get recent logs
recent_logs=$(journalctl -u openclaw --since "${LOG_WINDOW_MINUTES} minutes ago" 2>/dev/null)
# Check conditions
has_pong_timeout=$(echo "$recent_logs" | grep -c "pong timeout" || echo "0")
has_reconnect_success=$(echo "$recent_logs" | grep -c "socket mode connected" || echo "0")
has_message_activity=$(echo "$recent_logs" | grep -c "processing message" || echo "0")
# If we see timeout warnings but no reconnects and no activity, restart
if [[ "$has_pong_timeout" -gt "0" && "$has_reconnect_success" -eq "0" && "$has_message_activity" -eq "0" ]]; then
echo "$(date): Silent drop detected. Restarting gateway..."
systemctl restart openclaw
echo "$(date): Gateway restarted."
else
echo "$(date): Gateway healthy."
fi
Make it executable:
sudo chmod +x /usr/local/bin/openclaw-watchdog.sh
Create a systemd timer to run it every 3 minutes:
sudo nano /etc/systemd/system/openclaw-watchdog.timer
[Unit]
Description=OpenClaw Watchdog Timer
[Timer]
OnBootSec=5min
OnUnitActiveSec=3min
[Install]
WantedBy=timers.target
sudo nano /etc/systemd/system/openclaw-watchdog.service
[Unit]
Description=OpenClaw Watchdog Service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/openclaw-watchdog.sh
Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable openclaw-watchdog.timer
sudo systemctl start openclaw-watchdog.timer
Verify It’s Working
Check timer status:
systemctl status openclaw-watchdog.timer
Watch it in action:
journalctl -u openclaw-watchdog -f
Additional Reliability Tips
Auto-Start on Boot
If you used --install-daemon during onboard, this is already set up. Verify:
systemctl is-enabled openclaw
Keep System Updated
# Add to crontab
sudo crontab -e
# Add this line for weekly updates
0 3 * * 0 apt update && apt upgrade -y && reboot
Monitor Temperature
Pi can throttle if it overheats:
# Check current temp
vcgencmd measure_temp
# Add monitoring
cat >> ~/.bashrc << 'EOF'
alias pitemp='vcgencmd measure_temp'
EOF
Consider a heatsink or fan case if running 24/7.
Set Up Alerts
Get notified when something goes wrong:
# In OpenClaw config - send alerts to Telegram
monitoring:
alerts:
telegram:
enabled: true
chatId: YOUR_CHAT_ID
Cost Breakdown
Hardware (One-Time)
- Raspberry Pi 4 (4GB): $55
- Power supply: $15
- SD Card (32GB): $10
- Case with fan: $15
- Total: ~$95
Running Costs (Monthly)
- Electricity: ~$1
- API costs: $5-50 (depending on usage)
- Total: $6-51/month
Compare to VPS: $6-20/month + no hardware ownership.
Pi pays for itself in 6-12 months vs VPS.
When NOT to Use Raspberry Pi
Consider a VPS instead if:
- You don’t want to manage hardware
- You need high availability (Pi in your house = affected by your internet)
- You’re not comfortable with Linux troubleshooting
- You need more compute power
Getting Help
Stuck? Options:
- OpenClaw Discord: Active community
- r/raspberry_pi: Hardware issues
- SetupMyClaw: We can help configure Pi setups
Questions about Pi setup? Email us.
Need Help Setting Up OpenClaw?
Skip the guides and get expert help. We'll set everything up for you in a 60-minute Zoom call.
Book a Setup Session - From $49