jotta / jotta-cli-issues

45 stars 1 forks source link

No fallback to localhost for host if omitted #35

Closed erikarenhill closed 6 years ago

erikarenhill commented 6 years ago

Make sure you are running the latest version of jotta-cli before reporting an issue.

jotta-cli release (jotta-cli version): 0.4.4986

Description of problem: options is not defaulting to localhost if omitted.

The output shows options as optional with brackets around it. usage: ./jotta-cli [options] command

Typing jotta-cli version makes it timeout, however specifying -host localhost for all commands makes it work. Seems like there is no default fallback to localhost for -host if omitted

Expected: Default to localhost if omitted since the docs show that options is optional.

jotta-cli status (jotta-cli status):

------------------------------------------------------------------------------
 Account   : [removed]
 Usage     : 0bytes / 5.00GiB
 Device    : [removed]
 No folders added to backup yet
OK

Relevant logs for the issue (cat ~/.jottad/jottabackup.log)

Nothing relevant in logs regarding this.

Traceback

-

Additional info: Ubuntu 16.04.3 LTS

Linux ubuntu 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

existemi commented 6 years ago

I am unable to reproduce this with version 0.4.4986 on 16.04.3 running 4.4.0 kernel.

Do you have any local modifications to /etc/hosts? Could you provide me with the output ofnetstat -lnp | grep jottad?

erikarenhill commented 6 years ago

netstat output: tcp6 0 0 :::14443 :::* LISTEN 12195/jottad

hosts-file: 127.0.0.1 localhost 127.0.1.1 ubuntu.lan ubuntu

The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters

existemi commented 6 years ago

Can you also make sure you have a entry in /etc/hosts like this:

::1     localhost ip6-localhost ip6-loopback

Do you get different results with ipv4 vs ipv6:

jotta-cli -host 127.0.0.1 version
jotta-cli -host [::1] version
erikarenhill commented 6 years ago

Yeah, updated the last reply with hosts-file.. I already have that ipv6 line.

jotta-cli -host 127.0.0.1 version does not respond at all , but [::1] does work as intended

erikarenhill commented 6 years ago

From the output of netstat it seems like it only listens on ipv6?

existemi commented 6 years ago

Do you have any custom kernel parameters in regards to ipv6, more specifically net.ipv6.bindv6only?

$ sysctl net.ipv6.bindv6only
net.ipv6.bindv6only = 0

From: https://groups.google.com/forum/#!msg/golang-nuts/F5HE7Eqb6iM/q_um2VqT5vAJ

on linux, by default, net.ipv6.bindv6only is 0, so ipv4 packets could also be received from
ipv6 sockets with ipv4-mapped ipv6 address. thus you only need to listen on tcp6 socket
and we can support both ipv4 and ipv6.
erikarenhill commented 6 years ago

Executing sysctl net.ipv6.bindv6onlygives the same output as in your example: net.ipv6.bindv6only = 0

erikarenhill commented 6 years ago

Personally I can live with specifying -host localhost if there's something weird with my setup of Ubuntu, however I think that an improvement would be to set a lower timeout (e.g. 5-10 seconds?) to give a quicker feedback that the jotta-cli could not connect to the daemon. Or/and add some output to hint about trying with specifying the host flag if not able to connect

existemi commented 6 years ago

There must be some other parameters or program that prevents the default golang behaviour on your machine. Could be virtualisation, containers or other platforms that manages iptables and/or bridges.

I have made an issue with our developers to default to localhost and to adjust timeout and error message to be more helpful.