简体   繁体   English

无法通过远程服务器为 apache karaf 4.3.3 运行客户端命令

[英]unable to run client command for apache karaf 4.3.3 through remote server

I have downloaded apache karaf 4.3.3 on several Ubuntu18 machine.我已经在几台 Ubuntu18 机器上下载了 apache karaf 4.3.3。 When I try to install feature or run any command through client, I get the below log trace.当我尝试通过客户端安装功能或运行任何命令时,我得到以下日志跟踪。 I am able to run the client when I am on the server, but it fails through the script.当我在服务器上时,我能够运行客户端,但它通过脚本失败了。

command i'm using are我正在使用的命令是

$KARAF_HOME/bin/start
$KARAF_HOME/bin/client -u karaf -p karaf "features:install myfeature"
1155 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleReadCycleCompletion(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) read 376 bytes
1155 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientSessionImpl - handleKexInit(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) SSH_MSG_KEXINIT
1181 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientSessionImpl - setNegotiationResult([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], aes128-ctr, hmac-sha2-256, none]) Kex: server->client null {} {}
1181 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientSessionImpl - setNegotiationResult([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], aes128-ctr, hmac-sha2-256, none]) Kex: client->server null {} {}
1268 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.kex.DHGClient - init(DHGClient[ecdh-sha2-nistp521])[ClientSessionImpl[karaf@localhost/127.0.0.1:8101]] Send SSH_MSG_KEXDH_INIT
1268 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientSessionImpl - encode([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], 1, 30, 30, 138]) packet #null sending command={}[{}] len={}
1269 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - writePacket(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) Writing 152 bytes
1285 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleCompletedWriteCycle(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) finished writing len=152
1322 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleReadCycleCompletion(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) read 712 bytes
1325 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.kex.DHGClient - next([DHGClient[ecdh-sha2-nistp521], ClientSessionImpl[karaf@localhost/127.0.0.1:8101], SSH_MSG_KEXDH_REPLY])[null] process command={}
1384 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - handleKexMessage([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], ecdh-sha2-nistp521, 31])[null] KEX processing complete after cmd={}
1384 [sshd-SshClient[4f209819]-nio2-thread-3] WARN org.apache.sshd.client.keyverifier.AcceptAllServerKeyVerifier - Server at localhost/127.0.0.1:8101 presented unverified RSA key: SHA256:L7f8vYz8AGuXY9JOATcykbVn2IeyR2AVDLYudN7r9bw
1385 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - checkKeys([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], ssh-rsa, SHA256:L7f8vYz8AGuXY9JOATcykbVn2IeyR2AVDLYudN7r9bw, true]) key=null-{}, verified={}
1385 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - sendNewKeys(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Send SSH_MSG_NEWKEYS
1385 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - encode([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], 2, 21, SSH_MSG_NEWKEYS, 1]) packet #null sending command={}[{}] len={}
1385 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - writePacket(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) Writing 16 bytes
1396 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleCompletedWriteCycle(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) finished writing len=16
1397 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleReadCycleCompletion(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) read 16 bytes
1397 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - handleNewKeys(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) SSH_MSG_NEWKEYS command=SSH_MSG_NEWKEYS
1397 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - receiveNewKeys(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) session ID=8c:46:43:0f:d1:11:8f:f7:ed:eb:40:b1:29:64:86:52:0f:34:f0:60:00:7f:69:df:d9:a8:ec:dc:36:27:95:d2:38:d2:e9:39:e7:8b:fd:8b:b4:0c:81:4a:7d:58:57:2b:cf:76:43:50:b5:de:e2:45:72:61:b7:b6:5f:1e:a2:5c
1422 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - receiveNewKeys([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], BaseCipher[AES, ivSize=16, kdfSize=16,AES/CTR/NoPadding, blkSize=16], BaseCipher[AES, ivSize=16, kdfSize=16,AES/CTR/NoPadding, blkSize=16], 4294967296, 4294967296]) inCipher=null, outCipher={}, recommended blocks limit={}, actual={}
1422 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - sendInitialServiceRequest(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Send SSH_MSG_SERVICE_REQUEST for ssh-userauth
1423 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - encode([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], 3, 5, SSH_MSG_SERVICE_REQUEST, 17]) packet #null sending command={}[{}] len={}
1423 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - writePacket(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) Writing 80 bytes
1423 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleCompletedWriteCycle(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) finished writing len=80
1424 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - encode([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], 4, 50, SSH_MSG_USERAUTH_REQUEST, 36]) packet #null sending command={}[{}] len={}
1424 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - writePacket(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) Writing 96 bytes
1424 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleCompletedWriteCycle(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) finished writing len=96
1424 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientSessionImpl - handleNewKeys(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) sent 1 pending packets
1426 [sshd-SshClient[4f209819]-nio2-thread-1] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleReadCycleCompletion(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) read 80 bytes
1427 [sshd-SshClient[4f209819]-nio2-thread-1] DEBUG org.apache.sshd.client.session.ClientSessionImpl - handleServiceAccept(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) SSH_MSG_SERVICE_ACCEPT service=ssh-userauth
1428 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleReadCycleCompletion(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) read 112 bytes
1428 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientUserAuthService - processUserAuth([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], false, keyboard-interactive,password,publickey]) Received SSH_MSG_USERAUTH_FAILURE - partial=null, methods={}
1428 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientUserAuthService - tryNext([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], [publickey, keyboard-interactive, password], [keyboard-interactive, password, publickey]]) starting authentication mechanisms: client=null, server={}
1430 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientUserAuthService - tryNext(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) attempting method=publickey
1446 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.config.keys.DefaultClientIdentitiesWatcher - loadKeys(/root/.ssh/id_rsa) no key loaded
1447 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.config.keys.DefaultClientIdentitiesWatcher - loadKeys(/root/.ssh/id_dsa) no key loaded
1447 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.config.keys.DefaultClientIdentitiesWatcher - loadKeys(/root/.ssh/id_ecdsa) no key loaded
1447 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.config.keys.DefaultClientIdentitiesWatcher - loadKeys(/root/.ssh/id_ed25519) no key loaded
1447 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.auth.pubkey.UserAuthPublicKey - sendAuthDataRequest(ClientSessionImpl[karaf@localhost/127.0.0.1:8101])[ssh-connection] no more keys to send
1447 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientUserAuthService - tryNext(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) no initial request sent by method=publickey
1447 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.auth.pubkey.UserAuthPublicKey - destroy(ClientSessionImpl[karaf@localhost/127.0.0.1:8101])[ssh-connection]
1448 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientUserAuthService - tryNext(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) attempting method=keyboard-interactive
1449 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractive - verifyTrialsCount([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], ssh-connection, SSH_MSG_USERAUTH_REQUEST, 0, 3])[null] cmd={} - {} out of {}
1449 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractive - sendAuthDataRequest([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], ssh-connection, keyboard-interactive, , ])[null] send SSH_MSG_USERAUTH_REQUEST for {}: lang={}, methods={}
1449 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientSessionImpl - encode([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], 5, 50, SSH_MSG_USERAUTH_REQUEST, 60]) packet #null sending command={}[{}] len={}
1449 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - writePacket(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) Writing 128 bytes
1454 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleCompletedWriteCycle(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) finished writing len=128
1455 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientUserAuthService - tryNext(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) successfully processed initial buffer by method=keyboard-interactive
1455 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleReadCycleCompletion(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) read 128 bytes
1455 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientUserAuthService - processUserAuth([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], 60, keyboard-interactive]) delegate processing of null to {}
1455 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractive - processAuthDataRequest([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], ssh-connection, Password authentication, , en-US, 1])[null] SSH_MSG_USERAUTH_INFO_REQUEST name={}, instruction={}, language={}, num-prompts={}
1455 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractive - verifyTrialsCount([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], ssh-connection, SSH_MSG_USERAUTH_INFO_REQUEST, 1, 3])[null] cmd={} - {} out of {}
1456 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractive - getUserResponses(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) use password candidate for interaction=Password authentication
1456 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.client.session.ClientSessionImpl - encode([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], 6, 61, SSH_MSG_USERAUTH_INFO_RESPONSE, 14]) packet #null sending command={}[{}] len={}
1456 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - writePacket(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) Writing 80 bytes
1458 [sshd-SshClient[4f209819]-nio2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleCompletedWriteCycle(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) finished writing len=80
1529 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleReadCycleCompletion(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) read 64 bytes
1529 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientUserAuthService - processUserAuth(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) SSH_MSG_USERAUTH_SUCCESS Succeeded with keyboard-interactive
1530 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractive - destroy(ClientSessionImpl[karaf@localhost/127.0.0.1:8101])[ssh-connection]
1530 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientConnectionService - stopHeartBeat(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) no heartbeat to stop
1532 [sshd-SshClient[4f209819]-nio2-thread-3] DEBUG org.apache.sshd.client.session.ClientConnectionService - startHeartbeat([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], 60000, keepalive@sshd.apache.org]) - started at interval=null with request={}
1799 [main] DEBUG org.apache.sshd.client.channel.ChannelExec - init() service=[ClientConnectionService[ClientSessionImpl[karaf@localhost/127.0.0.1:8101]], ClientSessionImpl[karaf@localhost/127.0.0.1:8101], 0] session=null id={}
1800 [main] DEBUG org.apache.sshd.common.channel.Window - init([Window[client/local](ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]), 2097152, 2097152, 32768]) size=null, max={}, packet={}
1800 [main] DEBUG org.apache.sshd.client.session.ClientConnectionService - registerChannel([ClientConnectionService[ClientSessionImpl[karaf@localhost/127.0.0.1:8101]], 0, ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]])[id=null] {}
1800 [main] DEBUG org.apache.sshd.client.session.ClientSessionImpl - createExecChannel([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], bundle:list 
, 0, null])[null] created id={} - PTY={}
1811 [Thread-2] DEBUG org.apache.sshd.client.channel.ChannelExec - close(ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Closing immediately
1811 [Thread-2] DEBUG org.apache.sshd.client.channel.ChannelExec - close(ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) prevent sending EOF
1811 [main] DEBUG org.apache.sshd.client.channel.ChannelExec - open(ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Send SSH_MSG_CHANNEL_OPEN - type=session
1811 [Thread-2] DEBUG org.apache.sshd.common.channel.Window - Closing Window[client/local](ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
1811 [main] DEBUG org.apache.sshd.client.channel.ChannelExec - writePacket(ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Discarding output packet because channel state=Immediate
1811 [Thread-2] DEBUG org.apache.sshd.common.channel.Window - Closing Window[client/remote](ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
1816 [main] DEBUG org.apache.sshd.client.SshClient - close(SshClient[4f209819]) Closing immediately
1817 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Connector - close(org.apache.sshd.common.io.nio2.Nio2Connector@1b1426f4) Closing immediately
1818 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - close(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) Closing immediately
1818 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - doCloseImmediately(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) closing socket=sun.nio.ch.UnixAsynchronousSocketChannelImpl[connected local=/127.0.0.1:45906 remote=localhost/127.0.0.1:8101]
1819 [sshd-SshClient[4f209819]-nio2-thread-1] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - close(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101])[Immediately] state already Immediate
1820 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - doCloseImmediately(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]) socket=sun.nio.ch.UnixAsynchronousSocketChannelImpl[closed] closed
1820 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Connector - unmapSession(id=101): Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101]
1820 [main] DEBUG org.apache.sshd.client.session.ClientSessionImpl - close(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Closing immediately
1820 [main] DEBUG org.apache.sshd.client.session.ClientSessionImpl - signalAuthFailure([ClientSessionImpl[karaf@localhost/127.0.0.1:8101], SshException, false, Session is being closed]) type=null, signalled={}: {}
1821 [main] DEBUG org.apache.sshd.client.session.ClientConnectionService - close(ClientConnectionService[ClientSessionImpl[karaf@localhost/127.0.0.1:8101]]) Closing immediately
1821 [main] DEBUG org.apache.sshd.client.session.ClientConnectionService - stopHeartBeat(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) stopping
1821 [main] DEBUG org.apache.sshd.client.session.ClientConnectionService - stopHeartBeat(ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) stopped
1821 [main] DEBUG org.apache.sshd.client.channel.ChannelExec - close(ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])[Immediately] state already Immediate
1822 [main] DEBUG org.apache.sshd.client.session.ClientConnectionService - close(ClientConnectionService[ClientSessionImpl[karaf@localhost/127.0.0.1:8101]])[Immediately] closed
1822 [main] DEBUG org.apache.sshd.client.session.ClientSessionImpl - close(ClientSessionImpl[karaf@localhost/127.0.0.1:8101])[Immediately] closed
1822 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - close(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101])[Immediately] closed
1822 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2Connector - close(org.apache.sshd.common.io.nio2.Nio2Connector@1b1426f4)[Immediately] closed
1822 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - close(org.apache.sshd.common.io.nio2.Nio2ServiceFactory@71238fc2) Closing immediately
1822 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - Shutdown group
1831 [Thread-2] DEBUG org.apache.sshd.common.channel.AbstractChannel$GracefulChannelCloseable - close(ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])[immediately=true] processing
1831 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - Group successfully shut down
1831 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - Shutdown executor
1835 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - Shutdown complete
1835 [Thread-2] DEBUG org.apache.sshd.client.session.ClientConnectionService - unregisterChannel(ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) result=ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]
1835 [main] DEBUG org.apache.sshd.common.io.nio2.Nio2ServiceFactory - close(org.apache.sshd.common.io.nio2.Nio2ServiceFactory@71238fc2)[Immediately] closed
1835 [Thread-2] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@51fc526d) signal close complete immediately=true
1835 [Thread-2] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@5b38138a) signal close complete immediately=true
1835 [Thread-2] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@a890633) signal close complete immediately=true
1835 [main] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@16a0ee18) signal close complete immediately=true
1835 [Thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - close(Nio2Session[local=/127.0.0.1:45906, remote=localhost/127.0.0.1:8101])[Immediately] state already Closed
1835 [main] DEBUG org.apache.sshd.client.SshClient - close(SshClient[4f209819])[Immediately] closed
1835 [Thread-2] DEBUG org.apache.sshd.common.util.closeable.SequentialCloseable - doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@3b9b6f68) signal close complete immediately=true
1836 [Thread-2] DEBUG org.apache.sshd.client.channel.ChannelExec - close(ChannelExec[id=0, recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])[Immediately] closed
org.apache.sshd.common.SshException: Closed
    at org.apache.sshd.common.util.closeable.FuturesCloseable.doClose(FuturesCloseable.java:47)
    at org.apache.sshd.common.util.closeable.SimpleCloseable.close(SimpleCloseable.java:63)
    at org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:56)
    at org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
    at org.apache.sshd.common.util.closeable.SequentialCloseable.doClose(SequentialCloseable.java:69)
    at org.apache.sshd.common.util.closeable.SimpleCloseable.close(SimpleCloseable.java:63)
    at org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:56)
    at org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
    at org.apache.sshd.common.util.closeable.SequentialCloseable.doClose(SequentialCloseable.java:69)
    at org.apache.sshd.common.util.closeable.SimpleCloseable.close(SimpleCloseable.java:63)
    at org.apache.sshd.common.util.closeable.AbstractInnerCloseable.doCloseImmediately(AbstractInnerCloseable.java:48)
    at org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:95)
    at org.apache.karaf.client.Main.lambda$main$1(Main.java:196)
    at java.base/java.lang.Thread.run(Thread.java:829)

