Code Monkey home page Code Monkey logo

Comments (5)

PatternAlpha avatar PatternAlpha commented on May 22, 2024 1

@chadpetersen1337 Thanks that works for me :)

@WassimBenzarti thanks for your help.. i Found my problem: I didnt unzip my .tgz file with the binary file inside of it (Shame). Now every thing works.

### TLDR; Solution (Ubuntu):

  1. setup google colab notebook like in Image 1 (pick any password you like)
  2. download and extract binary
#Path that VScode uses to connect to Remote ssh
cd /home/<user>/.ssh
#download and extract
wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.tgz
tar -xvzf cloudflared-stable-linux-amd64.tgz
  1. add connection to VSCode SSH file (image 2)
    a) open remote tab in VScode
    b) open config file
    c) add this connection to setting:
    Host google_colabe_cloudflare
    HostName
    User root
    Port 22
    ProxyCommand /home/andrew/.ssh/cloudflared access ssh --hostname %h
  2. connect to Colab

Note: Cloudflare connection is displayed in Google colab (see redbox in image 1)
Image 1
image
Image 2
image

from colab-ssh.

PatternAlpha avatar PatternAlpha commented on May 22, 2024

I can vouch for you, last time i used Colab's SSH tunnel was on the 28th January 2021. As of 29th January it isn't. I was using ngrok, this cloudflared method is extremely difficult. No YouTube tutorial you can find, even the available vague how to assumes that you're on Linux, which i find to be selfish.

Can someone post a YouTube tutorial on how to configure ArgoTunnel + GoogleColab on Windows?

@chadpetersen1337 this is a good tutorial on how to set it up:
https://medium.com/swlh/connecting-local-vscode-to-google-colabs-gpu-runtime-bceda3d6cf64

from colab-ssh.

WassimBenzarti avatar WassimBenzarti commented on May 22, 2024

Hello @PatternAlpha,
Sorry for the inconvenience.

I can't reproduce the issue unfortunately, could you please describe the steps you followed so we can reproduce it?
and by the way thank you for sharing with us the Medium article, I think it's very useful.

@chadpetersen1337 Well we always aim to provide a way for Windows and Linux, I personally use Windows by the way. Sorry that you had to go through some issues, we are planning on making a video tutorial (primarily for Windows) in this issue #57. You can follow the updates there.
Please feel free to post an issue or create a discussion in the Github discussion tab. It's open for anyone who's faces issues with the library. I will try to reply as fast as possible :)

Thank you for using colab-ssh!

from colab-ssh.

PatternAlpha avatar PatternAlpha commented on May 22, 2024

Hello @PatternAlpha,
Sorry for the inconvenience.

I can't reproduce the issue unfortunately, could you please describe the steps you followed so we can reproduce it?
and by the way thank you for sharing with us the Medium article, I think it's very useful.

@WassimBenzarti nothing to be sorry for, thanks for the great repo!

Im using FREE colab accounts and this my step by step approach. Sorry this is going to be a long post :D.
Below I'll demonstrate how I connect to using these methods:

  1. ngrok
  2. Cloudeflare & VSCode
  3. Cloudflare & SSH-tunnel

1. Connection using NGROK:

Colab code
image

VSCode
After wards i connect using VScode Remote and get this log message:

