bopen / c3s-eqc-toolbox-template

CADS Toolbox template application
Apache License 2.0
6 stars 4 forks source link

How to reconnect to Virtual Machine if "address is already in use"? #144

Closed yoniv1 closed 8 months ago

yoniv1 commented 8 months ago

Hi,

I was working on the Jupyter Notebook on the VM and got internet connection issues. When I tried to reconnect it didn't work anymore and can't reach the server:

Last login: Fri Mar 29 16:31:36 on ttys001 yoniverhaegen@Yonis-MacBook-Pro ~ % ssh -N -f -L localhost:5678:localhost:8889 eqcuser@136.156.154.152 Enter passphrase for key '/Users/yoniverhaegen/.ssh/id_rsa': bind [127.0.0.1]:5678: Address already in use channel_setup_fwd_listener_tcpip: cannot listen to port: 5678 Could not request local forwarding.

How can I solve this? I tried

(wp5) (BO)quality.shared.cds [wp5@eqc-quality-tools verhaegen_yoni]$ jupyter lab stop 8889 [JupyterServerStopApp] Shutting down server on 8889...

But also didn't work.

Thanks

malmans2 commented 8 months ago

bind [127.0.0.1]:5678: Address already in use

This means that you have a process already using that port (it's your job before the connection issue). If you don't have any other ssh connection open, you can just kill all ssh connections:

pkill ssh

Otherwise, you can find the PID using that port with this command:

ps aux | grep 5678

The number in the second column is the PID you need to kill (kill PID)

After doing it, if you try again the usual commands to connect to the VM everything should work.

yoniv1 commented 8 months ago

Thanks Mattia! Can be closed.