Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing for Go noobs #5

Closed
djc opened this issue Feb 10, 2020 · 17 comments
Closed

Installing for Go noobs #5

djc opened this issue Feb 10, 2020 · 17 comments

Comments

@djc
Copy link

djc commented Feb 10, 2020

enrai ~ $ go install tailscale.com/cmd/tailscale
can't load package: package tailscale.com/cmd/tailscale: cannot find package "tailscale.com/cmd/tailscale" in any of:
	/usr/lib/go/src/tailscale.com/cmd/tailscale (from $GOROOT)
	/home/djc/go/src/tailscale.com/cmd/tailscale (from $GOPATH)
enrai ~ $ go install tailscale.com/cmd/tailscaled
can't load package: package tailscale.com/cmd/tailscaled: cannot find package "tailscale.com/cmd/tailscaled" in any of:
	/usr/lib/go/src/tailscale.com/cmd/tailscaled (from $GOROOT)
	/home/djc/go/src/tailscale.com/cmd/tailscaled (from $GOPATH)

What are the magic incantations required to make this work (this is a Gentoo Linux box)?

@crawshaw
Copy link
Member

The command works inside a go module. Not sure if we can make it compatible with a GOPATH.

@djc
Copy link
Author

djc commented Feb 10, 2020

So I should cd into the repository clone? And that clone has to be in src/tailscale.com?

@sylr
Copy link
Contributor

sylr commented Feb 10, 2020

GO111MODULE=on go install tailscale.com/cmd/tailscale{,d} to make it work outside of GOPATH.

@bradfitz
Copy link
Member

The command works inside a go module. Not sure if we can make it compatible with a GOPATH.

I think it should still work in GOPATH mode but I hadn't tried.

@bradfitz
Copy link
Member

I verified it works in GOPATH mode, after all the usual GOPATH-era pain of manually updating deps to required versions. (And of course it needs to be checked out at the right place in disk if using GOPATH mode)

@bradfitz
Copy link
Member

@djc, what version of Go?

I documented this a bit more in fef2548

@djc
Copy link
Author

djc commented Feb 11, 2020

I have go 1.12.15 on this machine. Since GOPATH is apparently not a well-supported option, what are the other steps I have to take to build it in a better supported mode? I reviewed the README updates but this doesn't seem to be explained yet. (Also you have a typo, "vesions".)

@kroppt
Copy link

kroppt commented Feb 21, 2020

@djc

Since GOPATH is apparently not a well-supported option, what are the other steps I have to take to build it in a better supported mode?

The following comment from above works, and it can be run from anywhere:

GO111MODULE=on go install tailscale.com/cmd/tailscale{,d} to make it work outside of GOPATH.

Go modules ensures you have the correct dependency versions. That command downloads all Go dependencies needed to build, builds the dependencies and the package in question, then installs (copies) the binary to your Go path's bin folder. Adding $(go env GOPATH)/bin to your PATH would be wise if you want quick access to programs built with Go.

You can also download the repository, change to the directory, and run go install tailscale.com/cmd/tailscale{,d} to do the same thing.

@djc
Copy link
Author

djc commented Feb 22, 2020

That does something, but it appears Go 1.12 is not supported:

# tailscale.com/tempfork/osexec
go/pkg/mod/tailscale.com@v0.0.0-20200222144456-c51b8c206d97/tempfork/osexec/exec.go:508:10: xe.Unwrap undefined (type *os.SyscallError has no field or method Unwrap)
note: module requires Go 1.13

I'll try again in a while after my distro upgrades to 1.13.

@bradfitz
Copy link
Member

@djc, no need to wait for your distro. You can use another Go compiler trivially:

$ go get golang.org/dl/go1.13.8
$ go1.13.8 download

Then:

$ GO111MODULE=on go1.13.8 install tailscale.com/cmd/tailscale{,d} 

@djc
Copy link
Author

djc commented Mar 18, 2020

So I have Go 1.13 now and I compiled tailscale and tailscaled. I then tried figuring out how to start. Here's some further feedback on next steps in the onboarding process; these maybe don't belong in this repository, but I do hope they're useful.

If I sign up with an email address on a personal account (firstname@lastname.nl), after clicking the button "Sign up with email", the input field disappears and the button label changes to "Sign up another identity". I found this UX non-intuitive at least. Signing up with my GMail account does work. I found instructions here: https://tailscale.com/kb/1053/install-static (maybe also link this from the README). When I run enrai bin $ sudo ./tailscaled --state=tailscaled.state from my ~/go/bin dir as instructed, it fails with:

logtail started
Program starting: vdate.20200315: []string{"./tailscaled", "--state=tailscaled.state"}
LogID: ac6668053cd00a5f53464fab9b8a046e8b84e108fa36c04c1119a99517ba99d2
12.1M/26.1M Starting userspace wireguard engine.
12.2M/26.1M external packet routing via --tun=tailscale0 enabled
20.2M/34.3M CreateTUN: no such file or directory
wgengine.New: no such file or directory

@bradfitz
Copy link
Member

I found this UX non-intuitive at least. Signing up with my GMail account does work.

Agreed. That whole UI is being redone at the moment.

20.2M/34.3M CreateTUN: no such file or directory

Do you have a /dev/net/tun device?

$ ls -l /dev/net/tun
crw-rw-rw- 1 root root 10, 200 Feb 13 08:55 /dev/net/tun

Clearly we need a better error message at least. Will do that now.

@djc
Copy link
Author

djc commented Mar 18, 2020

I don't have /dev/net. Presumably this might be some kernel option that I have not enabled?

@bradfitz
Copy link
Member

I've pushed a better error message.

@bradfitz
Copy link
Member

You'll need CONFIG_TUN=y or =m in your kernel: https://cateee.net/lkddb/web-lkddb/TUN.html

@djc
Copy link
Author

djc commented Mar 26, 2020

Alright, I've gotten it to work. Thanks!

A minor question I was left with after reading the documentation, in https://tailscale.com/kb/1033/ip-and-dns-addresses it would be nice if there was a bit more clarity about how consistency of IP addresses is achieved within a single authentication. Is that just a randomly generated ID that's stored in the tailscaled.state, or is there something going on that will work with e.g. MAC addresses or other machine characteristics?

@djc djc closed this as completed Mar 26, 2020
@djc
Copy link
Author

djc commented Mar 26, 2020

(It might still be useful to explain the GO111MODULE=on go1.13.8 install tailscale.com/cmd/tailscale{,d} in the README, too, and potentially document the requirement for the kernel config option somewhere.)

gps949 added a commit to gps949/MirageClient that referenced this issue May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants