Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Frequently Asked Questions

Tomohiro edited this page May 4, 2021 · 7 revisions

FAQ:

Google colab disconnected before or right after remocolab.setupVNC done

I don't know why, but sometimes colab disconnects after running a cell about 5 minutes. Please try following Python code on new cell on google colab without running remocolab. It prints elapsed time every 10 seconds.

import time

begin = time.time()
for i in range(30 * 6):
  time.sleep(10)
  print(time.time() - begin)

If you get disconnected within 10 minutes, it is the problem of google colab, not remocolab. If colab didn't disconnected when running above code but disconnected when running remocolab, please report the issue.

I don't like to copy & pasting ngrok token everytime I use remocolab.

You don't need to do that if you use Argo Tunnel instead of ngrok. Read README.md for more details.

ngrok token must be kept secret. If you can specify ngrok token to remocolab.setupSSHD() or remocolab.setupVNC(), you can save ngrok token to a notebook. Then, you might forget that your notebook contains it and share the notebook. I don't know how to skip it without risking a security.

I got SSH connection timeout

Settting ServerAliveInterval ssh client option to some value might keep ssh connection alive. You can add -o ServerAliveInterval=60 option to the SSH command or edit ssh config file. For more details: https://unix.stackexchange.com/questions/3026/what-options-serveraliveinterval-and-clientaliveinterval-in-sshd-config-exac

How to get SSH client on Windows?

  • If you are using Windows 10 or Windows Server 2019, you can use OpenSSH in Windows.
  • You can also install ssh using scoop package manager.
scoop install openssh

I pasted displayed password to login to the SSH server but failed

By using public key authentication, you can login to ssh server without copy&pasting a password: https://github.com/demotomohiro/remocolab#how-to-use

How to become root?

You can login as root using public key authentication: https://github.com/demotomohiro/remocolab#how-to-setup-public-key-authentication-for-root-login Or use su or sudo command.

I got error while running remocolab.setupVNC() or remocolab.setupSSHD()

When you got error and want to rerun remocolab.setupVNC() or remocolab.setupSSHD(), you need to do factory reset runtime before rerun the command. As you can run only 1 ngrok process with free ngrok account, running remocolab.setupVNC/setupSSHD will fail if there is another instace that already ran remocolab. In that case, terminate another instance from Manage sessions screen.

When I tried to connect to TurboVNC server, I got error: Failed to connect to server(localhost:1)

You need to run the ssh command displayed by remocolab and login to the server to make local port forwarding.

I connected to the VNC server and see the desktop screen but it doesn't respond mouse and keyboard.

remocolab.setupVNC() show 2 VNC passwords and second one is view only password.

For example:

VNC password: xxxxxxxx
VNC view only password: yyyyyyyy

You can control the destkop if you login to VNC with first VNC password. If you use second password to login, you can see the destkop but cannot control the desktop.

Can I use other than ngrok or Argo Tunnel?

remocolab can use only ngrok and Argo Tunnel without modifying code. I wrote a code that setup SSH server and uses serveo. https://github.com/demotomohiro/Google-Colaboratory-SSH-samples/blob/master/src/ssh_serveo.ipynb

I want to use program XYZ

You can install softwares by adding install commands after remocolab.setupVNC() or remocolab.setupSSHD(). For example:

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

#Install anything you want quietly
!apt-get install -qq -o=Dpkg::Use-Pty=0 neovim tmux > /dev/null

#Run commands as colab user
import pathlib, subprocess
pathlib.Path("prepair.py").write_text("""\
import pathlib
from subprocess import run

run(["git", "clone", "https://github.com/nim-lang/Nim.git"], cwd = pathlib.Path.home())
run(["sh", "build_all.sh"], cwd = pathlib.Path.home() / "Nim")
""")

subprocess.run(
               ["su", "-c", "python3 prepair.py", "colab"],
               check = True)

How to reduce lag?

Following methods require changing remocolab's code.

  • Find ngrok alternative that is faster than ngrok.

You will find web sites that explains these services when you google "ngrok alternative". You need to modify some code in remocolab to use it.

  • Run your own ngrokd server.

https://github.com/inconshreveable/ngrok/blob/master/docs/SELFHOSTING.md

  • Buy Google Cloud, AWS, Azure or other cloud servers and setup VNC on it

You will get less lag because you can access them without ngrok. remocolab doesn't work on them because it is designed to work only for Google colab. Setup ssh or VNC would be not hard without scripts like remocolab.

How restart SSH server?

service ssh restart

How to change VNC desktop size?

Open TurboVNC Viewer Options, click Connection tab and set Remote desktop size.