I can't install golang on freebsd 12.2 (solved)

Hi dear friends. first of all, thank you so much for your amazing operating system and forum.
This is my first post in this forum. Sorry if I did something wrong.
I tried to install go-1.17.1,1 on FreeBSD 12.2-RELEASE amd64 and updated and upgraded my system:
sudo pkg update && sudo pkg upgrade

and tried to install go:
sudo pkg install go

The installation was 100% complete, but this error message was displayed:
pkg: go-1.17.1,1 failed checksum from repository

So I tried to compile it:

sudo su
cd /usr/ports/lang/go/ && make -DBATCH install clean


and failed again:
Code:
===> go-1.15.8,1 has known vulnerabilities:
go-1.15.8,1 is vulnerable:
go -- multiple vulnerabilities
CVE: CVE-2021-41772
CVE: CVE-2021-41771
WWW: https://vuxml.FreeBSD.org/freebsd/930def19-3e05-11ec-9ba8-002324b2fba8.html

go -- net/http: ReadRequest can stack overflow due to recursion with very large headers
CVE: CVE-2021-31525
WWW: https://vuxml.FreeBSD.org/freebsd/7f242313-aea5-11eb-8151-67f74cf7c704.html

go -- encoding/xml: infinite loop when using xml.NewTokenDecoder with a custom TokenReader; archive/zip: panic when calling Reader.Open
CVE: CVE-2021-27919
CVE: CVE-2021-27918
WWW: https://vuxml.FreeBSD.org/freebsd/72709326-81f7-11eb-950a-00155d646401.html

go -- crypto/tls: clients can panic when provided a certificate of the wrong type for the negotiated parameters
CVE: CVE-2021-34558
WWW: https://vuxml.FreeBSD.org/freebsd/c365536d-e3cf-11eb-9d8d-b37b683944c2.html

go -- net/http: panic due to racy read of persistConn after handler panic
CVE: CVE-2021-36221
WWW: https://vuxml.FreeBSD.org/freebsd/880552c4-f63f-11eb-9d56-7186043316e9.html

go -- misc/wasm, cmd/link: do not let command line arguments overwrite global data
CVE: CVE-2021-38297
WWW: https://vuxml.FreeBSD.org/freebsd/4fce9635-28c0-11ec-9ba8-002324b2fba8.html

go -- multiple vulnerabilities
CVE: CVE-2021-33196
CVE: CVE-2021-33195
CVE: CVE-2021-33197
CVE: CVE-2021-33198
WWW: https://vuxml.FreeBSD.org/freebsd/079b3641-c4bd-11eb-a22a-693f0544ae52.html

go -- archive/zip: overflow in preallocation check can cause OOM panic
CVE: CVE-2021-39293
WWW: https://vuxml.FreeBSD.org/freebsd/4ea1082a-1259-11ec-b4fa-dd5a552bdd17.html

8 problem(s) in 1 installed package(s) found.
=> Please update your ports tree and try again.
=> Note: Vulnerable ports are marked as such even if there is no update available.
=> If you wish to ignore this vulnerability rebuild with 'make DISABLE_VULNERABILITIES=yes'
*** Error code 1

what should I do? I do Python, Ruby, ... programming without any problem. but I have this problem even in some stuff such as cargo (rust package manager).
I really appreciate any help...
 
The installation was 100% complete, but this error message was displayed:
pkg: go-1.17.1,1 failed checksum from repository
Run pkg clean -a and try again. It sounds like your downloaded file was corrupted at some point.

Code:
===> go-1.15.8,1 has known vulnerabilities:
You have a really old ports tree.
 
I apologize for the delay in responding. I didn't expect to get answer so soon. thanks...

I cleaned all cache just like you said, but the problem didn't solved.
You have a really old ports tree.
What should I do about this? I downloaded stable version of freebsd (at that time freebsd 12 was the stable version).
 
Just download from https://go.dev/dl/. I usually don’t bother with the ports/pkg system for go programs.
The problem is that this method does not work either!
I did that:
download and then extract file:
tar xvf go1.17.4.freebsd-amd64.tar.gz

move it to local folder:
sudo mv go /usr/local

and add these lines to .profile file:
export GOROOT=/usr/local/go export GOPATH=$HOME/projects/trygo export PATH=$GOPATH/bin:$GOROOT/bin:$path

when I type go version in terminal, can't see golang version...
 
Guys, Is it possible that golang maintainer it doesn't update it anymore? or golang does not work very well on freebsd? because I didn't have absolutely any problem with other softwares/languages/frameworks except Rust and Go languages.
 
I think stick to binary packages (pkg) or use ports - best not to mix them.

I have go installed (from ports) but it's only used to build geoipupdate - but it all seems to work.

Code:
% pkg info | grep go
go-1.17.4,1                    Go programming language
...
% go version
go version go1.17.4 freebsd/amd64

So I'd go back to finding out why the pkg install doesn't work for you.

EDIT: just noticed I'm using 13.0 and you've specifically said 12.2. I've got one 12.2 machine left, with go installed as above - 1.17.4.
 
On a clean 13.0 amd64 install, using binary packages:

Code:
# pkg info
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.17.5...
Extracting pkg-1.17.5: 100%
pkg-1.17.5                     Package manager
# pkg install go
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01   
Fetching packagesite.pkg: 100%    6 MiB   2.2MB/s    00:03   
Processing entries: 100%
FreeBSD repository update completed. 31149 packages processed.
All repositories are up to date.
Updating database digests format: 100%
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    go: 1.17.1,1

Number of packages to be installed: 1

The process will require 301 MiB more space.
77 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching go-1.17.1,1.pkg: 100%   77 MiB   8.1MB/s    00:10   
Checking integrity... done (0 conflicting)
[1/1] Installing go-1.17.1,1...
[1/1] Extracting go-1.17.1,1: 100%
# go version
go version go1.17.1 freebsd/amd64
Default is quarterly packages, so the go version is 1.17.1 (the version in ports is 1.17.4)
 
On a clean 13.0 amd64 install, using binary packages:

Code:
# pkg info
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.17.5...
Extracting pkg-1.17.5: 100%
pkg-1.17.5                     Package manager
# pkg install go
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01  
Fetching packagesite.pkg: 100%    6 MiB   2.2MB/s    00:03  
Processing entries: 100%
FreeBSD repository update completed. 31149 packages processed.
All repositories are up to date.
Updating database digests format: 100%
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    go: 1.17.1,1

Number of packages to be installed: 1

The process will require 301 MiB more space.
77 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching go-1.17.1,1.pkg: 100%   77 MiB   8.1MB/s    00:10  
Checking integrity... done (0 conflicting)
[1/1] Installing go-1.17.1,1...
[1/1] Extracting go-1.17.1,1: 100%
# go version
go version go1.17.1 freebsd/amd64
Default is quarterly packages, so the go version is 1.17.1 (the version in ports is 1.17.4)
Is it possible to upgrade freebsd 12.2 to 13.0 without reinstalling?
is it stable version 13.0?
 
The problem is that this method does not work either!
I did that:
download and then extract file:
tar xvf go1.17.4.freebsd-amd64.tar.gz

move it to local folder:
sudo mv go /usr/local

and add these lines to .profile file:
export GOROOT=/usr/local/go export GOPATH=$HOME/projects/trygo export PATH=$GOPATH/bin:$GOROOT/bin:$path

when I type go version in terminal, can't see golang version...
Did you source .profile (. .profile)after you edited it? BTW, you don't need to define GOROOT.
 
I really don't know how to thank you guys...
I'm almost sure now that my operating system version is old.
I decided to take a backup from my data and softwares configs.
Then upgrade my operating system to a new version (maybe 13 or even 14).
Due to the fact that the download speed from the repositories is very slow for me (in my country, usually/average under 50 or 70 KiB/s !) it takes a long time to upgrade.
If the problem isn't solved, I will bother you again.
Wish you all the best.
 
Due to the fact that the download speed from the repositories is very slow for me (in my country, usually/average under 50 or 70 KiB/s !) it takes a long time to upgrade.
This is possibly why your pkg install of go failed - poor network connection.

The binary package system works well and is fast but does rely on a good network connection.

Good luck!
 
golang does not work very well on freebsd? because I didn't have absolutely any problem with other softwares/languages/frameworks except Rust and Go languages.
I have been using Go on FreeBSD for about 10 years now. It works just fine.

One thing you can try is to *investigate* any problem you run into, rather than try something else. For example when you downloaded the .tar.gz from the Go site, when you typed "go version" you said you "can't see go version". What did happen? There must have been some error message. You could have tried /usr/local/go/bin/go version, to make sure you were getting the correct binary. If it failed to run, look at the error message etc. Instead now you are upgrading to 13.0-RELEASE and will now run into some *new* problems.

Remember that people will give suggest different things based on what worked for them. If you try suggestions from different people soon you will confuse yourself to no end. Learning to debug and asking here when something in your "debugging journey" doesn't make sense will give you a much better insight into what goes wrong and how to fix it yourself.

According to Go's build dashboard Go works on 12.2 (on i386 & amd64).
 
This is possibly why your pkg install of go failed - poor network connection.

The binary package system works well and is fast but does rely on a good network connection.

Good luck!
Unfortunately Internet speed in my country is not fast. However I've taken my Internet from one of the best ISPs!!! Actually download speed from other sites (for example youtube) is less than 5 MiB/s (average). But the download speed from FreeBSD repositories is very slow. It has been like that from the beginning. It happens very often that the download stops automatically.
 
I have been using Go on FreeBSD for about 10 years now. It works just fine.

