Cabal update failure (return code: -9)

1k views Asked by At

I got that error when trying to use cabal update

below were the results of 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 was installed from justhub

Does anyone have any idea why it failed? I looked for the return code of -9 but there's no information.

Update

Thanks Reid (and user5402),

Checked the dmesg and that's definitely because it's out of memory

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

Will upgrade the machine and try again, not sure how much would cabal-install need though, I'm on a 512MB RAM system

2

There are 2 answers

0
Nikolay Fominyh On

512Mb of RAM is not enough. Instead of upgrading machine you can enable swap.

On ubuntu do following steps:

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

It will add you 4G swap file, that will prevent killing from OS.

1
sclv On

The value -9 probably means a child process died to SIGKILL, which in turn was probably sent by the OOM killer. Checking the output of dmesg can confirm this. If that's the case, one needs to turn up the RAM available. (based on this comment).