[08:24:48.656] Log Level: 2
[08:24:48.658] [email protected]
[08:24:48.658] linux x64
[08:24:48.659] SSH Resolver called for "ssh-remote+google_colab_ssh", attempt 1
[08:24:48.659] "remote.SSH.useLocalServer": true
[08:24:48.659] "remote.SSH.sshPath": undefined
[08:24:48.660] "remote.SSH.sshConfigurationFile": undefined
[08:24:48.660] "remote.SSH.useFlock": true
[08:24:48.660] "remote.SSH.lockfilesInTmp": false
[08:24:48.660] "remote.SSH.localServerDownload": auto
[08:24:48.660] "remote.SSH.remoteServerListenOnSocket": false
[08:24:48.660] "remote.SSH.showLoginTerminal": false
[08:24:48.661] SSH Resolver called for host: google_colab_ssh
[08:24:48.661] Setting up SSH remote "google_colab_ssh"
[08:24:48.663] Acquiring local install lock: /tmp/vscode-remote-ssh-google_colab_ssh-install.lock
[08:24:48.671] Looking for existing server data file at /home/andrew/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-google_colab_ssh-ea3859d4ba2f3e577a159bc91e3074c5d85c0523-0.63.0/data.json
[08:24:48.672] Found local server running: {"remoteListeningOn":{"port":38357},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","tmpDir":"/tmp","platform":"linux","connectionToken":"11111111-1111-11aa-aa1a-1111a1111111","pid":10395,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-44e4e63b6c83e1c8ab3911deb0bc67a44ddd88bb.sock","socksPort":34983,"startupTime":1611845753986}
[08:24:48.676] Server delay-shutdown request failed: connect ENOENT /run/user/1000/vscode-ssh-askpass-44e4e63b6c83e1c8ab3911deb0bc67a44ddd88bb.sock
[08:24:48.676] Existing server's health check failed, will start a new one
[08:24:48.676] Using commit id "ea3859d4ba2f3e577a159bc91e3074c5d85c0523" and quality "stable" for server
[08:24:48.679] Install and start server if needed
[08:24:48.684] Checking ssh with "ssh -V"
[08:24:48.703] > OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017

[08:24:48.707] askpass server listening on /run/user/1000/vscode-ssh-askpass-3e872f41471ee8fc3c81a7c10c65bae4cacba06e.sock
[08:24:48.707] Spawning local server with {"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-65527849944b8c220ee476a8dddd02e44a49448c.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","40249","-o","ConnectTimeout=15","google_colab_ssh"],"dataFilePath":"/home/andrew/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-google_colab_ssh-ea3859d4ba2f3e577a159bc91e3074c5d85c0523-0.63.0/data.json"}
[08:24:48.707] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/52/usr/share/code/code","VSCODE_SSH_ASKPASS_MAIN":"/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-3e872f41471ee8fc3c81a7c10c65bae4cacba06e.sock"}
[08:24:48.713] Spawned 17569
[08:24:48.798] > local-server> Spawned ssh: 17584
[08:24:48.801] stderr> OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
[08:24:49.120] stderr> 
[08:24:49.120] stderr> 
[08:24:49.121] stderr> 
[08:24:49.122] stderr> 
[08:24:49.124] stderr> 
[08:24:49.124] stderr> 
[08:24:49.125] stderr> 
[08:24:49.126] stderr> 
[08:24:49.127] stderr> 
[08:24:49.127] stderr> 
[08:24:49.127] stderr> ssh_exchange_identification: Connection closed by remote host
[08:24:49.128] > local-server> ssh child died, shutting down
[08:24:49.131] Local server exit: 0
[08:24:49.132] Received install output: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017

ssh_exchange_identification: Connection closed by remote host

[08:24:49.133] Stopped parsing output early. Remaining text: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017ssh_exchange_identification: Connection closed by remote host
[08:24:49.134] Failed to parse remote port from server output
[08:24:49.164] Resolver error: Error: 
	at Function.Create (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:64027)
	at Object.t.handleInstallOutput (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:62766)
	at Object.t.tryInstallWithLocalServer (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:405034)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async /home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:310329
	at async Object.t.withShowDetailsEvent (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:405790)
	at async /home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:403558
	at async S (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:400326)
	at async Object.t.resolveWithLocalServer (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:403185)
	at async Object.t.resolve (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:314332)
	at async /home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:127:110333
[08:24:49.171] ------

2. Connection using CLOUDFLARE and VSCODE:

Colab code
image

VSCode

  1. Add host to my VS Code remote config file. (Side-Question: Is it a problem that the host does not show up in the SSH targets?):
    image

  2. I downloaded this binary file...
    https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.tgz
    ... and save it in my user /home/.ssh/ path (as shown in the VScode config ->Host *.trycloudflare.com -> Proxycommand)

  3. Connect to colab (ctrl+shift+p -> connect to remote host):
    image

  4. vscode error:
    4a. VSCODE as non-root user:
    error message
    image
    error log

