I've been using this script to attempt to install geth on a Raspberry Pi 3.

It seems to work ok until part way through the build:

pi@raspberrypi:~/go-ethereum $ make geth
build/env.sh go run build/ci.go install ./cmd/geth
>>> /usr/lib/go-1.7/bin/go install -ldflags -X main.gitCommit=bdef758d5c6d397584d0c35e53d6f6c318e61351 -v ./cmd/geth
# github.com/ethereum/go-ethereum/cmd/geth
/usr/lib/go-1.7/pkg/tool/linux_arm/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory

util.go:43: exit status 2
exit status 1
Makefile:15: recipe for target 'geth' failed
make: *** [geth] Error 1

It is saying cannot allocate memory - there is ~8GiB free on the SD card (1GB RAM).

Can anyone recreate this error? What tips are there for debugging/fixing?

N.b. This question is similar to Installing ethereum node on Raspberry pi errors.

Also, a similar problem was reported here: https://groups.google.com/forum/#!topic/cloud-print-connector/zF_xyViClLM

  • 1
    How much memory (i.e. RAM) is available before building? (Run free -h.) Are there any memory-consuming processes you could kill first? (Run top, then press M to order by memory use.) Feb 16, 2017 at 18:24
  • @RichardHorrocks that was it thanks; I only had 236M free...... thanks!
    – Lee
    Feb 16, 2017 at 18:29
  • Thanks - I've added a few more details in case they're useful to anyone else :-) Feb 16, 2017 at 18:45

2 Answers 2


What tips are there for debugging/fixing?

These suggestions aren't specific to Ethereum/Geth/etc., but they may be of use to someone seeing the same problem in future.

The error was complaining about a lack of memory. (Where "memory" means RAM, not harddisk space.)

/usr/lib/go-1.7/pkg/tool/linux_arm/link: running gcc failed: fork/exec 
/usr/bin/gcc: cannot allocate memory

Even if you know how much memory your system has, first check how much of it is actually available:

  • free -h, or
  • cat /proc/meminfo | grep MemFree

If there's what you'd consider to be not enough, see if you can free any up by assessing which processes are using it:

  • top, then M to order by memory use.

Once you've selected any non-critical processes you don't need, kill them:

  • kill -15 <pid>, where pid is the process id.

(Note we're using signal number -15, which equates to SIGTERM, rather than -9, which is SIGKILL. This way we give the process a chance to be notified of the signal - if it has a handler installed - and clean up gracefully.)


FWIW I found this answer: https://raspberrypi.stackexchange.com/questions/70/how-to-set-up-swap-space and was able to compile and run geth on a Rasp B with 512 MB ram

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.