grumble icon indicating copy to clipboard operation
grumble copied to clipboard

Building and running on Raspberry Pi

Open NickSutton opened this issue 6 years ago • 45 comments

Hi, trying to get Grumble up and running on the Pi so I can leverage the websockets functionality.

The install go get mumble.info/grumble/cmd/grumble Fails on a $GOPATH not set error, even when $GOPATH is explicitly set before hand and can be seen in go env

Could someone let me know what I’ve missed?

NickSutton avatar Apr 14 '18 11:04 NickSutton

What's the output of go env?

ghost avatar Apr 14 '18 11:04 ghost

Thank Tim,

GOARCH="arm" GOBIN="" GOEXE="" GOHOSTARCH="arm" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/pi/gocode" GORACE="" GOROOT="/usr/lib/go-1.7" GOTOOLDIR="/usr/lib/go-1.7/pkg/tool/linux_arm" CC="gcc" GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-abuild589052819=/tmp/go-build -gno-record-gcc-switches" CXX="g++" CGO_ENABLED="1"

NickSutton avatar Apr 14 '18 11:04 NickSutton

Not sure why you're seeing that error, but Go 1.7 is a few versions behind. It might be worthwhile to upgrade to Go 1.10 and then try to build grumble.

ghost avatar Apr 14 '18 11:04 ghost

Cancel last! Was running with sudo so perhaps it was unhappy with the pi username?

Anyway, install out put gave this, is this a fail or information warnings: go get mumble.info/grumble/cmd/grumble

mumble.info/grumble/cmd/grumble

../pi/gocode/src/mumble.info/grumble/cmd/grumble/server.go:1457: unknown http.Server field 'IdleTimeout' in struct literal ../pi/gocode/src/mumble.info/grumble/cmd/grumble/server.go:1461: undefined: http.ErrServerClosed ../pi/gocode/src/mumble.info/grumble/cmd/grumble/server.go:1522: server.webhttp.Shutdown undefined (type *http.Server has no field or method Shutdown)`

Thanks for your quick help!

NickSutton avatar Apr 14 '18 11:04 NickSutton

Those errors are related to the Go version. Upgrade to 1.10 and they should go away.

ghost avatar Apr 14 '18 11:04 ghost

OK, will try that. Installing Go on the Pi is a pain!!

NickSutton avatar Apr 14 '18 11:04 NickSutton

Awesome, perfect install. For anyone else going down this route, here are the instructions for GoLang 1.10 on Pi (lifted from elsewhere on Git)

To install golang 1.10 (or whatever the latest version is at the time anyone is reading this):

wget https://storage.googleapis.com/golang/go1.10.linux-armv6l.tar.gz sudo tar -C /usr/local -xvf go1.10.linux-armv6l.tar.gz cat >> ~/.bashrc << 'EOF' export GOPATH=$HOME/go export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin EOF source ~/.bashrc

Run go version to check and you should see output of: go version g1.10 linux/arm also this preserves /usr/bin/go is you installed it previously.

Now, excuse my blatant lack of knowledge, but what next? Does this sit on top of a mumble-server install or instead? I’ve just removed a working mumble and hope for grumble to take its place!

UPDATE:

Following reboot, setup GOPATH $ export GOPATH=$HOME/gocode $ mkdir -p $GOPATH

Then run the following line: $ go get mumble.info/grumble/cmd/grumble

CD in to GOPATH/src/mumble.info/grumble/cmd/grumble and make any config changes you need before building the program: go build -o grumble mumble.info/grumble/cmd/grumble

And check ./grumble —help this will expose the various command line switches, you will need to populate at least the following:

./grumble --datadir ~/gocode --log ~/gocode/log

NickSutton avatar Apr 14 '18 11:04 NickSutton

Does this sit on top of a mumble-server install or instead?

The latter; grumble is a separate, standalone Mumble server. After starting grumble, you should be able to connect to your Pi from your Mumble client.

ghost avatar Apr 14 '18 11:04 ghost

I thought so... That’s it!? So simple... Where is the configuration to add my password and define port etc?

NickSutton avatar Apr 14 '18 11:04 NickSutton

Configuration is currently unmerged in PR #26. In the mean time, you can manually apply that patch to your local copy to enable configuration.

ghost avatar Apr 14 '18 11:04 ghost

Wow, look like you guys have done a lot of work, and I’ve got a lot of learning to do! I wish someone had travelled this path before me (and documented it along the way!)

How do i start Grumble?

NickSutton avatar Apr 14 '18 11:04 NickSutton

Thanks for being a trailblazer.

After building grumble (go build -o grumble mumble.info/grumble/cmd/grumble), just run it (./grumble). You may have to play around with the arguments (pass --help to see available ones).

ghost avatar Apr 14 '18 11:04 ghost

Thanks - I’m getting there... but you’re definitely right about the arguments!!

`go run grumble.go --help

command-line-arguments