[08:51:55.389] Log Level: 2
[08:51:55.391] [email protected]
[08:51:55.391] linux x64
[08:51:55.392] SSH Resolver called for "ssh-remote+remain-michigan-desk-oakland.trycloudflare.com", attempt 1
[08:51:55.392] "remote.SSH.useLocalServer": true
[08:51:55.393] "remote.SSH.sshPath": undefined
[08:51:55.393] "remote.SSH.sshConfigurationFile": undefined
[08:51:55.393] "remote.SSH.useFlock": true
[08:51:55.393] "remote.SSH.lockfilesInTmp": false
[08:51:55.393] "remote.SSH.localServerDownload": auto
[08:51:55.393] "remote.SSH.remoteServerListenOnSocket": false
[08:51:55.394] "remote.SSH.showLoginTerminal": false
[08:51:55.394] SSH Resolver called for host: remain-michigan-desk-oakland.trycloudflare.com
[08:51:55.394] Setting up SSH remote "remain-michigan-desk-oakland.trycloudflare.com"
[08:51:55.397] Acquiring local install lock: /tmp/vscode-remote-ssh-remain-michigan-desk-oakland.trycloudflare.com-install.lock
[08:51:55.404] Looking for existing server data file at /home/andrew/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-remain-michigan-desk-oakland.trycloudflare.com-ea3859d4ba2f3e577a159bc91e3074c5d85c0523-0.63.0/data.json
[08:51:55.404] Using commit id "ea3859d4ba2f3e577a159bc91e3074c5d85c0523" and quality "stable" for server
[08:51:55.407] Install and start server if needed
[08:51:55.424] Checking ssh with "ssh -V"
[08:51:55.432] > OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017

[08:51:55.435] askpass server listening on /run/user/1000/vscode-ssh-askpass-6ce819e004400bc189715b4e75c815c723371b3e.sock
[08:51:55.436] Spawning local server with {"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-a166cce8f8c50af0589d3f74dbb93c41dbb37fe2.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","35555","-o","ConnectTimeout=15","remain-michigan-desk-oakland.trycloudflare.com"],"dataFilePath":"/home/andrew/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-remain-michigan-desk-oakland.trycloudflare.com-ea3859d4ba2f3e577a159bc91e3074c5d85c0523-0.63.0/data.json"}
[08:51:55.436] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/52/usr/share/code/code","VSCODE_SSH_ASKPASS_MAIN":"/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-6ce819e004400bc189715b4e75c815c723371b3e.sock"}
[08:51:55.439] Spawned 13594
[08:51:55.526] > local-server> Spawned ssh: 13604
[08:51:55.529] stderr> OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
[08:51:55.533] stderr> /bin/bash: /home/andrew/.ssh/cloudflared-stable-linux-amd64.tgz: Permission denied
[08:51:55.533] stderr> /bin/bash: line 0: exec: /home/andrew/.ssh/cloudflared-stable-linux-amd64.tgz: cannot execute: Permission denied
[08:51:55.533] stderr> ssh_exchange_identification: Connection closed by remote host
[08:51:55.533] > local-server> ssh child died, shutting down
[08:51:55.534] Local server exit: 0
[08:51:55.535] Received install output: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
/bin/bash: /home/andrew/.ssh/cloudflared-stable-linux-amd64.tgz: Permission denied
/bin/bash: line 0: exec: /home/andrew/.ssh/cloudflared-stable-linux-amd64.tgz: cannot execute: Permission denied
ssh_exchange_identification: Connection closed by remote host

[08:51:55.545] Resolver error: Error: Permission denied
	at Function.Create (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:64027)
	at /home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:62260
	at Object.t.handleInstallOutput (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:62543)
	at Object.t.tryInstallWithLocalServer (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:405034)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async /home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:310329
	at async Object.t.withShowDetailsEvent (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:405790)
	at async /home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:403558
	at async S (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:400326)
	at async Object.t.resolveWithLocalServer (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:403185)
	at async Object.t.resolve (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:314332)
	at async /home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:127:110333
[08:51:55.550] ------

NOTE: In this case VSCODE does not have enough rights to execute the Binary

