登录、令牌和认领错误
解决认领问题(genkey、二维码、Claim Device)、"Login failed: …" 消息和令牌错误。
genkey 输出 "Device claimed"(或 login 输出 "Login successful"),且重启服务后设备显示为 Online。
开始之前
- Linux 和 macOS 上使用 sudo,OpenWrt 上使用 root shell。
- 设备时钟准确(误差在 30 秒以内)。
认领的工作原理
- 1运行 sudo wantasticd genkey。它会打印 Claim URL 和二维码,然后等待。
- 2打开 Claim URL 或扫描二维码,登录后点击 Claim Device。
- 3终端输出 "Device claimed"。按 Ctrl+C 并重启服务。
- 在 Linux 和 macOS 上始终使用 sudo。没有 sudo 时,配置会保存到服务无法读取的位置。
- 设备时钟必须准确。认领请求带有签名,服务器只接受 ±30 秒的误差。
- 在你点击 Claim Device 之前,出现 "Claim not ready yet" 是正常的。
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd检查要点
- 1Claim Device 失败,或终端显示 401 时间戳错误:校正时钟,然后再次点击 Claim Device。
- 2已认领但仍为 Offline:使用 sudo 重新运行 genkey,然后重启服务。
- 3令牌被拒绝:跳过令牌,使用 genkey 认领(Windows:创建新的密钥)。
- 4设备数量上限:删除不用的设备或升级套餐。
$ date -uThu Jan 1 00:03:12 UTC 19701Claim polling not ready: claim config rejected (401): invalid signature or timestamp out of window
- 1时钟错误
$ sudo timedatectl set-ntp true1$ sudo wantasticd genkeyReused existing device claim key: /etc/wantastic/device-claim-key.jsonWaiting for claim. Press Ctrl+C to stop.Device claimed. Configuration saved to /etc/wantastic/config.conf2
- 1修正时钟
- 2按 Ctrl+C,然后重启
- 1公钥已填写
- 2保持显示的服务器不变
- 3点击 Claim Device
速查表
| 错误 | 最简单的修复方法 |
|---|---|
| claim config rejected (401): invalid signature or timestamp out of window | 校正时钟,再次点击 Claim Device。 |
| 已认领,但服务仍为 Offline | 使用 sudo 重新运行 genkey,然后重启。 |
| registration rejected (401): invalid or expired login token | 改用 genkey 认领,不使用令牌。 |
| account has reached its device limit — … | 删除一台设备或升级套餐。 |
| register endpoint returned 500 / 503 | 稍后重试。 |
| device code expired / authorization was denied by the user | 改用 genkey 认领。 |
| device code endpoint returned <code>: <body> | --portal-url 错误。 |
| x509: certificate … | 自托管:使用有效证书,或使用 --server。 |
| Failed to save configuration: write config file: … | 以 root 身份运行;释放空间。 |
| genkey failed: parse existing key file | genkey --force。 |
验证结果
错误与解决方法
打开 Claim URL 后,在控制台中点击 Claim Device 失败。Claim polling not ready: claim config rejected (401): invalid signature or timestamp out of windowwantasticd genkey / connect --wait-claim
设备时钟与实际时间相差超过 30 秒。
设置时钟,然后再次点击 Claim Device。无需生成新密钥。
- 1运行适用于你系统的时钟命令。
- 2确认 date -u 显示当前的 UTC 时间。
- 3在控制台中再次点击 Claim Device。
- 4出现 "Device claimed" 后,按 Ctrl+C 并重启服务。
sudo timedatectl set-ntp true # Linux with systemd
ntpd -q -p pool.ntp.org # OpenWrt and BusyBox
date -u终端显示 "Device claimed",但按 Ctrl+C 后设备仍为 Offline。wantasticd genkey(Linux 和 macOS)
genkey 未使用 sudo 运行,因此配置保存在你的主目录中,而服务不会读取该位置。
使用 sudo 重新运行 genkey,重新认领,然后重启服务。
- 1运行 sudo wantasticd genkey。
- 2打开新的 Claim URL 并点击 Claim Device。
- 3确认保存路径是 /etc/wantastic/config.conf,而不是主目录中的路径。
- 4按 Ctrl+C 并重启服务。
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd已认领且为 Online,但按 Ctrl+C 后又变为 Offline。wantasticd genkey
genkey 在前台运行了隧道。Ctrl+C 停止了它,而服务没有重启。
重启一次服务。
sudo systemctl restart wantasticd # Linux
sudo launchctl kickstart -k system/com.wantastic.wantasticd # macOS
/etc/init.d/wantasticd restart # OpenWrt令牌登录被拒绝。Login failed: registration rejected (401): invalid or expired login tokenwantasticd login / install.sh
令牌错误、已过期或已用完。
跳过令牌,使用 genkey 认领设备。在 Windows 上,在 Account → Secrets 中创建新的密钥。
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd已达到套餐的设备数量上限。Login failed: account has reached its device limit — upgrade your plan or remove an existing devicewantasticd login(控制台:"You have reached the maximum number of devices for your plan.")
你的套餐没有空余的设备名额。
在 Devices 中删除不用的设备或升级套餐,然后重新认领。
注册期间服务器出错。Login failed: register endpoint returned 500wantasticd login
临时性服务器错误。
几分钟后重试。如果问题持续,请发送邮件至 hello@wantastic.app,注明时间和设备名称。
服务暂时不可用。Login failed: register endpoint returned 503wantasticd login
核心服务正在重启(自托管:core 容器尚未就绪)。
一分钟后重试。自托管:检查 docker logs -f wantastic。
设备码超时。Login failed: device code expired — please start a new loginwantasticd login(设备码流程)
15 分钟内没有人批准该设备码。
改用 genkey 认领流程。
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd设备码已过期(其他提示文字)。device code expired — please try againwantasticd login / 激活页面
没有人及时批准该设备码。
改用 genkey 认领流程。
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd激活页面拒绝该设备码。This code is invalid or has expired.控制台 · /activate
设备码有拼写错误或已过期。"This code has already been used." 表示该设备码此前已被批准。
改用 genkey 认领流程。如果提示 "You must be signed in to authorize a device.",请先点击 Sign In。
登录被拒绝。Login failed: authorization was denied by the userwantasticd login
有人在激活页面上点击了 Deny。
使用 genkey 认领流程,并点击 Claim Device。
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd登录错误。Login failed: access denied: <desc>wantasticd login
登录服务器拒绝了请求。"token error '<e>': <desc>" 和 "token endpoint returned <code> with no error field" 属于同一情况。
使用 genkey 认领流程。如果是自托管控制台,请检查控制台 URL 和服务器健康状况。
控制台 URL 错误。Login failed: device code endpoint returned <code>: <body>wantasticd login
--portal-url 指向的不是 Wantastic 控制台。控制台启动期间可能显示 "Portal not ready (<code>): … retrying"。
移除 --portal-url 以使用默认值,或传入你自己的控制台 URL。
sudo wantasticd genkey --server-url https://<your-console-host>自托管证书错误。x509: certificate signed by unknown authoritywantasticd login(自托管)
自托管控制台使用了自签名证书或不完整的证书。
安装有效证书(在设置向导中使用 Let's Encrypt),或使用会跳过证书检查的 --server。
sudo wantasticd login --no-connect --server <your-console-host> --token <TOKEN>配置路径错误。Failed to prepare config path: parent <dir> is not a directorywantasticd login
配置目录所在位置存在一个同名文件。
移走旧文件,然后重新认领。
ls -l /etc/wantastic
sudo mv /etc/wantastic /etc/wantastic.old
sudo wantasticd genkey无法保存配置。Failed to save configuration: write config file: …wantasticd login
你不是 root,或文件系统为只读或已满。
使用 sudo 运行,必要时释放空间。
df -h /etc
sudo wantasticd genkey认领服务不可用。claim config unavailable (503)wantasticd genkey / connect --wait-claim
服务器暂时繁忙。
保持 genkey 运行,它每 10 秒重试一次。
WebSocket 回退提示。Claim websocket unavailable, falling back to signed pollingwantasticd 日志
代理或防火墙阻止了 WebSocket。轮询方式仍然可用。
无需操作。如果随后轮询返回 401 错误,请校正时钟。
等待认领。Claim not ready yetwantasticd 日志
这是正常现象,还没有人认领该设备。
打开 Claim URL 或扫描二维码,登录并点击 Claim Device。
已找到认领,配置尚未就绪。Claim found but config is not ready: …wantasticd 日志
服务器仍在准备设备配置。
等待 20 秒。如果问题持续,在 Devices 中删除该设备并重新认领。
genkey 无法读取旧密钥。genkey failed: parse existing key filewantasticd genkey
密钥文件已损坏。"existing key file missing private_key or public_key" 属于同一情况。
使用 --force 创建新密钥,然后通过新的 Claim URL 认领。
sudo wantasticd genkey --force找不到认领密钥文件。Failed to load claim key: read key file: …wantasticd connect --wait-claim
从未运行过 genkey,或 --claim-key 指向了错误的文件。
运行 genkey 并认领设备。
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd服务器地址错误。unsupported portal scheme for claim waitwantasticd genkey / connect
--server-url 不是以 https:// 开头。
传入完整的 https:// 地址。
sudo wantasticd genkey --server-url https://console.wantastic.app继续阅读
仍然无法解决?
请通过邮件发送设备名称、平台和完整的错误文本。切勿发送令牌、密钥或密码。