[MCOL-566] script remote_command.sh doesn't work on SUSE Created: 2017-02-13  Updated: 2023-10-26  Resolved: 2017-09-08

Status: Closed
Project: MariaDB ColumnStore
Component/s: ?
Affects Version/s: 1.1.0
Fix Version/s: 1.1.0

Type: Bug Priority: Minor
Reporter: David Hill (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

SUSE 12


Sprint: 2017-02

 Description   

when remote_command.sh script would has not running and it was timing out.
This was running on SuSe 12 node.
Here is an example of the command:

./remote_command.sh 172.30.0.57 'pasword' pwd 1

The issue is this line, which needs to be removed

expect -re

{[$#] }

Its was waiting for a command line prompt of $ or #. but it wasnt seeing that, so the command would timeout...



 Comments   
Comment by David Hill (Inactive) [ 2017-02-13 ]

1 line fix committed to develop...

to test, run :

./remote_command.sh 'server' 'password' pwd 1

and make sure it returns with home directory

Comment by Daniel Lee (Inactive) [ 2017-02-13 ]

I commented that line out and it continue to execute my script. I could see the correct results from the script on the screen, but it is returning back to the calling script.

I noticed there are few more of the 'expect -rs' commands further down in the script. Do we need to modify these too?

The user I am using is guest (for not root installation tests) and the system prompt ends with "~>"

Comment by David Hill (Inactive) [ 2017-02-13 ]

good catch these should also be removed..

Comment by David Hill (Inactive) [ 2017-02-13 ]

addition prompting wait lines removed..

Comment by Daniel Lee (Inactive) [ 2017-02-14 ]

By removing the "expect -re " command, the remote-command.sh will not have an exit point, except when it times out.

Comment by David Hill (Inactive) [ 2017-02-14 ]

Correct, we need either have it this way or code for every different type of command line prompt tasty is possible.. that is the hard part.. as we found with suse, they were different than centos.

Comment by David Hill (Inactive) [ 2017-02-14 ]

With the current way, it will always work but will be slower waiting for the timeout.

Comment by David Hill (Inactive) [ 2017-02-14 ]

in develop branch...

I added back in the checking for command line prompts as a end of command, so its faster and not waiting on timeouts
I added in the check for the SuSE command line non-root prompt of >
And then added in a argument that could be passed in if you wanted it to check for one of the 3 that isnt already in the code, which is #, $, >

This is how you would use if the command line prompt was set to 'david'

./remote_command.sh 127.0.0.1 Calpont1 pwd 1 david

So this now works on SuSE and has the option for other custom command line prompts

Comment by David Thompson (Inactive) [ 2017-06-05 ]

Can you surface that as an optional argument in postCfg as it would lets us support the user overriding this?

Comment by David Hill (Inactive) [ 2017-06-06 ]

Fixed with a changed associated to MCOL-723. The remote_command.sh script was changed to watch for return codes from ssh and ssh -s running with option -v. This removes the needs to watch for the command line prompt to determine when the sent command is completed. This works on suse and will speed to the use of this file on that OS.

Comment by Daniel Lee (Inactive) [ 2017-09-08 ]

Build verified: 1.1.0-1

linux-p7qp:/usr/local/mariadb/columnstore/bin # time ./remote_command.sh s2um1 vagrant pwd 1
ssh -v root@s2um1 'pwd'
linux-p7qp:/usr/local/mariadb/columnstore/bin # ssh -v root@s2um1 'pwd'
OpenSSH_7.2p2, OpenSSL 1.0.2j-fips 26 Sep 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 25: Applying options for *
debug1: Connecting to s2um1 [10.0.0.41] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2
debug1: match: OpenSSH_7.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to s2um1:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:gBUe5vxY/hgh/Ie3QBeFGY1ArG+WsJz86Liw5AFl+os
debug1: Host 's2um1' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:3
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Next authentication method: keyboard-interactive
Password:
debug1: Authentication succeeded (keyboard-interactive).
Authenticated to s2um1 ([10.0.0.41]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: pwd
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
/root
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 1940, received 2636 bytes, in 0.1 seconds
Bytes per second: sent 14197.8, received 19291.4
debug1: Exit status 0

real 0m0.410s
user 0m0.012s
sys 0m0.023s

Generated at Thu Feb 08 02:22:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.