4b.VSCODE as ROOT user
sudo code --user-data-dir=/home/andrew/.ssh
errormessage
image
error log

[08:57:55.324] Log Level: 2
[08:57:55.326] [email protected]
[08:57:55.326] linux x64
[08:57:55.327] SSH Resolver called for "ssh-remote+remain-michigan-desk-oakland.trycloudflare.com", attempt 1
[08:57:55.328] "remote.SSH.useLocalServer": true
[08:57:55.328] "remote.SSH.sshPath": undefined
[08:57:55.328] "remote.SSH.sshConfigurationFile": undefined
[08:57:55.328] "remote.SSH.useFlock": true
[08:57:55.328] "remote.SSH.lockfilesInTmp": false
[08:57:55.329] "remote.SSH.localServerDownload": auto
[08:57:55.329] "remote.SSH.remoteServerListenOnSocket": false
[08:57:55.329] "remote.SSH.showLoginTerminal": false
[08:57:55.329] SSH Resolver called for host: remain-michigan-desk-oakland.trycloudflare.com
[08:57:55.329] Setting up SSH remote "remain-michigan-desk-oakland.trycloudflare.com"
[08:57:55.333] Acquiring local install lock: /tmp/vscode-remote-ssh-remain-michigan-desk-oakland.trycloudflare.com-install.lock
[08:57:55.341] Looking for existing server data file at /home/andrew/.ssh/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-remain-michigan-desk-oakland.trycloudflare.com-ea3859d4ba2f3e577a159bc91e3074c5d85c0523-0.63.0/data.json
[08:57:55.342] Using commit id "ea3859d4ba2f3e577a159bc91e3074c5d85c0523" and quality "stable" for server
[08:57:55.345] Install and start server if needed
[08:57:55.349] Checking ssh with "ssh -V"
[08:57:55.370] > OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017

[08:57:55.375] askpass server listening on /tmp/vscode-ssh-askpass-03c3e5f506d14ea2ee01ead9b773c0d05db36f37.sock
[08:57:55.375] Spawning local server with {"ipcHandlePath":"/tmp/vscode-ssh-askpass-9f1e333425e614ed199829cf5477ed84315d72e8.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","42249","-o","ConnectTimeout=15","remain-michigan-desk-oakland.trycloudflare.com"],"dataFilePath":"/home/andrew/.ssh/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-remain-michigan-desk-oakland.trycloudflare.com-ea3859d4ba2f3e577a159bc91e3074c5d85c0523-0.63.0/data.json"}
[08:57:55.375] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/52/usr/share/code/code","VSCODE_SSH_ASKPASS_MAIN":"/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/tmp/vscode-ssh-askpass-03c3e5f506d14ea2ee01ead9b773c0d05db36f37.sock"}
[08:57:55.379] Spawned 27067
[08:57:55.463] > local-server> Spawned ssh: 27085
[08:57:55.466] stderr> OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
[08:58:12.381] Terminating local server
[08:58:12.409] Resolver error: Error: Connecting with SSH timed out
	at Function.Timeout (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:64156)
	at Timeout._onTimeout (/home/andrew/.vscode/extensions/ms-vscode-remote.remote-ssh-0.63.0/out/extension.js:1:280517)
	at listOnTimeout (internal/timers.js:531:17)
	at processTimers (internal/timers.js:475:7)
[08:58:12.412] Local server exit: 15
[08:58:12.417] ------

3. Connection with Cloudflare and SSH-tunnel:

1a. Binary file without execution rights and not owned by $USER:
image
1b. Binary file with execution rights and owned by $USER:

chmod +x cloudflared-stable-linux-amd64.tgz
sudo chown -R $USER  cloudflared-stable-linux-amd64.tgz

image

Quetion:

  • Does this help trouble shoot the problem?
  • Should I provide more information?
  • Have your tried your connection on a FREE colab version?

Thanks alot in advance!!

from colab-ssh.

WassimBenzarti avatar WassimBenzarti commented on May 22, 2024

Thank you @PatternAlpha for the detailed explanation. I am glad you resolved your issue :)

from colab-ssh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.