I am installing cloud foundry command line in Raspberry P2 running raspbian Jessie, I have tried ways using the Installer and the binary Installation, I have tried to force the architecture amrhf. The result I get when running the cf command on the terminal is "/usr/bin/cf: cannot execute binary file: Exec format error" I have tried to change the mode with this command "chmod +x /usr/bin/cf" the error is still there.

  • 3
    Looking at the cloud foundry releases page, it appears that all of the available downloads target x86 architecture.
    – BillP3rd
    Commented Oct 18, 2016 at 9:03
  • file /usr/bin/cf should settle that one way or the other.
    – goldilocks
    Commented Oct 18, 2016 at 14:27
  • @Masa, it is really interesting to have an arm-incompatible binary under /usr/bin. How did you place it in there?
    – vaha
    Commented Oct 18, 2016 at 21:26

1 Answer 1


As @Billp3rd says, it seems that the binary (/usr/bin/cf) is not compiled for ARM architecture.

You need to compile it from source. To do so:

Install go on your raspi, because cf is developed in go

Do not use apt-get install golang. If it has been installed from repo, remove it by apt-get remove golang; apt-get autoremove.

The version 1.3.1 in the repo has known bugs. Instead download arm distribution of the latest version which is 1.7.1 for now.

   root@mypi:~# cd /opt
   root@mypi:/opt# wget https://storage.googleapis.com/golang/go1.7.1.linux-armv6l.tar.gz
   root@mypi:/opt# tar xvf go1.7.1.linux-armv6l.tar.gz 
   root@mypi:/opt# cd ~

The archive is extracted to /opt/go.

Create a folder for GOPATH. I choose /root/mygopath.

root@mypi:~# mkdir /root/mygopath

Set variables required for go

root@mypi:~# export GOROOT=/opt/go
root@mypi:~# export GOPATH=/root/mygopath

Download and build cf-cli. This process takes some time.

root@mypi:~# /opt/go/bin/go get code.cloudfoundry.org/cli

In normal circumtances, the cli binary should be created under /root/mygopath/bin/.

Copy or move cli binary compiled for ARM. I prefer to put it under /opt/cf/.

root@mypi:~# mkdir /opt/cf
root@mypi:~# cp /root/mygopath/bin/cli /opt/cf/

Here is output of cli command on ARM.

root@mypi:~# /opt/cf/cli 
/opt/cf/cli version BUILT_FROM_SOURCE-BUILT_AT_UNKNOWN_TIME, Cloud Foundry command line tool
Usage: /opt/cf/cli [global options] command [arguments...] [command options]

Before getting started:
  config    login,l      target,t
  help,h    logout,lo    

Application lifecycle:
  apps,a        logs      set-env,se
  push,p        ssh       create-app-manifest
  start,st      app       
  stop,sp       env,e     
  restart,rs    scale     
  restage,rg    events    
  • Thanks @vaha, I have tried to follow your instructions, but now once I run this command "./bin/build" then I get this Generating Binary... main.go:10:2:
    – Masa
    Commented Oct 19, 2016 at 9:39
  • Generating Binary... main.go:10:2: cannot find package "code.cloudfoundry.org/cli/cf/cmd" in any of: /usr/lib/go/src/pkg/code.cloudfoundry.org/cli/cf/cmd (from $GOROOT) /usr/local/sbin/src/code.cloudfoundry.org/cli/cf/cmd (from $GOPATH) /usr/local/bin/src/code.cloudfoundry.org/cli/cf/cmd /usr/sbin/src/code.cloudfoundry.org/cli/cf/cmd /usr/bin/src/code.cloudfoundry.org/cli/cf/cmd /sbin/src/code.cloudfoundry.org/cli/cf/cmd /bin/src/code.cloudfoundry.org/cli/cf/cmd /usr/local/games/src/code.cloudfoundry.org/cli/cf/cmd /usr/games/src/code.cloudfoundry.org/cli/cf/cmd
    – Masa
    Commented Oct 19, 2016 at 9:40
  • Those errors are caused by wrong GOPATH value. You should set GOPATH to where you cloned the source in. At the current step, you should look for GO specific solutions in GO related sites from GO experts =).
    – vaha
    Commented Oct 19, 2016 at 9:46
  • I think I found how to compile. I will test when I access to my raspberry.
    – vaha
    Commented Oct 19, 2016 at 10:49
  • Thanks @vaha. I am trying but still the same:(
    – Masa
    Commented Oct 19, 2016 at 12:17

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.