gravitl / netmaker-docs

The documentation for Netmaker, a WireGuard-based overlay network platform
Other
10 stars 22 forks source link

[Bug]: The automated install script netclient-install.sh does not create the service file. #59

Open prouveyrol opened 2 years ago

prouveyrol commented 2 years ago

Contact Details

No response

What happened?

Running

curl -sfL https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.sh | KEY=<sometoken> sh -

On a fresh ubuntu 22.04 server, does not create the service file.

Looking at the script, at line 216 we see : 

if [ "${OS}" = "OpenWRT" ]; then
        mv ./netclient /sbin/netclient
        cat << 'END_OF_FILE' > ./netclient.service.tmp

        <some init file>

END_OF_FILE
        mv ./netclient.service.tmp /etc/init.d/netclient
        chmod +x /etc/init.d/netclient
        /etc/init.d/netclient enable
        /etc/init.d/netclient start
else
        rm -f netclient
fi

But in the case of an amd64 distro, it simply downloads the binary (not the deb), and runs the join, without creating the service file.

Considering lines 12 to 52, I think that you either were using packages in the past, or are planning to. But currently, the script as is does not function as expected, as the netclient will not be restarted upon reboot. It is not even moved to /usr/bin so trying to run netclient leave… will not work either, as the binary sits where the script was run.

Version

v0.14.3

What OS are you using?

Linux

Relevant log output

[netclient] 2022-06-22 09:42:40 joining testnet at api.netmaker.<mydomain>.systems:443
[netclient] 2022-06-22 09:42:40 starting wireguard
[netclient] 2022-06-22 09:42:42 certificates/key saved
[netclient] 2022-06-22 09:42:42 sent a node update to server for node <myservername> ,  <uuid>
[netclient] 2022-06-22 09:42:44 error running command: systemctl restart netclient.service
[netclient] 2022-06-22 09:42:44 Failed to restart netclient.service: Unit netclient.service not found.


### Contributing guidelines

- [X] Yes, I did.
afeiszli commented 2 years ago

netclient-install.sh is no longer the recommended install path as of 0.14.3. Instead, use the appropriate package installer instructions:

https://docs.netmaker.org/netclient.html#install

If you are installing from a downloaded netclient, you can add the daemon doing the following:

netclient join -t (token) --daemon=install

prouveyrol commented 2 years ago

Thanks, that is what I ended up doing. I can swear I read this somewhere in some doc here https://netmaker.readthedocs.io, but I am now unable to find it again.

All good. I'm closing the issue.

prouveyrol commented 2 years ago

Found it again. https://netmaker.readthedocs.io/en/master/getting-started.html#deploy-nodes

Item 4 here. You might want to correct the doc to mention this page instead.

Best regards, and thanks for the awesome product.

afeiszli commented 2 years ago

Thanks! If you're interested, you can make a PR to fix the docs here: https://github.com/gravitl/netmaker-docs

Otherwise, I will try to have that in with the next release.