Eclipse unable to connect to remote Linux via SSH - linux

I am trying to set-up Eclipse on Windows to build and debug a C application on an i.MX6 eval kit running Yocto Linux. When I try to connect either via the debugger or via the Remote System Explorer I get the following error:
Could not open connection.
Reason: Algorithm Negotiation fail
I can connect to the board via Tera Term using SSH and port 22, so it seems like GDB server is running, but there is some incompatibility between Eclipse SSH and Linux SSH. I've seen several posts about this, but most of them are years old, and no longer apply. I tried changing the connection settings in Eclipse, but nothing I have tried seems to work.
How do I configure Eclipse, or Yocto Linux, to allow them to communicate?

Related

How to debug remote Python script in VS Code

I am doing Python development in Raspberry Pi. I have installed VS Code in my laptop and have installed the ssh extension. Using this I can easily connect to Raspberry Pi. While I am connected I can see that VS Code has also loaded the Python interpreter of Raspberry Pi. I can run my Python script from within the vs code but when I tried to debug the code, nothing happens.
Is it possible to remotely debug the Python script from laptop to Raspberry Pi? How can I enable this?
I have resolved this issue. If anyone wants to do remote development and debugging, follow below steps:
Install remote ssh extension in VS code
Once installed, you will find a green icon on the bottom left corner in vs code which allows us to connect to the remote machine.
Connect to the remote machine using the standard ssh command. Alternatively, you can use ssh-keygen to generate a public-private key if you don't want to use the password at every prompt.
Once you are connected to remote machine, you can open the file explorer and create any python file. When you will save this, it will get saved in your remote machine. This way you are using your machine to remotely develop code on another remote machine.
Good thing about vs code is that it selects the remote machine's python interpreter so all the packages which you have installed on your remote machine will work with IntelliSense.
In order to debug the code, we will use debugpy. Install this on both machine (remote & local)
On your remote machine, run below command:
python3 -m debugpy --listen 1.2.3.4:5678 --wait-for-client app.py
here 1.2.3.4 is the IP of remote machine. This will start a remote debugger which will wait for a clients connection.
On your local machine, in VS code open Run & Debug, add a configuration of Python: Remote Attach. Make sure that launch.json has the host as the IP of your remote machine and port as 5678.
Now start debugging as normal and you will notice the code will break at first breakpoint and from here you can proceed normally as we used to do in local debugging process.
TBH, this is best feature VS code has because most of the software allows you to do remote development which is nothing but just a normal SSH but remote debugging gives you more control. I was doing some python project on Raspberry Pi and obviously cannot install VS code or pycharm on it. But with this feature now I can easily develop the code using Pi's python interpreter and debug it as well.
If anyone is having any issues, let me know. Happy to help.

Remote System Development Eclipse - Build, Debug and Run from remote Linux machine

I have the following:
1) Windows machine with Eclipse CDT (Currently Luna v4.4.1)
2) A Linux machine that has the repository with code and the Linux GCC, make etc..
I want to connect to the Linux via Remote System Explorer in Eclipse, edit, build, debug and run all from the Windows machine in Eclipse.
I have been successful in setting up the SSH connection and in the project explorer, I can access the remote repository and edit the code.
The issue I am having is building, debugging and running it.
How can I let eclipse know I want to compile it remotely? The Project -> Build functionality is blocked out when attempting for the remote repository. It only allows it for local repo's. But I already have an SSH connection.. Is there not a way for it to know that I want to use the remote GCC too?
Also, for debugging, in the Debug configuration it seems to want a local version of the build, even though I selected remote debugging.
Sorry I don't have any error logging to report as i'm just struggling on the first bit of how I go about doing the remote build in the IDE.
Maybe this is not possible?

remote command on windows from linux

