Skip to content

Instantly share code, notes, and snippets.

@pkitslaar
Last active April 2, 2017 01:24
Show Gist options
  • Save pkitslaar/64a161a34af4d266760a8508a4a76806 to your computer and use it in GitHub Desktop.
Save pkitslaar/64a161a34af4d266760a8508a4a76806 to your computer and use it in GitHub Desktop.
Description of installation steps of Keybase.io client on crouton installation on Chromebook

Building the Keybase client (and Go 1.6.3) on a Chromebook (using crouton)

  • Author: Pieter Kitslaar
  • Date: August 2, 2016

Below are a list of steps I preformed to install the Keybase client application on a Chromebook using the crouton chroot environment.

Background

Since the Chromebook I have (Samsung XE303C12) is an ARM based device I could not use the pre-compiled binaries of the Keybase client provided. Also the client is written in Go and requires version of Go >= 1.5.

I followed the descriptions found at the following pages

Install Go

First, let's see if we can use the Go version provided by the Ubuntu precise distribution provided by crouton.

localhost:~$ sudo apt-get install golang
...
Selecting previously unselected package golang-src.
(Reading database ... 44403 files and directories currently installed.)
Unpacking golang-src (from .../golang-src_2%3a1-5_armhf.deb) ...
Selecting previously unselected package golang-go.
Unpacking golang-go (from .../golang-go_2%3a1-5_armhf.deb) ...
Selecting previously unselected package golang-doc.
Unpacking golang-doc (from .../golang-doc_2%3a1-5_all.deb) ...
Selecting previously unselected package golang.
Unpacking golang (from .../golang_2%3a1-5_all.deb) ...
Setting up golang-src (2:1-5) ...
Setting up golang-go (2:1-5) ...
Setting up golang-doc (2:1-5) ...
Setting up golang (2:1-5) ...

Now, let's check the version.

localhost:~$ go version
go version go1

To bad. The default Go installation will not work.

localhost:~$ sudo apt-get remove golang
localhost:~$ sudo apt-get autoremove

So, it seems I have to build Go myself.

Build Go (Part 1)

First checkout the Go sources.

localhost:~$ cd projects/
localhost:~/projects$ git clone https://go.googlesource.com/go go-latest
localhost:~/projects$ cd go-latest/

Since Keybase says it needs Go >= 1.5 and the Go website shows 1.6.3 as the latest stable release. We will use that.

localhost:~/projects/go-latest$ git checkout go1.6.3 
localhost:~/projects/go-latest$ cd src/
localhost:~/projects/go-latest/src$ ./all.bash 
##### Building Go bootstrap tool.
cmd/dist
ERROR: Cannot find /home/pieter/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.

Wait, what?? To build Go 1.6.3 I need to have Go 1.4? Ok, lets try that in a different directory. Let's clone the Go repository and checkout the go1.4 version.

localhost:~/projects$ git clone go-latest go-1.4
localhost:~/projects$ cd go-1.4
localhost:~/projects/go-1.4$ git checkout go1.4
localhost:~/projects/go-1.4$ cd src/
localhost:~/projects/go-1.4/src$ ./all.bash 

At the end some of the tests failed since it was trying to contact some HTTP resource, however my network was down at the time (I am actually doing on a campsite with limited network connectivity). Anyway, I assume the build was succesfull since most of the core tests succeeded.

localhost:~/projects/go-1.4/src$ cd ../pkg/tool/linux_arm
localhost:~/projects/go-1.4/pkg/tool/linux_arm$ ./dist banner

---
Installed Go for linux/arm in /home/pieter/projects/go-1.4
Installed commands in /home/pieter/projects/go-1.4/bin
*** You need to add /home/pieter/projects/go-1.4/bin to your PATH. 

Yep, Go 1.4 succeeded.

Build Go (Part 2)

Now, we can build the 1.6.3 version with the previously build 1.4 version.

Go back to the go-latest repo and set the GOROOT_BOOTSTRAP environment variable.

localhost:~/projects/$ cd go-latest/src
localhost:~/projects/go-latest/src$ export GOROOT_BOOTSTRAP=/home/pieter/projects/go-1.4/

Now we can build the 1.6.3 version. Run the all.bash script and wait...

localhost:~/projects/go-latest/src$ ./all.bash 

After some time you should see

ALL TESTS PASSED

---
Installed Go for linux/arm in /home/pieter/projects/go-latest
Installed commands in /home/pieter/projects/go-latest/bin
*** You need to add /home/pieter/projects/go-latest/bin to your PATH.

Let's test it.

localhost:~$ export PATH=/home/pieter/projects/go-latest/bin:$PATH
localhost:~$ go version
go version go1.6.3 linux/arm

Success!

Modify .bashrc with Go specific stuff so go is in our path next time we log in.

# GO specific stuff
export PATH=/home/pieter/projects/go-latest/bin:$PATH

Setup Go build environment

Next, to build other Go projects (like our Keybase client) we need to define a working directory and set this as the GOPATH variable. Within this directory we also have a bin folder which will later contain the keybase executable.

localhost:~$ mkdir ~/projects/go-path
localhost:~$ cd projects/go-path/
localhost:~$ mkdir bin

Add GOPATH and the bin folder to the PATH So, update the .bashrc file.

# GO specific stuff
export PATH=/home/pieter/projects/go-latest/bin:$PATH
export GOPATH=/home/pieter/projects/go-path/
export PATH=$GOPATH/bin:$PATH

Build Keybase client

Now, we can finally build the Keybase client. Below are the build steps as taken from the Keybase site. Since, we have Go version 1.6.3 the GO15VENDOREXPERIMENT=1 setup is actually not needed, but I will keep it here anyway.

localhost:~$ GO15VENDOREXPERIMENT=1 go get github.com/keybase/client/go/keybase
localhost:~$ GO15VENDOREXPERIMENT=1 go install -tags production github.com/keybase/client/go/keybase

These two steps do not provide any output or progress, so at first I was a bit confused what was going on. However, when I paused the process (<CTRL+Z>) and moved it to the backgroun (bg) I could see a lot of activity using top command.

After this we can see the keybase executable in the bin folder in our GOPATH directory.

localhost:~$ ls -lh ~/projects/go-path/bin/
total 30M
-rwxrwxr-x 1 pieter pieter 30M Aug  2 22:03 keybase

So, let's test it.

localhost:~$ keybase version
Client:  1.0.16

Yeah, succes!

Test and run keybase commands

Start the keybase service and run it in the background.

localhost:~$ keybase service&

Login

localhost:~$ keybase login

Run some commands

localhost:~$ keybase id pkitslaar
► INFO Identifying pkitslaar
✔ public key fingerprint: A577 CA30 6CCD 5E44 1C7F DEDA 667B C14E D4D8 E2D6
✔ "pkitslaar" on twitter: https://twitter.com/pkitslaar/status/760358815141359616
✔ "pkitslaar" on github: https://gist.github.com/272c395fe037f5a437b44040b54b3255¶
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment