gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.5k stars 552 forks source link

[Bug]: /usr/local/bin/wireguard-go: Bad CPU type in executable #1726

Closed mklatsky closed 1 year ago

mklatsky commented 2 years ago

Contact Details

michael@maputech.com

What happened?

A bug happened!

After installing Netclient from ther macos .pkg file , I run the following:

sudo netclient join -t XXXXXXXXXXXX where the Xs represent my token.

The netmaker dashboard shows my laptop is part of the network, but I am unable to access anything on the net.

There are a number of errors when I run the above command on my laptop, however:

$ sudo netclient
[netclient] 2022-11-10 11:07:43 error deleting wireguard interface error flushing routes file does not exist
[netclient] 2022-11-10 11:07:43 error running command: wg-quick down /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:07:43 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
wg-quick: `nm-wg-net' is not a WireGuard interface
[netclient] 2022-11-10 11:08:01 joining wg-net at api.maputech.net:443
[netclient] 2022-11-10 11:08:01 network: wg-net UDP hole punching enabled for node Michaels-MacBook-Pro-2local
[netclient] 2022-11-10 11:08:01 starting wireguard
[netclient] 2022-11-10 11:08:03 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:08:03 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name

This goes on for awhile before return to the command prompt.

OS: Macos : 13.0.1 (22A400) Intel CPU

Version

v0.16.1

What OS are you using?

Mac

Relevant log output

$ sudo netclient join -t XXXXXXXXXXXXXXXXXXXXXXXXXX
[netclient] 2022-11-10 11:21:01 joining wg-net at api.mydomain.net:443
[netclient] 2022-11-10 11:21:01 network: wg-net UDP hole punching enabled for node Michaels-MacBook-Pro-2local
[netclient] 2022-11-10 11:21:01 starting wireguard
[netclient] 2022-11-10 11:21:03 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:03 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:03 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:03 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:04 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:04 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:05 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:05 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:06 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:06 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:07 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:07 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:08 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:08 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:09 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:09 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:10 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:10 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:11 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:11 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:12 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:12 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:13 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:13 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:14 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:14 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:15 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:15 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:16 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:16 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:18 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:18 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
[netclient] 2022-11-10 11:21:19 error running command: wg-quick up /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:19 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name
file does not exist
[netclient] 2022-11-10 11:21:20 error installing:  could not reliably create interface, please check wg installation and retry
[netclient] 2022-11-10 11:21:20 error running command: wg-quick down /Applications/Netclient/config/nm-wg-net.conf
[netclient] 2022-11-10 11:21:20 /usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
wg-quick: `nm-wg-net' is not a WireGuard interface

Contributing guidelines

mattkasun commented 1 year ago

that looks like an issue with the installation of wg-tools and not netclient try running wg-quick up /Applications/Netclient/config/nm-wg-net.conf from the command line.

mklatsky commented 1 year ago

When I run sudo wg-quick up /Applications/Netclient/config/nm-wg-net.conf, I get the following error:

wg-quick: `/Applications/Netclient/config/nm-wg-net.conf' does not exist

it would appear tha t the config does not exist anywhere,

mattkasun commented 1 year ago

Create a dummy wg conf file and see if it comes up with wg-quick

mklatsky commented 1 year ago

I now get the following:

$ sudo wg-quick up /Applications/Netclient/config/nm-wg-net.conf
/usr/local/bin/wg-quick: line 112: /usr/local/bin/wg: Bad CPU type in executable
[#] wireguard-go utun
/usr/local/bin/wg-quick: line 34: /usr/local/bin/wireguard-go: Bad CPU type in executable
[#] rm -f /var/run/wireguard/nm-wg-net.name

Note that this is an 2.3 GHz 8-Core Intel Core i9 CPU. Also, if it matters, I have go v19.2 installed:

$ go version
go version go1.19.2 darwin/amd64
mklatsky commented 1 year ago

It appears I solved my issue. I think the core issue was that I first installed netclient via homebrew, and then by using the pkg file to use the gui. Somewhere, my wireguard installation, installed via homebrew, must have been (for want of better words) - messed up.

I removed all traces of wireguard, wireguard-tools, wireguard-go and netclient, and reinstalled them all- and now I am working as expected. Thank you for pointing me in the right direction.