I want to run windows command on windows 2003 server from RHEL machine.
I tried one way to do it using winexe and it is working as expected. However to do this one I have to keep 139 port open and apparently this is a very vulnerable port and is advised not to be kept open.
One other way I found was to use cygwin and open ssh packages but these are again not supported in windows 2003 server.
Can anyone please suggest me any other way leaving these 2 to connect linux and windows machine and run command on cmd.exe from linux terminal.
You can emulate the whole Windows on RHEL using the Wine software. So you won't need to connect anywhere.
Other option is to connect from RHEL to Windows 2003 Server via an SSH.
Installing of an OpenSSH server on Windows has a couple of quirks:
in Windows settings you have to allow your account to run services
in the sshd config file of the OpenSSH server you have to set the StrictModes option to no, so you can use the SSH authentication by public/private keys

SSH into raspberry pi

I have a question regarding SSH. For school assignments, I always write code on my mac then transfer it over on my raspberry pi to make sure it will compile correctly without errors as they are tested on the pi and sometimes when I transfer it has errors.
To avoid hassle of connecting everything to the pi, if I SSH into the pi, then compile my program from my mac, would it use the raspberry pi compiler?
If you are connected vi ssh and issuing the commands in that terminal session, yes, it's going to use the compiler on the pi.
A better option, and more educational, might be to cross-compile the code for the pi on your mac. You can leverage the much greater processing power of the desktop to significantly reduce your compile time.
Cross Compiling on Mac OSX for Raspberry Pi
Yes it would remotely access the host's OS (in your case the RPi) to perform the compilation.
Here is a guide to get you started:
https://www.modmypi.com/blog/remotely-accessing-the-raspberry-pi-via-ssh-console-mode
Also, in case you want a remote desktop connection, on your raspberry pi enter the following command:
sudo apt-get install xrdp
providing you've already updated and upgraded your package libraries ;)
Yes, If you are using ssh and writing code in that terminal session then the code will be compiled in the pi, it is the best way to do so.
Issuing command in the terminal session via SSH (laptop connected with Raspi), compilation will be done at Raspi. PuTTY is a very useful tool for this, you just need to enable SSH at Raspi and input your IP address at PuTTY only! Click to the PuTTY website http://www.putty.org/ and download it.
Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. The best-known example application is for remote login to computer systems by users.
When you connect to any remote system or server via ssh you are using the same system via command prompt. So, if you do any work via SSH the compilation will be done by the remote system.

Raspberry PI remote debug GTK error

I'm using NetBeans IDE 8.0.2 on my Win7 machine to develop Raspberry Pi opencv C++ application.
I'm building & debugging the application remotely on the Raspberry Pi from my Win7 machine.
At run time the application fails with "Gtk-WARNING **: cannot open display:" error when reaches the line:
imshow("source", src);
When I'm running the exact same application from the Raspberry Pi and not remotely via SSH everything works as expected.
Is there any way that I can configure NetBeans to open GTK windows at the Raspberry Pi?
The solution is to add DISPLAY=:0 Environment variable.
At File menu select Project Properties (yourprojectname) to open Project Properties window.
At Categories: click Run and then click Environment, add variable name DISPLAY with value :0
Good luck
I haven't actually tried this with the Rasberry Pi, but assuming it is like other linux systems perhaps this will get you started.
To have the Gtk program display on your windows system will need a version of X Windows ( the linux/unix graphics server) for Windows the operating system. You can get it as one of the packages in Cygwin. (http://x.cygwin.com/) Get cygwin https://cygwin.com/index.html during setup select the xinit package. You also either need to enable port-forwarding in ssh or set the DISPLAY variable on the Rasberry Pi to your windows host:0.
To have the Gtk program display on the Rasberry Pi when started from Windows you just need to allow remote hosts to open windows.
Try the command :
xhost +
in the Rasberry Pi shell before trying to have the program started from windows.
Another option would be to start the program on the Rasberry Pi with gdbserver and then attach to the already running program with Netbeans.
You will need to install the gdbserver plugin for Netbeans.
An alternative to getting the X window manager working on Windows would be to get a remote desktop running on both machines. VNC is a popular client and server for this. This would allow you to run the window for Netbeans and use the system as if it were your desktop from another location.
There is even a download specifically for Raspberry pi here:
https://www.realvnc.com/download/vnc/latest/

Resources