demotomohiro / remocolab

remocolab is a Python module to allow remote access to Google Colaboratory using SSH or TurboVNC.
MIT License
316 stars 229 forks source link

Error connecting using Argo tunnel #78

Open Arif59 opened 3 years ago

Arif59 commented 3 years ago

I keep getting the following error on my local terminal when I try to ssh to Google Colab using Argo tunnel:

/usr/bin/bash: line 0: exec: cloudflared: not found
ssh_exchange_identification: Connection closed by remote host

Here's the code I ran:

!wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.tgz && tar -zxvf cloudflared-stable-linux-amd64.tgz

After this extracted the cloudfare file, I ran the following:

!pip install git+https://github.com/demotomohiro/remocolab.git
import remocolab
remocolab.setupVNC(tunnel = "argotunnel")

I ran it without GPU, by the way. My colab also disconnects a minute or two after my failure to ssh. Any help is appreciated!

ochen1 commented 3 years ago

You need to install cloudflared on your local machine.

Please try installing cloudflared on your LOCAL machine, and make sure it is in the path after you download it (ie. sudo cp ./cloudflared /usr/bin).

demotomohiro commented 3 years ago

You need to download cloudflared to your local PC and extract it. Then, copy it to the directory in one of PATH environment variable. Following cloudflared command specified in -oProxyCommand option in SSH command print by remocolab is executed on your local PC when you run the SSH command.

-oProxyCommand="cloudflared access ssh --hostname %h"

You don't need to download cloudflared to colab instace. remocolab.setupVNC function automatically download cloudflared to colab instance.

Arif59 commented 3 years ago

You need to download cloudflared to your local PC and extract it. Then, copy it to the directory in one of PATH environment variable.

I must be doing something dumb because now I'm getting a new error:

websocket: bad handshake
ssh_exchange_identification: Connection closed by remote host

I've attached a screenshot of my local machine terminal to show that this error occurs despite the PATH environment variable working properly.

image

demotomohiro commented 3 years ago

It seems your colab instance was shutdown due to you didn't used google colab for long time. Please try again.

lrushi commented 3 years ago

I have a similar issue too. Here is my error log

$ cloudflared -V
cloudflared version 2020.12.0 (built 2020-12-08-2302 UTC)

$ ssh -o UserKnownHostsFile=/dev/null -o VisualHostKey=yes -oProxyCommand="cloudflared access ssh --hostname %h" colab@lets-dairy-needed-cassette.trycloudflare.com
websocket: bad handshake
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

$

Did google block cloudflared based argotunnel too?

demotomohiro commented 3 years ago

I tested remocolab with Argo tunnel now and it worked. Maybe Argo tunnel's server was temporary down?

VigramK commented 3 years ago

I am having similar issues, I was getting "no such host kex_exchange_identification: Connection closed by remote host" using Argo tunnel so I restarted the session, and tried it again, and this time I was able to start VNC, but within a few minutes the connection disconnected and my Colab session was completely restarted. Been having this problem for the past 2 days now.

demotomohiro commented 3 years ago

I have tested remocolab today. At first, when I try to login to the ssh server, I got following error:

dial tcp: lookup eos-century-discover-garage.trycloudflare.com: no such host
kex_exchange_identification: Connection closed by remote host

I waited few minutes and tried again but got same error. Then, I did factory reset runtime on google colab and run remocolab.setupVNC again. It worked and I can access it using VNC. I can use it at least 30 minutes.

But few month ago, I experianced google colab always disconnected after about 5 minutes. I could connect again and run some code but got disconnected in 5 minutes.

We use google colab and Argo Tunnel. They are free service and sometimes not stable.

VigramK commented 3 years ago

I have tested remocolab today. At first, when I try to login to the ssh server, I got following error:

dial tcp: lookup eos-century-discover-garage.trycloudflare.com: no such host
kex_exchange_identification: Connection closed by remote host

I waited few minutes and tried again but got same error. Then, I did factory reset runtime on google colab and run remocolab.setupVNC again. It worked and I can access it using VNC. I can use it at least 30 minutes.

But few month ago, I experianced google colab always disconnected after about 5 minutes. I could connect again and run some code but got disconnected in 5 minutes.

We use google colab and Argo Tunnel. They are free service and sometimes not stable.

Thank you for testing! I tried it again today and I was able to connect and use it for around 5 minutes and then it got disconnected, when I ran a cell in colab, but this time my session didn't get wiped off like earlier, Next I checked the cloudflared.log and found this at the end:

[2021-01-13T11:38:54.283001093Z]: mux - read: read tcp 172.28.0.2:47630->198.41.200.113:7844: read: connection reset by peer: frame read error [2021-01-13T11:38:54.283185533Z]: mux - metrics: Stopping mux metrics updater [2021-01-13T11:38:54.283238093Z]: Serve tunnel error: read tcp 172.28.0.2:47630->198.41.200.113:7844: read: connection reset by peer [2021-01-13T11:40:50.787151068Z]: Initiating graceful shutdown due to signal interrupt ...

I then killed the port that was opened by cloudflared and deleted the binary files and rerun remocolab.setupVNC and this time my connection seems to be fine, but I have not run any cells in colab, I get the feeling the tunnel would get terminated once I run a cell.