Skip to content

Windows host file not updating when attempting SSH #137

Open
@MarkEdmondson1234

Description

@MarkEdmondson1234

Hi all, I've also been struggling with this issue while trying to set up a VM cluster using gce_vm_cluster and unfortunately the solutions suggested both here and in #32 have not been working.

Here is how my gce_vm_cluster is set up:

ssh <- list(
  "username" = "crayn",
  "ssh_overwrite" = FALSE,
  "key.pub" = file.path("C:","Users", "crayn", ".ssh", "id_rsa.pub"), 
  "key.private" = file.path("C:","Users", "crayn", ".ssh", "id_rsa")
)

vms <- gce_vm_cluster(
  vm_prefix = "attempt25-", 
  cluster_size = 1,
  docker_image = "rocker/r-parallel", 
  ssh_args = ssh,
  project = gce_get_global_project(), 
  zone = gce_get_global_zone()
)

I've gone through all the suggestions both here and in #32, but am getting the following error message:

2019-06-08 18:35:31> # Creating cluster with settings: template = r-base, dynamic_image = rocker/r-parallel, wait = FALSE, predefined_type = n1-standard-1
2019-06-08 18:35:34> Operation running...
2019-06-08 18:35:37> Operation running...
2019-06-08 18:35:43> Operation complete in 6 secs
2019-06-08 18:35:44> attempt24-1 VM running
2019-06-08 18:35:44> # Setting up SSH:username = crayn,ssh_overwrite = FALSE,key.pub = C:/Users/crayn/.ssh/id_rsa.pub,key.private = C:/Users/crayn/.ssh/id_rsa
2019-06-08 18:35:44> Using ssh-key files given as C:/Users/crayn/.ssh/id_rsa.pub / C:/Users/crayn/.ssh/id_rsa
2019-06-08 18:35:52> Public SSH key uploaded to instance
2019-06-08 18:35:52> # Testing cluster:
Failed to add the host to the list of known hosts ('C:\\Users\\crayn\\AppData\\Local\\Temp\\RtmpkP30Ts/hosts').
GetConsoleMode on STD_INPUT_HANDLE failed with 6

My session then hangs for several minutes until it times out, although it does creates the VM in my GCP Console.

After doing some investigation with trace, the problem seems to isolate to gce_ssh_addkeys > do_system > system2

It tried running the same arguments through system2 verbosely:

`test_cmd <- "ssh"`
`test_sargs <- c(
  "-v", 
  "-o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile='C:\\Users\\crayn\\AppData\\Local\\Temp\\RtmpkP30Ts/hosts'", " -i ", 
  "'C:\\Users\\crayn\\.ssh\\id_rsa'", "[email protected]", "\"echo attempt25-1 ssh working\""
)
system2(test_cmd, args = test_sargs, wait = TRUE, stdout = "", stderr = "")

This produced the following readout:

OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Connecting to 35.203.124.94 [35.203.124.94] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\crayn/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\crayn/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\crayn/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\crayn/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\crayn/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\crayn/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\crayn/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\crayn/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\crayn/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\crayn/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.5
debug1: match: OpenSSH_7.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 35.203.124.94:22 as 'crayn'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: one
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-ed25519 SHA256:fJX2gVMR82gN6SlA2BCwZvvwmbt7JlRQc/Xa1+LK/fU
Failed to add the host to the list of known hosts ('C:\\Users\\crayn\\AppData\\Local\\Temp\\RtmpkP30Ts/hosts').
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:R2VhkqCUoT7Clr2qCBH3dC6AFD/4eUJopH2q3szWWMY C:\\Users\\crayn\\.ssh\\id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering public key: RSA SHA256:1GPFycnKhdNiG1HhPpxxc+fmY1oIkRSDF6Dfu7Bg5kk C:\\Users\\crayn/.ssh/id_rsa
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
debug1: Authentication succeeded (publickey).
Authenticated to 35.203.124.94 ([35.203.124.94]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending command: echo attempt25-1 ssh working
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
GetConsoleMode on STD_INPUT_HANDLE failed with 6
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0

It seems to me that the problem has something to do with writing to the "hosts" file. Do you have any suggestion to resolve this?

Originally posted by @camraynor in #35 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions