所有文章
OpenClaw 原廠重設:如何完全重新開始

OpenClaw 原廠重設:如何完全重新開始

|2 分鐘閱讀

當故障排除都沒用,你需要一個乾淨的起點時,以下是在原生安裝和 Docker 容器上對 OpenClaw 進行原廠重設的方法。

何時需要原廠重設

在以下情況適合進行原廠重設:

  • openclaw doctor --fix 無法解決你的問題
  • Dashboard 可以載入但什麼功能都不能用
  • OpenClaw 對任何指令都沒有回應
  • 多次修復嘗試後仍然持續出現連線或 token 錯誤
  • 你想要用乾淨的設定重新開始

警告: 原廠重設會移除你的設定、已配對的裝置和記憶資料。你的 AI 供應商 API 金鑰和 Telegram bot token 需要重新輸入。

原生安裝重設

步驟 1:停止 OpenClaw

openclaw gateway stop

如果無效:

# 尋找並終止程序
pkill -f openclaw

步驟 2:備份重要資料(選擇性)

# 儲存目前的設定
cp ~/.openclaw/openclaw.json ~/openclaw-backup.json

# 如果想保留記憶資料也一併備份
cp -r ~/.openclaw/memory ~/openclaw-memory-backup

步驟 3:移除資料目錄

rm -rf ~/.openclaw

這會移除:

  • 設定(openclaw.json
  • 裝置配對
  • Gateway token
  • 記憶資料
  • 日誌

步驟 4:重新初始化

openclaw setup

這會引導你完成初始設定精靈:gateway 模式、AI 供應商和 API 金鑰。

步驟 5:重新設定

# 設定 gateway 模式
openclaw config set gateway.mode local

# 設定 AI 供應商
openclaw config set ai.apiKey "sk-ant-..."

# 重新連接 Telegram(如果有使用)
openclaw config set telegram.token "your-bot-token"

# 啟動
openclaw restart

步驟 6:重新配對裝置

打開瀏覽器或 Telegram bot,核准新的裝置配對:

openclaw devices list
openclaw devices approve DEVICE_ID

Docker 容器重設

選項 1:重建容器

# 停止並移除容器
docker stop YOUR_CONTAINER_ID
docker rm YOUR_CONTAINER_ID

# 移除資料 volume(這才是真正的重設)
docker volume rm openclaw-data

# 重新建立
docker run -d \
  --name openclaw \
  -v openclaw-data:/app/data \
  -p 3001:3001 \
  -e OPENCLAW_GATEWAY_TOKEN="new-stable-token" \
  -e ANTHROPIC_API_KEY="sk-ant-..." \
  openclaw-stack

選項 2:在容器內部重設

# 進入容器
docker exec -it YOUR_CONTAINER_ID bash

# 移除資料目錄
rm -rf /app/data/*

# 重新執行設定
openclaw setup

# 離開
exit

# 重啟容器
docker restart YOUR_CONTAINER_ID

選項 3:Docker Compose 重設

# 停止所有服務
docker-compose down

# 移除 volumes
docker-compose down -v

# 重建並啟動
docker-compose up -d

部分重設選項

你不一定需要完整的原廠重設。以下是針對性的重設方式:

僅重設設定

openclaw config reset
openclaw config set gateway.mode local
openclaw config set ai.apiKey "your-key"

僅重設裝置

# 移除所有已配對的裝置
openclaw devices list
openclaw devices remove --all

僅重設 Gateway Token

openclaw config unset gateway.token
openclaw doctor --generate-gateway-token
openclaw restart

僅清除記憶

rm -rf ~/.openclaw/memory
openclaw restart

重設之後

重設後的檢查清單:

  1. 確認 gateway 啟動: openclaw status 應顯示 gateway: running
  2. 檢查日誌: openclaw logs --tail 20 ——尋找 [gateway] listening on
  3. 執行 doctor: openclaw doctor ——所有檢查應該都通過
  4. 測試 Telegram: 傳送一則訊息給你的 bot
  5. 測試瀏覽器: 打開 dashboard URL

重設也無法解決時

如果原廠重設仍無法修復你的問題,問題可能不在 OpenClaw 本身:

  • 網路/防火牆 封鎖了 gateway 連接埠
  • Node.js 版本 太舊(需要 22+)
  • 磁碟已滿 ——沒有空間存放資料檔案
  • 作業系統層級的權限 問題

檢查方式:

node --version        # 需要 22+
df -h                 # 檢查磁碟空間
openclaw logs --tail 50  # 尋找作業系統層級的錯誤

跳過重設的循環

ClawTank 透過自動健康檢查和復原機制管理你的 OpenClaw 實例。如果出了問題,使用 dashboard 一鍵重建容器——不需要手動重設。

準備好部署 OpenClaw 了嗎?

不需要 Docker、SSH、DevOps。不到 1 分鐘即可部署。

免費開始使用