One thing you can try is to *investigate* any problem you run into, rather than try something else. For example when you downloaded the .tar.gz from the Go site, when you typed "go version" you said you "can't see go version". What did happen? There must have been some error message. You could have tried /usr/local/go/bin/go version, to make sure you were getting the correct binary. If it failed to run, look at the error message etc. Instead now you are upgrading to 13.0-RELEASE and will now run into some *new* problems.

Remember that people will give suggest different things based on what worked for them. If you try suggestions from different people soon you will confuse yourself to no end. Learning to debug and asking here when something in your "debugging journey" doesn't make sense will give you a much better insight into what goes wrong and how to fix it yourself.

According to Go's build dashboard Go works on 12.2 (on i386 & amd64).
Thank you so much for saving my time!
I put all the error codes. I was also looking for them on the internet. Even followed some youtube videos and blog posts to install Go on freebsd and I did exactly that.
Yes You are right... I will research again.
when you typed "go version" you said you "can't see go version". What did happen?
I get this: sh: go: not found. I even used bash instead of sh.
 
The weird thing is that I don't have the slightest problem with the rest of the softwares.
I have i3wm, Emacs, Python, Ruby, Django, Flask, Rails, postgres, mariadb, Tor and any other softwares and their just work amazing. My OS didn't crashes even just one time!
I even installed Elixir. but I don't know why golang and cargo didn't install.
 
Not sure if you are trying wired or wireless connection. I've got a (slightly behind on updates) 12.2 NUC and no issues installing go on there:

Code:
# pkg install go
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Updating database digests format: 100%
New version of pkg detected; it needs to be installed first.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
    pkg: 1.16.3 -> 1.17.5

Number of packages to be upgraded: 1

7 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching pkg-1.17.5.pkg: 100%    7 MiB 850.2kB/s    00:09   
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.16.3 to 1.17.5...
[1/1] Extracting pkg-1.17.5: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    go: 1.17.1,1

Number of packages to be installed: 1

The process will require 301 MiB more space.
77 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching go-1.17.1,1.pkg: 100%   77 MiB   2.8MB/s    00:29   
Checking integrity... done (0 conflicting)
[1/1] Installing go-1.17.1,1...
[1/1] Extracting go-1.17.1,1: 100%
# go version
go version go1.17.1 freebsd/amd64
# exit
% go version
go version go1.17.1 freebsd/amd64
% uname -a
FreeBSD nuc12 12.2-RELEASE-p4 FreeBSD 12.2-RELEASE-p4 GENERIC  amd64
 
My OS didn't crashes even just one time!
It shouldn't crash very often, if at all. If you are having sporadic crashes that suggests hardware issues.

What you are experiencing isn't usual - so something with your set-up, network or the machine itself (RAM? Over-heating? Power?)
 
I get this: sh: go: not found. I even used bash instead of sh.
This tells me that either you forgot to source .profile after updating it or when you did "mv go /usr/local" something went wrong. That is why the next thing to try was to run /usr/local/go/bin/go directly. Anyway, good luck!
 
Not sure if you are trying wired or wireless connection. I've got a (slightly behind on updates) 12.2 NUC and no issues installing go on there:

Code:
# pkg install go
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Updating database digests format: 100%
New version of pkg detected; it needs to be installed first.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
    pkg: 1.16.3 -> 1.17.5

Number of packages to be upgraded: 1

7 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching pkg-1.17.5.pkg: 100%    7 MiB 850.2kB/s    00:09  
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.16.3 to 1.17.5...
[1/1] Extracting pkg-1.17.5: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    go: 1.17.1,1

Number of packages to be installed: 1

The process will require 301 MiB more space.
77 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching go-1.17.1,1.pkg: 100%   77 MiB   2.8MB/s    00:29  
Checking integrity... done (0 conflicting)
[1/1] Installing go-1.17.1,1...
[1/1] Extracting go-1.17.1,1: 100%
# go version
go version go1.17.1 freebsd/amd64
# exit
% go version
go version go1.17.1 freebsd/amd64
% uname -a
FreeBSD nuc12 12.2-RELEASE-p4 FreeBSD 12.2-RELEASE-p4 GENERIC  amd64
I have a TP LINK MR200 modem and use cable connection. When I download from the domestic sites, the download speed is even up to 20 MiB/s sometimes (just from domestic sites). This is a very very high speed in our country!
No everything is fine. network cable, modem and etc.
 
It shouldn't crash very often, if at all. If you are having sporadic crashes that suggests hardware issues.

What you are experiencing isn't usual - so something with your set-up, network or the machine itself (RAM? Over-heating? Power?)
My hardware is completely fine. even system temperature and anything is fine.
I have 16 GB, RAM and my CPU is Intel i7-4790K (8) @ 3.997GHz.
I'm really sure my hardware is fine.
 
Back
Top