Cabal更新失败(返回码:-9)

时间:2014-11-13 00:43:15

标签: haskell cabal cabal-install

尝试使用cabal update

时出错

以下是cabal update -v3

的结果
Downloading the latest package list from hackage.haskell.org
Sending:
GET /packages/archive/00-index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.16.0.2
Creating new connection to hackage.haskell.org
Received:
HTTP/1.1 301 Moved Permanently
Server: nginx/1.6.2
Date: Thu, 13 Nov 2014 00:14:21 GMT
Content-Type: text/plain; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /packages/index.tar.gz
Content-Length: 0
301 - redirect
Redirecting to http://hackage.haskell.org/packages/index.tar.gz ...
Sending:
GET /packages/index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.16.0.2
Recovering connection to hackage.haskell.org
Received:
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Thu, 13 Nov 2014 00:14:21 GMT
Content-Type: application/x-gzip
Content-Length: 8090775
Connection: keep-alive
Content-MD5: bae2f93619ba845eff2f3bd544714c2c
ETag: "bae2f93619ba845eff2f3bd544714c2c"
Last-Modified: Wed, 12 Nov 2014 23:04:10 GMT
Downloaded to /root/.cabal/packages/hackage.haskell.org/00-index.tar.gz
Updating the index cache file...
cabal update: /usr/hs/tools/cabal-1.16.0.2 failure (return code=-9)

haskell是从justhub

安装的

有谁知道它失败的原因?我查找了-9的返回码,但没有任何信息。

更新

感谢Reid(和user5402),

检查了dmesg,这肯定是因为内存不足

Out of memory: Kill process 32626 (cabal-1.16.0.2) score 711 or sacrifice child

升级机器再试一次,不知道cabal-install需要多少,我在512MB RAM系统上

2 个答案:

答案 0 :(得分:2)

值-9可能意味着一个子进程死于SIGKILL,而这反过来可能是由OOM杀手发送的。检查dmesg的输出可以确认这一点。如果是这种情况,则需要提供可用的RAM。 (基于this comment)。

答案 1 :(得分:1)

512Mb的RAM是不够的。您可以启用交换,而不是升级机器。

在ubuntu上执行以下步骤:

sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

它将添加4G交换文件,这将防止从操作系统中查杀。