7
$\begingroup$

I have both v9 and v10 currently installed on my computer (Windows 7). For reasons that are not entirely clear, if I create a new remote kernel in one version, it is accessible to the other; however, there are differences. Note the following screen shot:

enter image description here

The picture above shows the kernel properties for the same kernel connection when viewed in v9 (left) or v10 (right). The results are the same regardless of whether I initially create the new kernel connection in v9 or v10. Note that the shell commands are different for the two versions:

v9

"java" -jar "mathssh" pi@raspilab wolfram -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "linkname" -LinkHost ipaddress

v10

"java" -jar "wolframssh" pi@raspilab wolfram -wstp -LinkMode Connect -LinkProtocol TCPIP -LinkName "linkname" -LinkHost ipaddress

The problem is: the remote kernel works properly in v9 but not v10. In v10, I get the error message "SSH's connection for kernel 'rpi_kernel' was unexpectedly terminated. Error code = 103."

I don't believe this is a known hosts problem. Removing the known_hosts file does not change the behavior in v10 (it still throws the 103 error) but causes v9 to request that the new host be added and the known_hosts file be created. No wolfram processes are currently active on the RPi and I have turned off my VPN to avoid a previous problem. If I use the advanced options to force the v10 Shell command to look like that for v9, I get the same 103 error code. If I do the reverse, and use the v10 command in v9, I get an Error code = 1 for which there seems to be no good solution.

Some additional debugging information:

  • Based on the speed at which the 103 error is returned, I suspect that v10 is not even attempting to connect to the RPi kernel.
  • Using the RPi's IP address instead of its hostname does not alter the results.

Does anyone have any insight into resolving this problem?

$\endgroup$
6
  • $\begingroup$ Have you tried using a different ssh binary instead of wolframssh (probably needs to be specified with the full absolute path? $\endgroup$
    – shrx
    Dec 20, 2014 at 20:09
  • $\begingroup$ @shrx a good suggestion and I will try that soon. I did try the complete v9 command but since I didn't put a full path in, there's no reason to think it would have worked properly. $\endgroup$ Dec 21, 2014 at 4:38
  • $\begingroup$ @shrx no luck. I can substitute the full path of wolframssh in the v9 kernel configuration; but the same does not hold true for v10 (either the path of the v10 wolframssh or the v9 version of the jar file) $\endgroup$ Dec 21, 2014 at 15:19
  • $\begingroup$ The wolframssh.jar file in 10.0.1 and 10.0.2 is broken. I can't tell from your last comment if you tried using the v9 version of wolframssh with a v10 kernel, but that method works with my windows 8 machine. Also, you could try doing simpler commands (e.g., pwd, ls) to help with debugging: Run["java -jar pathto/WolframSSH.jar pi@raspilab pwd"] $\endgroup$
    – ChadK
    Dec 22, 2014 at 15:14
  • $\begingroup$ @chadk Thanks for the comment. I'll spend some more time trying the v9 wolframssh with v10 now that I know someone has gotten that to work. $\endgroup$ Dec 22, 2014 at 19:43

1 Answer 1

5
$\begingroup$

The WolframSSH.jar file in 10.0.1 and 10.0.2 is broken. In fact, WolframSSH.jar has not accepted alternate locations for the keyfile locations (and I don't know what the default directories are that it searches) since before version 8.

So there are 2 possible solutions. One is to use the v9 version of WolframSSH.jar. The other (and the one I recommend) is to install cygwin and use its ssh (which will have a path like c:\cygwin64\bin\ssh).

Mathematica 10 has new process functions that can be used to test connections to remote machines. To test an ssh connection, you could try this:

process = StartProcess[$SystemShell];
cmd = "\\cygwin64\\bin\\ssh me@machinename ls";
WriteLine[process, cmd]
ReadLine[process] (* evaluate this multiple times to see line by line output *)

Import could also be used here (and for this case is much simpler):

Import["!" <> cmd, "Text"]

The StartProcess function is more useful when linking to a kernel. Here is some code that I've used to launch a remote kernel and perform evaluations:

Preliminaries (note that my math script is in my path, so I don't give full path in mathl function):

    mathl[link_] := 
  "math -mathlink -linkmode Connect -linkprotocol TCPIP -linkname "<>link <> " -subkernel -noinit &< /dev/null &";
    machine = "mymachine";
    link = LinkCreate[LinkProtocol -> "TCPIP"];
    linkname = First@link;
    cmd = "\\cygwin64\\bin\\ssh " <> $UserName <> "@" <> machine <> 
       " \"" <> mathl[linkname] <> "\"";

Processes:

process = StartProcess[$SystemShell];
WriteLine[process, cmd];

That should have launched a remote kernel. You can check with ps, taskmanager, etc. Better yet, try to communicated with the remote kernel:

LinkWrite[link, Unevaluated@{$MachineName, Now}];
In[150]:= LinkRead[link]
Out[150]= InputNamePacket["In[1]:= "]
In[151]:= LinkRead[link]
Out[151]= ReturnPacket[{"mymachine", DateObject[{2015, 2, 9}, TimeObject[{14, 55, 49.3625}, TimeZone -> -6.], TimeZone -> -6.]}]

Finally, close the link and the process:

LinkClose[link]
KillProcess[process]
$\endgroup$
3
  • $\begingroup$ Do you happen to know if WolframSSH.jar is still broken in newer versions of MMA and whether this is a Windows only issue? $\endgroup$ Oct 31, 2015 at 13:09
  • 1
    $\begingroup$ I apologize for taking so long to respond. I really don't know the answer to either with certainty. I find that using the ssh with cygwin works nicely for me. I cannot get WolframSSH.jar to work correctly [yet!]. If I find a way to make it work, I'll post here. Note: I'm using 10.3 $\endgroup$
    – ChadK
    Nov 13, 2015 at 22:26
  • $\begingroup$ no problem, thank you for your response. $\endgroup$ Nov 14, 2015 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.