Filecoin常见问题处理

 1编译 lotus 失败: *** No rule to make target '.install-filcrypto'. Stop.

则直接删除 ./extern/ 目录,然后重新编译:
rm -rf ./extern/
FFI_BUILD_FROM_SOURCE=1 make clean debug

2 编译 lotus 失败:Get "https://proxy.golang.org/github.com/xxxxxx": net/http: TLS handshake timeout

则需要设置 GOPROXY 这个环境变量,然后重新编译:
export GOPROXY=https://goproxy.cn
FFI_BUILD_FROM_SOURCE=1 make debug  # 此时不需要执行 clean 操作

3 编译 lotus 失败:server response: not found: module github.com/filecoin-project/lotus/extern/storage-sealing/sealiface: no matching versions for query "latest"

则,更换代码版本吧,这个版本的代码有问题,目前出现这个问题的代码版本是:v1.4.2-rc1

4 运行 lotus 出现崩溃:SIGILL: illegal instruction

这个一般是老机器才会出现的问题,由于老机器不支持 adx 等指令导致的, 解决方法: 编译的时候加上参数 CGO_CFLAGS="-D__BLST_PORTABLE__"
FFI_BUILD_FROM_SOURCE=1 CGO_CFLAGS="-D__BLST_PORTABLE__" make clean debug

5 启动 daemon 失败:xxxxx: genesis in the repo is not the one expected by this version of Lotus!

如果启动 daemon 的时候出现如下所示的错误:xxxxx: genesis in the repo is not the one expected by this version of Lotus!: 则建议不要使用这个版本的代码,如果一定要使用,则可以在启动 daemon 之前设置一下环境变量:
export LOTUS_SKIP_GENESIS_CHECK=_yes_

6 daemon 同步失败:Received block with impossibly large height xxx

在测试本地测试网的时候,如果创世节点的代码编译的时候使用的是 Debug 模式,而其它节点的代码编译的时候使用 Release 模式,则在启动新节点的时候,运行完 lotus net connect xxxx 命令的时候,有可能在 daemon 的日志中看到这个错: ERROR chain chain/sync.go:236 Received block with impossibly large height 197,看到这个错误之后,新节点后续的操作都不会成功(比如同步节点信息,或者从创世节点发送一些 FIL 到新旷工的钱包等)。 解决的方法就是让新节点的代码也是用 Debug 模式编译。

7 启动创世节点失败:VM.Call failure: Allowance 4096 below MinVerifiedDealSize for add verifier f081 (RetCode=16)

这个错误信息,是因为启动创世节点的时候(搭建本地 2KiB 测试网),所使用的代码的编译模式没有使用 Debug 模式(大概率是因为使用了 Release 模式编译代码)导致的,如下所示:
# 错误信息
WARN	vm	vm/runtime.go:332	Abortf: Allowance 4096 below MinVerifiedDealSize for add verifier f081
WARN	vm	vm/runtime.go:145	VM.Call failure: Allowance 4096 below MinVerifiedDealSize for add verifier f081 (RetCode=16):
genesis func failed: make genesis block: 
failed to verify presealed data: 
failed to create verifier: 
doExec apply message failed: Allowance 4096 below MinVerifiedDealSize for add verifier f081 (RetCode=16)
解决方法是使用 Debug 模式重新编译一次代码,然后重新启动创世节点。

8 查看钱包列表出现 Warn:error in RPC call to 'Filecoin.WalletDefaultAddress': failed to get default key: xxx key info not found

这不是一个 Error,其实可以不用管它,消除这个 Warn 的方法也很简单,因为这个警告的意思是指:用户没有设置默认钱包,可能是因为用户在导入创世钱包的时候 ./lotus wallet import xxx 没有指定 --as-default 参数,或者是导入之后没有执行 ./lotus wallet set-default xxx 设置默认钱包(只要有默认钱包就不会报这个警告了)。 所以,消除这个警告的方法就是在导入钱包的时候加上 --as-default 参数,或者在导入钱包之后执行 ./lotus wallet set-default xxx 设置默认钱包即可。

9 查看Miner 信息:ERROR: could not get API info: could not get api endpoint: API not running (no endpoint)

如果是在执行 ./lotus-miner xxx 的时候看到这个错误,则说明你的 miner 还没有启动,或者是 miner 的默认目录不是 ~/.lotusminer/,而你执行名的这边(执行命令所在的终端)没有检测到你的 miner 所使用的目录。比如, miner 那边运行的时候设置了 export LOTUS_STORAGE_PATH=/lotusminer,而执行命令这边没有检测到 LOTUS_STORAGE_PATH 这个环境变量。 如果是在执行 ./lotus xxx 的时候看到这个错误,则原理和 miner 类似。

10 lotus 编译错误:/usr/bin/ld: cannot find -lhwloc

如果在编译过程中遇到这个错误,则说明你的系统中没有安装 hwloc 相关的库: 解决方法,安装 hwloc 相关的库,然后再重新编译 lotus
sudo apt get install hwloc libhwloc-dev

11 miner 的日志中显示 drand 错误:failed getting beacon entry:

错误信息(drand:distributed random):
ERROR   miner   miner/miner.go:208      
 failed getting beacon entry: drand failed Get request: no valid clients - doing request:
 Get "https://api3.drand.sh/public/643563": context deadline exceeded - doing request: 
 Get "https://api2.drand.sh/public/643563": context deadline exceeded - doing request: 
 Get "https://drand.cloudflare.com/public/643563": context deadline exceeded - doing request: 
 Get "https://api.drand.sh/public/643563": context deadline exceeded
这个错误一般都是你的机器无法联网导致的,或者网络不稳定等,导致 miner 无法访问到分布式随机数服务器,而且,如果一直无法访问的话, miner 的 log 日志中会不断的输出这个错误信息,如果 miner 的 log 日志中已经暂定输出这个错误信息,则说明已经恢复正常(WaitSeed 阶段需要正确获得 drand 信息才能继续)。

12 lotus 的日志中显示错误:block was from the future:

错误信息如下所示:
2021-03-29T23:03:52.060+0800	ERROR	chain	chain/sync.go:1500	failed to validate tipset: validating block bafy2bzacedn4somb5xy634kgn56tnmrhs7yg7lje4u2iqpod6d74yvndvwdgu:
    github.com/filecoin-project/lotus/chain.(*Syncer).ValidateTipSet.func1
        /home/ml/git2/lotus/chain/sync.go:620
  - block was from the future (now=1617030232, blk=1617030234):
    github.com/filecoin-project/lotus/chain.(*Syncer).ValidateBlock
        /home/ml/git2/lotus/chain/sync.go:743
  - temporal error
这个错误信息一般会持续的输出,原因是你的机器的时间和其它机器的时间不一致导致的,你可以通过更新机器时间来解决这个问题,具体方式如下:
sudo ntpdate  ntp.aliyun.com
同步好时间之后,重启 daemon 和 miner 一般就可以了。

13 Worker 启动失败:API not running (no endpoint)

错误信息如下所示:
Connecting to miner API... (could not get API info: could not get api endpoint: API not running (no endpoint))
这个错误信息是因为你的 worker 机器中没有配置 miner 的 API token,解决方法是在把 miner的地址配置上。