Anyone know why this is happening?有人知道为什么会这样吗? is it to do with the keys?跟钥匙有关系吗? if so then what should i change?如果是这样,那么我应该改变什么?

I used the above answer to construct a solution that worked for me using the following pattern我使用上面的答案构建了一个使用以下模式对我有用的解决方案

`ssh -o RequestTTY=force -o StrictHostKeyChecking=no karaf_user@localhost -p KARAF_SSH_PORT -i "/ssh/key" "karaf_command"` 

This uses the ssh server that karaf is packaged with and the client command wraps internally to make karaf console commands over ssh.这使用 karaf 打包的 ssh 服务器,客户端命令在内部包装以通过 ssh 发出 karaf 控制台命令。 This approach requires you to put a public key for your karaf user in the keys.properties file and ssh using a private key.此方法要求您将 karaf 用户的公钥放入 keys.properties 文件中,并使用私钥进行 ssh。 For more details see:有关详细信息,请参阅:

I came across a similar problem with the script returning a "Closed" status.我遇到了与返回“已关闭”状态的脚本类似的问题。

After some tests, I found the script fails when there is no TTY (as is the case if you use tools like ansible)经过一些测试,我发现没有 TTY 时脚本会失败(如果您使用诸如 ansible 之类的工具就是这种情况)

