当前位置: 首页 > 工具软件 > Singularity > 使用案例 >

Ubuntu安装singularity报错记录

宗政燕七
2023-12-01

项目场景:

需要用singularity执行nextflow命令

权衡了一下决定登录root账号安装了,因为有很多依赖。

参考文章:12官方文档

步骤:1.安装依赖

2.安装go=1.15;;(这些跟着做都没问题)

3.安装singularity=3.6.2;;(报错)


问题描述1

直接使用官方文档的语句:

export VERSION=3.6.2 && \
    wget https://github.com/sylabs/singularity/archive/refs/tags/v${VERSION}.tar.gz && \
    tar -xzf singularity-${VERSION}.tar.gz && \
    cd singularity

会报错:HTTP request sent, awaiting response... 404 Not Found

命令行输出为:

--2022-05-17 17:10:36--  https://github.com/sylabs/singularity/releases/download/v3.6.2/singularity-3.6.2.tar.gz
Resolving github.com (github.com)... 140.82.112.4
Connecting to github.com (github.com)|140.82.112.4|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-05-17 17:10:37 ERROR 404: Not Found.

原因分析:

有人建议换源,我不会;还有什么先建个域名啥的,我看不懂;

最终看到有人遇到的原因是下载地址并不是默认的直接后加文件名,所以我根据官方文档的说明,选择github网站上tags下的v3.6.2版本,复制了这个下载网址到wget命令,结果报错

Resolving codeload.github.com (codeload.github.com)... failed: Name or service not known.
wget: unable to resolve host address ‘codeload.github.com’
 

命令行输出:

--2022-05-17 17:33:33--  https://github.com/sylabs/singularity/archive/refs/tags/v3.6.2.tar.gz
Resolving github.com (github.com)... 140.82.112.4
Connecting to github.com (github.com)|140.82.112.4|:443... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2022-05-17 17:35:35--  (try: 2)  https://github.com/sylabs/singularity/archive/refs/tags/v3.6.2.tar.gz
Connecting to github.com (github.com)|140.82.112.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/sylabs/singularity/tar.gz/refs/tags/v3.6.2 [following]
--2022-05-17 17:35:36--  https://codeload.github.com/sylabs/singularity/tar.gz/refs/tags/v3.6.2
Resolving codeload.github.com (codeload.github.com)... failed: Name or service not known.
wget: unable to resolve host address ‘codeload.github.com’

解决方案:

可能是wget本身不能这样用,所以我决定直接下载tar.gz放到/usr/local/,接着跟着原文章执行。


问题描述2:

中间执行./mconfig报错:

 E: Not inside a git repository and no VERSION file found. Abort.

解决方案:

命令行先执行:

echo 3.6.2 >> VERSION

中间还有个小错 提示unable to find the cryptsetup program, is the package cryptsetup-bin installed?

直接 conda install cryptsetup-bin

其次:根据官方文档的提示我在./mconfig 时加了前缀--prefix到自己账号的路径,但是之前有先执行了一遍每家前缀的,不知道后面的报错和这有没有关系。


问题描述3:

1.命令:make && make install

报错:

Makefile:467: recipe for target '/usr/local/singularity-3.6.2/scripts/go-generate' failed
make: *** [/usr/local/singularity-3.6.2/scripts/go-generate] Error 1


 解决:执行

make clean

  ,之前有一次误执行了echo 3.8.3 >> VERSION ,所以可以看到makefile对应行处有不合理的地方,把3.8.3删去,然后删除之前生成的东西重新执行make

2.命令:make && make install

报错:

/bin/sh: 1: /usr/local/singularity-3.6.2/scripts/go-generate: Permission denied
Makefile:153: recipe for target '/usr/local/singularity-3.6.2/internal/pkg/buildcfg/config.go' failed
make: *** [/usr/local/singularity-3.6.2/internal/pkg/buildcfg/config.go] Error 126

解决:执行

$ cd /usr/local/singularity-3.6.2/scripts/

$ chmod 777 go-generate

$ make clean

3.命令:make && make install

报错:

 GEN GO DEP /usr/local/singularity-3.6.2/builddir/starter.d
go: github.com/Netflix/go-expect@v0.0.0-20190729225929-0e00d9168667: Get "https://proxy.golang.org/github.com/%21netflix/go-expect/@v/v0.0.0-20190729225929-0e00d9168667.mod": dial tcp 142.251.42.241:443: i/o timeout
 GEN GO DEP /usr/local/singularity-3.6.2/builddir/singularity.d
go: github.com/Netflix/go-expect@v0.0.0-20190729225929-0e00d9168667: Get "https://proxy.golang.org/github.com/%21netflix/go-expect/@v/v0.0.0-20190729225929-0e00d9168667.mod": dial tcp 172.217.160.81:443: i/o timeout
 GO singularity
    [+] GO_TAGS "containers_image_openpgp sylog oci_engine singularity_engine fakeroot_engine apparmor selinux seccomp"