./grumble.go:25:5: undefined: Args ./grumble.go:26:3: undefined: Usage ./grumble.go:31:26: undefined: Args ./grumble.go:33:56: undefined: Args ./grumble.go:39:34: undefined: Args ./grumble.go:41:62: undefined: Args ./grumble.go:48:41: undefined: Args ./grumble.go:56:27: undefined: Args ./grumble.go:68:26: undefined: Args ./grumble.go:69:25: undefined: Args ./grumble.go:69:25: too many errors `

NickSutton avatar Apr 14 '18 12:04 NickSutton

The --help flag is mean for the compiled grumble binary, not go run.

You should also use go build to compile grumble -- go run isn't straightforward with respect to how grumbles files are organized.

ghost avatar Apr 14 '18 12:04 ghost

Yep, go build command seemed to execute without any issue. ./grumble wasn’t working though so i tried grumble.go but no dice.?

Does ./grumble need to be from a specific directory?

NickSutton avatar Apr 14 '18 12:04 NickSutton

if you passed -o grumble to go build, then the grumble binary will appear in your current working directory.

ghost avatar Apr 14 '18 12:04 ghost

Yes, did that. Can see the binary, but ./grumble gives Unable to open data directory (/home/pi/.grumble): open /home/pi/.grumble: no such file or directory

Worth noting home/pi/gocode is current GOPATH Variable

NickSutton avatar Apr 14 '18 12:04 NickSutton

Those errors are what I was alluding to earlier: you'll have to pass some arguments to grumble, specifically --datadir and --log.

ghost avatar Apr 14 '18 12:04 ghost

Ok! Got the help text. Is there anywhere I can write this all up for the next Pi guy?

NickSutton avatar Apr 14 '18 12:04 NickSutton

I'd just leave it in a comment in this thread. We should hopefully get some official docs together in the future.

ghost avatar Apr 14 '18 12:04 ghost

Ok, well I’d be happy to help!

So here’s where I’m at:

./grumble --datadir ~/gocode --log ~/gocode/log [G] 2018/04/14 13:17:30.342856 Grumble [G] 2018/04/14 13:17:30.343374 Using data directory: /home/pi/gocode [G] 2018/04/14 13:17:30.343782 Generating 4096-bit RSA keypair for self-signed certificate... [G] 2018/04/14 13:19:49.679947 Certificate output to /home/pi/gocode/cert.pem [G] 2018/04/14 13:19:49.680261 Private key output to /home/pi/gocode/key.pem [1] 2018/04/14 13:19:49.695490 Started: listening on [::]:64738 and 0.0.0.0:443 [1] 2018/04/14 13:19:49.696451 Fatal HTTP server error: listen tcp 0.0.0.0:443: bind: permission denied

How can I set my IP or, more ideally, domain name

NickSutton avatar Apr 14 '18 12:04 NickSutton

You can either:

  1. Modify the source code to bind your server on a specific IP address and port, or
  2. Locally merge the #26 branch to enable configuration file support where you can set configuration options

ghost avatar Apr 14 '18 12:04 ghost

Ok, 26 sounds like more flexibility in the long run, but i don’t know how to merge the files in #26.

I can look through the source files and find where to set the IP. Thanks again for your support

NickSutton avatar Apr 14 '18 12:04 NickSutton

Tried to merge the file changes on local machine and rebuild, once I fixed all my typos I’m still getting errors about a missing ini package “gopkg.in/ini.v1" from the new file_ini.go file . Do I need a template configuration in .ini format?

NickSutton avatar Apr 14 '18 15:04 NickSutton

The config support adds a new external dependency, so you may have to go get gopkg.ini/ini.v1 to be able to build it. A template configuration should be automatically created on first run. However, the config support is still WIP and I recommend you merge the new changes in #26 to avoid a persistence issue before you set any config keys.

rubenseyer avatar Apr 15 '18 10:04 rubenseyer

Thanks, I think I’ll keep an eye on the config support and d/l when it’s part of the git proper. In the meantime, can you tell me where I can set the domain of my machine, also webport 443 is in use by email SSL, so will need to rename that to be able to connect to websockets?

NickSutton avatar Apr 15 '18 11:04 NickSutton

The reason the default webport is 443 is because that will be required for the planned Let's Encrypt support. Websockets works fine on any port otherwise. Setting the config key webport (if you're on the config branch) or editing line 40 in server.go will do the trick. If you're connecting from a browser, make sure it trusts the certificate that Grumble sends, otherwise the connection will fail.

The default host should work fine in most cases but if you need to set it it's the config key host or line 1384 in server.go.

rubenseyer avatar Apr 15 '18 11:04 rubenseyer

On Linux you can only bind to port 443 (really, allow ports <= 1024) as root -- unless you set a capability on the binary.

See for example: https://unix.stackexchange.com/questions/10735/linux-allowing-an-user-to-listen-to-a-port-below-1024

Personally, I like this method: https://unix.stackexchange.com/a/10737

mkrautz avatar Apr 15 '18 19:04 mkrautz

That looks pretty advanced. 443 isnt that much of an issue to me as I can reallocate the email port, and I’m not really sure it’s a problem.

Got the script to recognise my IP now, but still have a permission denied message ( Fatal HTTP server error: listen tcp 127.0.0.1:443: bind: address already in use) for binding to 443. Will investigate and update

Update, 443 was in use by Apache2. Changed to 442 and rebuilt, and now: Started: listening on 127.0.0.1:64738 and 127.0.0.1:442Started: listening on 127.0.0.1:64738 and 127.0.0.1:442 woop!! Just the TLS side of thing to sort out now

NickSutton avatar Apr 15 '18 19:04 NickSutton

Hi All, Thanks again for the help so far. Is it possible to disable TLS/SSL for testing, I’m having difficulty getting the mumble client to connect with the Grumble generated cert.PEM file, once converted to PKCS12 format. Also, iOS Mumble app requires that certificates are imported from iTunes, which I’ve successfully avoided for nearly 5 years!! Any tips on clients that will use the generated certs, or can it be temporarily disabled?

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

NickSutton avatar Apr 22 '18 08:04 NickSutton