0

我已经在几台 Ubuntu18 机器上下载了 apache karaf 4.3.3。当我尝试通过客户端安装功能或运行任何命令时,我得到以下日志跟踪。当我在服务器上时,我能够运行客户端,但它通过脚本失败。

我正在使用的命令是

$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)

有谁知道为什么会这样?和钥匙有关系吗?如果是这样,那么我应该改变什么?

4

1 回答 1

0

我遇到了与返回“已关闭”状态的脚本类似的问题。

经过一些测试,我发现没有 TTY 时脚本会失败(如果您使用诸如 ansible 之类的工具就是这种情况)

您应该使用 karaf 客户端脚本中包含的“批处理模式”,因此您的命令将变为:

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

以这种方式运行时,脚本不会要求 TTY,而是会从标准输入运行命令。在我的示例中,我使用“此处字符串”重定向到标准输入,但您当然可以使用任何您喜欢的重定向将命令传递到标准输入

如果您更喜欢从文件中读取命令,还有一个“-f”选项。详情见bin/client --help_

或者,如果您可以控制 ssh 命令,则可以在连接到远程计算机时使用 ssh 上的选项来强制分配 tty:

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

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

于 2022-01-18T21:37:40.407 回答