go: github.com/Netflix/go-expect@v0.0.0-20190729225929-0e00d9168667: Get "https://proxy.golang.org/github.com/%21netflix/go-expect/@v/v0.0.0-20190729225929-0e00d9168667.mod": dial tcp 142.251.42.241:443: i/o timeout
Makefile:171: recipe for target 'singularity' failed
make: *** [singularity] Error 1

搜索了很长时间,并没有其他不一样的报错原因,几乎都是make clean 或者是代码编写有中英文编写问题,但我的makefile应该是没错的,所以怀疑是dial ..i/o timeout的原因。

开始搜索解决方案:发现问题是https://proxy.golang.org

需要换成国内代理地址,参考链接:

1

2goproxy.cn

因为有很多参考,我都看迷糊了,跟着换了好多命令,但是依旧报了完全一样的错误。直到有一次命令换成 GO111MODULE=off,报错和这一篇文章一样,文章提示可能是环境中存在其他的GOPROXY变量,因此我开始在系统中查询环境变量,结果,我不会查。。。

解决方案:

然后随手点开singularity的makefile查询了一下GOPROXY,发现原来是这里已经定义了环境变量。。在此处进行修改后,问题解决。


问题描述4:

root@mrilab:/usr/local/singularity-3.6.2/builddir# sudo make && make install
 GO singularity
    [+] GO_TAGS "containers_image_openpgp sylog oci_engine singularity_engine fakeroot_engi   ne apparmor selinux seccomp"
# github.com/sylabs/singularity/internal/pkg/util/fs/squashfs
../internal/pkg/util/fs/squashfs/squashfs.go:25:17: undefined: buildcfg.SINGULARITY_CONF_FI   LE
# github.com/sylabs/singularity/internal/pkg/util/bin
../internal/pkg/util/bin/bin.go:37:14: undefined: buildcfg.SINGULARITY_CONF_FILE
../internal/pkg/util/bin/bin.go:53:5: undefined: buildcfg.CRYPTSETUP_PATH
../internal/pkg/util/bin/bin.go:70:6: undefined: buildcfg.CRYPTSETUP_PATH
../internal/pkg/util/bin/bin.go:74:10: undefined: buildcfg.CRYPTSETUP_PATH
# github.com/sylabs/singularity/internal/pkg/util/starter
../internal/pkg/util/starter/starter.go:59:27: undefined: buildcfg.LIBEXECDIR
../internal/pkg/util/starter/starter.go:62:26: undefined: buildcfg.LIBEXECDIR
../internal/pkg/util/starter/starter.go:118:25: undefined: buildcfg.LIBEXECDIR
# github.com/sylabs/singularity/internal/pkg/plugin
../internal/pkg/plugin/create.go:98:23: undefined: buildcfg.SOURCEDIR
../internal/pkg/plugin/create.go:100:96: undefined: buildcfg.SOURCEDIR
../internal/pkg/plugin/create.go:106:23: undefined: buildcfg.SOURCEDIR
../internal/pkg/plugin/meta.go:26:12: undefined: buildcfg.PLUGIN_ROOTDIR
../internal/pkg/plugin/module.go:151:33: undefined: buildcfg.SOURCEDIR
Makefile:171: recipe for target 'singularity' failed
make: *** [singularity] Error 2

我隐约记得找其他资料的时候发现过未定义的问题,但后来死活找不见了。在github的issue上有人问Undefined buildcfg variables when compiling Singularity,他的singularity安装过程和错误都跟我的很类似,结果没有解决问题。

有人提示要把singularity放到go文件夹下,我照做了放在/usr/local/go处,但从报错来看,好像因为之前的步骤设置,导致编译时,各种文件还是去原来的singularity文件夹下找了。删除原来的也不行。放弃了。

我又搜索了”执行go时报错 :undefined“类似词条,有人说是多个.go文件需要同时编译,执行 go run  *.go 报错没有这文件,显然这句命令不能这么直接用,我懒得跑到.go所在的地方执行,遂放弃。还有一个可能原因,懒得看懂

躺平了,重新执行了一次 make && make install  奶奶的成功了。怀疑是一开始加了sudo的锅。


问题描述5:

通过命令行输出可以看到,singularity确实是按照之前的./mconfig是加的prefix安装到了我的账号下面。

直接在命令行中查询singularity,会报没有该命令

我按照官方文档提示的把"./我的路径/singularity/etc/bash_completion.d/singularity"加到了我的.bashrc文件中,

依旧报错;

把./我的路径/singularity/bin加入path变量

成功。(虽然显示了3.8.3+3.6.2,不过应该问题不大,有问题再说吧)

 类似资料: