Remote Development with NSight 6.5 with "indirect" ssh - eclipse

Suppose I can log in to a gpu sever named gpu1.sp.sw, and there are gpu2.sp.sw and gpu3.sp.sw to which I cannot log in directly but can be reached by ssh gpu-2, ssh gpu-3, after I am already on gpu1.sp.sw.
My question is: If I want NSight 6.5 to run and debug remotely on gpu-2 or gpu-3, how can I do it?

As workaround you can use ssh tunnels: run something like
ssh gpu1.sp.sw -L2202:gpu2.sp.sw:22 -L2345:gpu2.sp.sw:2345 -nNT
in background console. Then configure NSight remote debugging to connect to server localhost, ssh port 2202 and cuda-gdbserver port 2345.

Related

vscode remote ssh connection cannot connect on windows server 2022

I'm trying to setup Remote SSH extension on vscode to connect to a server that runs Windows Server 2022.
First, I can connect with SSH from the terminal ssh username#public_ip -p port then I enter the password and I can access the server.
I installed the Remote - SSH extension on vscode. I was able to connect to a Raspberry Pi without problems... But I cannot connect to a Windows Server 2022.
It asks me to enter the username password twice, then after a few seconds it stops with two errors pop-ups (see picture below).
Could not fetch remote environment
Failed to connect to the remote extension host server (Error: WebSocket close with status code 1006)
errors
Also, from another machine. I can connect to my server with vscode and the same extension (Windows Server 2022) without any problems so I don't think that the server has any issues. Seems like the problem is on my computer that won't connect.
I was able to connect once but I did break something and I don't know what. I tried to reinstall the extension but nothing helped.
EDIT:
I think I fixed it.
Here's what I did.
I uninstalled the Remote - SSH extension
I opened the settings.json on my local computer and deleted everything that had to do with this extension.
Deleted the config file from C:\Users\username\.ssh\config
I restarted vscode
Installed the extension
And it worked.

VSCode remote debugging on NextCloudPi not working because SSH connection failed

Not really a question but already the answer. Just to save others from spending days on this task.
What I want to do
I want to extend the basic NextCloudPi image with some custom websites including PHP. For ease use of remote debugging I am using VSCode and Xdebug.
The Problem was
I can't get a SSH connection to my raspi from VSCode and therefore also PHP debugging didn't work. SSH connection to the raspi worked well with other tools (putty, PowerShell etc.). Also Xdebug was set properly on the raspi (according to phpinfo();). In the log of the ssh-plugin of VSCode the following error appeared:
Failed to set up socket for dynamic port forward to remote port 37399: Socket closed. Is the remote port correct?
Relevant Versions
NextCloudPi 1.36.3
Xdebug 3.0.4
VSCode 1.60.2 (RemoteSSH 0.65.8, PhpDebug 1.19.0)
The Solution is
After spending evenings of googling I found out that the TCP port forwarding of the raspi's SSH service has to be enabled which is not in the basic nextcloudpi-image. This thread gave me the final clue: VSCode Remote SSH Connection Failed
So just set in /etc/ssh/sshd_config AllowTcpForwarding to yes and everything should work as easy as described in all the manuals.

Access guest from virsh

I am running Centos 7 x86-64. I installed a guest (again Centos 7) through kickstart as an exercise. I prepared my kickstart file, I validated it and I launched with virt-install.
If something went wrong with the network configuration (During install I got no problem, I created a local repo on Host FTP server as source for the install) how can I connect to the machine?
Only SSH or virsh foresee some other connection method?
How can I find my machine running network configuration from outside?
I am running a barebone Centos7 installation so only command line, no graphical interface at all.
Thanks,
M.
You can ssh to your physical host from another one having graphical interface with X forwarding enabled (ssh -X machinename), and look at the the VM with virt-manager
You will need X running on the machine you're connecting from. For Mac OS it's XQuartz

How to set nodejs debug mode don't listen 127.0.0.1

I want to remote debug the nodejs program in Eclipse. I start the node script with the debug option.
$node debug script.js
But I can't connect to the node in Eclispe. When I netstat the node's TCP port. I found that node only listen 127.0.0.1 in debug mode. So I can't connect it from different computer.
But I can't find any startup options that can change to listen to any address.
Anyone know to make it listen to any address to remote debug in other computer?
if anyone else stumble upon this: you can set the node debug to any address as you set the port
node --debug=169.168.1.2:5858 app.js
if that would be the ip of your remote machine or even better to every machine
node --debug=0.0.0.0:5858 app.js
but please be aware that the 2nd option should only be used if you are debugging in your own private network as you open it up for everyone
This is what I do in linux Debian:
install balancer
sudo apt-get install balance -y
then create a route in balancer to reroute your 5858 port to 5859
balance 5859 127.0.0.1:5858
start your app
node --debug app.js
now you can access it from everywhere on port 5859
I'm looking into V8 code that goes through deps/v8/src/debug-agent.* down to deps/v8/src/platform-posix.cpp (for linux) to POSIXSocket::Bind method and it can't seem to have any option about this (unless I'm missing something).
I bet you either hack it and recompile node or you'll need to build a small proxy beside your node process.
Here's a great tut on debugging nodejs from eclipse. Note at the bottom there is a script the author uses to forward localhost:5858 to the remote server's 127.0.0.1. You could also just use an SSH tunnel.
So, to summarize:
start your script with node --debug app.js
configure eclipse as if you were debugging locally
use the node_g script or configure an SSH tunnel
go on vacation now that your code is bug-free
to debug nodejs remotely over SSH session do:
1. install balance on Linux: https://balance.inlab.net/overview/
2. run the command: balance -df 8585 127.0.0.1:5858 > /tmp/balance.out 2>&1 &
3. ssh to your remote Linux box (tunnel will be created 8585 > 5858 > nodejs)
4. run your node script on server: node --debug-brk --nolazy ./myNodeApp.js
5. kick off debug session in WebStorm alt-d to port 8585
now you are remote debugging securely over SSH session

Running a GTK+ application on a Linux machine, from Windows

I have Installed GTK on a Linux machine.
I am connecting To Linux Machine from a Telnet Session to compile the GTK programs
From A Windows Machine. I am using Cygwin on Windows Machine. but i am not able to see
GUI output of my GTK program on my Windows Machine.
When i run program from my terminal i get this error:
(helloworld:22576): Gtk-WARNING **: cannot open display:
I tried solutions from every answer posted, but no use now i am getting following error:
$ ./helloworld
Invalid MIT-MAGIC-COOKIE-1 key
(helloworld:22710): Gtk-WARNING **: cannot open display: 172.25.0.161:0
and i am getting following error on my Cygwin console:
client 6 rejected from IP 172.25.0.91 Auth name: MIT-MAGIC-COOKIE-1 ID: -1
You must set the DISPLAY variable in your telnet session to the IP address or DNS name of your Windows machine and append ":0"
export DISPLAY=windows.your.domain:0
And you must start an X server on the Windows machine (comes with Cygwin but you must start it).
You need to run the X window system (install with Cygwin) on your Windows-box and enable remote connections (probably with xhost). Set the DISPLAY-variable on your Linux-box to the address of your Windows-box and :0, as such:
export DISPLAY=192.168.1.123:0
I can recommend using ssh rather than telnet, for security reasons. In this case you do not need to enable remote connections with xhost, and you do not need to set the DISPLAY-variable. You only need to enable X forwarding.
You should install X-server on your windows machine and make sure you have DISPLAY set to yourmachine:0 or something like that. Or better yet use ssh instead of telnet (e.g. putty) and tunnel your X connection. You'll have to do a bit on your own research, though, because the complete answer would be a lengthy one.
Install an small X server on Windows XMing32, then run it, use putty as a console client, and check "X11 Forwarding" in Connection->SSH->X11.
Unfortunately, X11 Forwarding is not available through Telnet, you must run a SSH server on the target Linux and connect through SSH. (See if /etc/ssh/sshd_conf requires enabling X11 Forwarding too).