树莓派:专业设置与维护 - Openclaw Skills

作者:互联网

2026-03-25

AI教程

什么是 树莓派?

Openclaw Skills 库中的树莓派技能为部署和维护单板计算机提供专家级指导。它专注于消除常见的故障点,如欠压问题、SD 卡磨损和可能损害系统运行时间的网络配置错误。

该资源对于使用 Openclaw Skills 托管本地 AI 智能体或物联网网关的开发人员至关重要,提供了有关硬件保护、基于 ARM 的 Docker 部署和无头服务器管理的特定说明。通过遵守这些标准,用户可以构建专业级的自托管环境。

下载入口:https://github.com/openclaw/skills/tree/main/skills/ivangdavila/raspberry

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install raspberry

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 raspberry。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

树莓派 应用场景

  • 在 ARM 硬件上部署稳定的、无头的 AI 智能体和自动化脚本。
  • 使用 SSD 启动序列配置高可靠性服务器,以防止 SD 卡损坏。
  • 使用现代隧道协议为边缘设备设置安全的远程访问。
  • 为强大的信息亭或嵌入式应用实现只读文件系统。
树莓派 工作原理
  1. 为较新机型选择经过验证的 3A+ 电源,以防止因欠压导致的崩溃。
  2. 准备存储介质,优先考虑将 SSD 用于根文件系统,或使用高端 SD 卡进行引导。
  3. 通过 Raspberry Pi Imager 执行无头配置,预设主机名、用户和 WiFi 凭据。
  4. 使用优化的 Docker 安装和性能调整(如 ZRAM 交换)初始化环境。
  5. 使用诊断 LED 模式和系统图标监控硬件状态并排除故障。

树莓派 配置指南

对于初始无头设置,请使用 Raspberry Pi Imager 配置凭据。要在没有显示器的情况下启用 SSH,请在引导分区中放置一个名为 ssh 的空文件。对于 ARM 上的现代 Docker 安装,请使用以下命令:

curl -fsSL https://get.docker.com | sh

通过修改 /etc/dhcpcd.conf 而不是标准 Linux 网络接口来配置静态网络。

树莓派 数据架构与分类体系

该技能通过特定的配置文件和分区标志管理系统行为:

组件 路径 描述
硬件配置 /boot/config.txt 控制 GPU 内存、覆盖层和时钟速度
网络配置 /etc/dhcpcd.conf 静态 IP 和 DNS 设置的主要位置
启动标志 /boot/ssh 在初次启动时触发 SSH 守护程序
交换配置 zram-config 管理压缩的 RAM 交换以提高性能
name: Raspberry Pi
description: Set up and maintain Raspberry Pi avoiding common hardware and configuration pitfalls.
metadata: {"clawdbot":{"emoji":"??","os":["linux","darwin"]}}

Power Supply Issues

  • Lightning bolt icon = undervoltage — random crashes, corruption, weird behavior until fixed
  • Pi 4/5 needs 3A+ supply — older 2A adapters cause instability
  • USB peripherals draw from Pi's power budget — use powered hub for multiple devices
  • Official power supply recommended — cheap adapters often can't sustain required amperage

Storage Reliability

  • SD cards fail under heavy writes — databases and logs kill them within months
  • USB boot with SSD for reliability — SD for bootloader only, root on SSD
  • Quality SD cards matter — Samsung EVO, SanDisk Extreme; not generic cards
  • Read-only filesystem for kiosks — prevents corruption on power loss

GPIO Dangers

  • 3.3V logic only — 5V input permanently damages the Pi, no protection
  • Check operating voltage of sensors/modules — many Arduino accessories are 5V
  • Some GPIO used by default — I2C, SPI, UART pins need dtparam to free up
  • Hardware PWM only on GPIO 18 — software PWM on others is less precise

Network Setup Traps

  • WiFi country code required — won't connect without proper regulatory setting
  • Headless SSH: empty file named ssh in boot partition — not ssh.txt
  • Static IP via /etc/dhcpcd.conf — editing wrong file does nothing
  • Don't port forward SSH — use Tailscale, Cloudflare Tunnel, or WireGuard

Docker on Pi

  • ARM images only — linux/arm64 or linux/arm/v7, many images unavailable
  • 32-bit OS limits to 3GB RAM — use 64-bit for 4GB+ models
  • SD card unsuitable for Docker — volume writes accelerate card death
  • Install via curl -fsSL https://get.docker.com | sh — apt version is outdated

Headless Setup

  • Configure hostname, WiFi, user in Raspberry Pi Imager — before first boot
  • Username pi with default password deprecated — create custom user
  • First boot takes 2-3 minutes — filesystem resize, don't panic

Performance Tuning

  • gpu_mem=16 for headless — frees RAM when no display connected
  • ZRAM for swap on low-RAM models — better than SD swap
  • Disable Bluetooth and GUI if unused — saves resources

Troubleshooting Patterns

  • Red light only = power issue — no boot attempt, check supply
  • Green light blinking patterns = specific boot failures — check documentation
  • No HDMI output — connect before powering, Pi doesn't hot-plug HDMI
  • Kernel panic on boot = corrupted SD — reflash image
  • SSH refused — verify SSH enabled, check IP, check firewall