You should use the 'batch mode' included in karaf client script, so your command would become:您应该使用 karaf 客户端脚本中包含的“批处理模式”,因此您的命令将变为:

$KARAF_HOME/bin/client -u karaf -p karaf -b <<< "features:install myfeature"

When run this way, the script won't ask for a TTY but will run the commands from standard input.以这种方式运行时,脚本不会要求 TTY,而是会从标准输入运行命令。 In my example I use a 'here string' to redirect to the standard input, but you could of course use any redirection you like to pass commands to the standard input在我的示例中,我使用“此处字符串”重定向到标准输入,但您当然可以使用任何您喜欢的重定向将命令传递到标准输入

There is also a '-f' option if you prefer to read commands from a file.如果您更喜欢从文件中读取命令,还有一个“-f”选项。 See bin/client --help for details有关详细信息,请参阅bin/client --help

Alternatively, if you have control of the ssh commands, you could use the option on ssh to force tty allocation when connecting to your remote machine:或者,如果您可以控制 ssh 命令,则可以使用 ssh 上的选项在连接到远程计算机时强制分配 tty:

ssh -o RequestTTY=force my_server $KARAF_HOME/bin/client -u karaf -p karaf "features:install myfeature"

(see https://man7.org/linux/man-pages/man5/ssh_config.5.html ) (见https://man7.org/linux/man-pages/man5/ssh_config.5.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM