EternalTerminal icon indicating copy to clipboard operation
EternalTerminal copied to clipboard

Cannot connect even locally - Failed a call to readAll: Broken pipe

Open miker985 opened this issue 1 year ago • 3 comments

I'm experiencing failures connecting to etserver on localhost. ssh localhost works

I see that after et localhost is run but before I actually respond to the password prompt things already appear to be broken

Here's the etserver log output

miker985@miker985-x1:~$ etserver -p 2022 -v 9 --logtostdout
[INFO 2023-04-04 09:16:11,902 etserver-main TerminalServerMain.cpp:192] In child, about to start server.
[INFO 2023-04-04 09:16:11,902 etserver-main TcpSocketHandler.cpp:224] Listening on 0.0.0.0:2022/2/1/6
[INFO 2023-04-04 09:16:11,902 etserver-main TcpSocketHandler.cpp:224] Listening on 0.0.0.0:2022/10/1/6
[INFO 2023-04-04 09:16:11,902 etserver-main TerminalServer.cpp:23] Creating server

# at this point i run `et -v9 --logtostdout localhost` in a separate terminal window

[V1 2023-04-04 09:16:15,345 etserver-main ServerConnection.cpp:16] Accepting connection
[V3 2023-04-04 09:16:15,346 etserver-main UnixSocketHandler.cpp:137] Socket 6 accepted, returned client_sock: 9
[V3 2023-04-04 09:16:15,346 etserver-main UnixSocketHandler.cpp:143] Client_socket inserted to activeSockets
[V1 2023-04-04 09:16:15,346 etserver-main ServerConnection.cpp:21] SERVER: got client socket fd: 9
[V4 2023-04-04 09:16:15,346 server-clientHandler Headers.hpp:348] Before selecting sockFd
[V4 2023-04-04 09:16:15,346 server-clientHandler UnixSocketHandler.cpp:23] socket 9 has data
[V4 2023-04-04 09:16:15,346 server-clientHandler UnixSocketHandler.cpp:45] Unixsocket handler read from fd: 9
[V1 2023-04-04 09:16:15,346 server-clientHandler SocketHandler.cpp:34] Failed a call to readAll: Broken pipe
[WARNING 2023-04-04 09:16:15,346 server-clientHandler ServerConnection.cpp:127] Error handling new client: Failed a call to readAll
[V1 2023-04-04 09:16:15,346 server-clientHandler UnixSocketHandler.cpp:166] Closing connection: 9

# note that at this point I have not entered a password in the other window

Here's the other window

miker985@miker985-x1:~/usr/archives$ et -v9 --logtostdout localhost
Setting up and starting sentry
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line: CanonicalizeHostname yes, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     IdentityFile ~/.ssh/github-x1, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     IdentityFile ~/.ssh/id_ed25519, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     PubkeyAcceptedKeyTypes +ssh-rsa, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     IdentityFile ~/.ssh/bitbucket-x1, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     IdentityFile ~/.ssh/id_rsa, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     HostKeyAlgorithms=+ssh-rsa, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     PubkeyAcceptedAlgorithms=+ssh-rsa, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     HostKeyAlgorithms=+ssh-dss, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     ControlMaster auto, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     ControlPersist 1h, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     ServerAliveInterval 120, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     ServerAliveCountMax 2, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1181] /etc/ssh/ssh_config.d/*.confnot found
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     SendEnv LANG LC_*, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     HashKnownHosts yes, ignored
[INFO 2023-04-04 09:16:15,345 client-main ParseConfigFile.hpp:1400] unsupported config line:     GSSAPIAuthentication yes, ignored
[INFO 2023-04-04 09:16:15,345 client-main TerminalClientMain.cpp:244] Parsed ssh config file, connecting to localhost
[V1 2023-04-04 09:16:15,345 client-main TerminalClientMain.cpp:16] Connecting
[V4 2023-04-04 09:16:15,345 client-main TcpSocketHandler.cpp:83] Before selecting sockFd
[V4 2023-04-04 09:16:15,345 client-main TcpSocketHandler.cpp:87] sockFd 7is selected7
[INFO 2023-04-04 09:16:15,345 client-main TcpSocketHandler.cpp:96] Connected to server: localhost using fd 7
[V1 2023-04-04 09:16:15,345 client-main UnixSocketHandler.cpp:166] Closing connection: 7
miker985@localhost's password:
Error in authentication with etserver: Error:  Connection error communicating with et daemon: No such file or directory.

, please make sure you don't print anything in server's .bashrc/.zshrc

Shutting down sentry
# immediately demonstrate ssh working
miker985@miker985-x1:~/usr/archives$ ssh localhost
miker985@localhost's password:
miker985@miker985-x1:~$
logout
Connection to localhost closed.

Removing ~/.ssh changes nothing except prompting to confirm the key fingerprint.

ET is built from scratch as of a few minutes prior to this issue post with the following script. In a former life I ran a lot of software out of my user account at ~/usr but on this machine there is only 1 other piece of software: bitlbee and I do not think it is having any sort of impact.

#!/bin/bash

set -e

if [[ -d EternalTerminal ]]; then
    rm -rf EternalTerminal
fi
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
cd EternalTerminal
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/usr ../
make
make install

miker985 avatar Apr 04 '23 16:04 miker985

What is the path to etterminal? /usr/bin/etterminal? I'm guessing you need to pass the path prefix as the default isn't finding etterminal hence the error:

auto passKeyIndex = sshBuffer.find(string("IDPASSKEY:"));
    if (passKeyIndex == string::npos) {
      // Returned value not contain "IDPASSKEY:"
      CLOG(INFO, "stdout")
          << "Error in authentication with etserver: " << sshBuffer
          << ", please make sure you don't print anything in server's "
             ".bashrc/.zshrc"
          << endl;
      exit(1);
    }

Try running: et -v9 --logtostdout --terminal-path=/usr/bin/etterminal localhost

jshort avatar May 01 '23 22:05 jshort

What is the path to etterminal?

Both bash sessions (the one running etserver and et) have etterminal on their PATH

miker985@miker985-x1:~$ which etterminal
/home/miker985/usr/bin/etterminal

Try running: et -v9 --logtostdout --terminal-path=/usr/bin/etterminal localhost

etserver

miker985@miker985-x1:~/bin$ etserver  --logtostdout -v9
[INFO 2023-05-01 15:56:24,978 etserver-main TerminalServerMain.cpp:192] In child, about to start server.
[INFO 2023-05-01 15:56:24,979 etserver-main TcpSocketHandler.cpp:224] Listening on 0.0.0.0:2022/2/1/6
[INFO 2023-05-01 15:56:24,979 etserver-main TcpSocketHandler.cpp:224] Listening on 0.0.0.0:2022/10/1/6
[INFO 2023-05-01 15:56:24,979 etserver-main TerminalServer.cpp:23] Creating server
[V1 2023-05-01 15:56:29,703 etserver-main ServerConnection.cpp:16] Accepting connection
[V3 2023-05-01 15:56:29,703 etserver-main UnixSocketHandler.cpp:137] Socket 6 accepted, returned client_sock: 9
[V3 2023-05-01 15:56:29,703 etserver-main UnixSocketHandler.cpp:143] Client_socket inserted to activeSockets
[V1 2023-05-01 15:56:29,703 etserver-main ServerConnection.cpp:21] SERVER: got client socket fd: 9
[V4 2023-05-01 15:56:29,703 server-clientHandler Headers.hpp:348] Before selecting sockFd
[V4 2023-05-01 15:56:29,703 server-clientHandler UnixSocketHandler.cpp:23] socket 9 has data
[V4 2023-05-01 15:56:29,703 server-clientHandler UnixSocketHandler.cpp:45] Unixsocket handler read from fd: 9
[V1 2023-05-01 15:56:29,703 server-clientHandler SocketHandler.cpp:34] Failed a call to readAll: Broken pipe
[WARNING 2023-05-01 15:56:29,704 server-clientHandler ServerConnection.cpp:127] Error handling new client: Failed a call to readAll
[V1 2023-05-01 15:56:29,704 server-clientHandler UnixSocketHandler.cpp:166] Closing connection: 9

et -v9 ...

miker985@miker985-x1:~$ et -v9 --logtostdout --terminal-path=/home/miker985/usr/bin/etterminal localhost
Setting up and starting sentry
[INFO 2023-05-01 15:56:29,701 client-main ParseConfigFile.hpp:1430] /home/miker985/.ssh/config not found
[INFO 2023-05-01 15:56:29,701 client-main ParseConfigFile.hpp:1181] /etc/ssh/ssh_config.d/*.confnot found
[INFO 2023-05-01 15:56:29,701 client-main ParseConfigFile.hpp:1400] unsupported config line:     SendEnv LANG LC_*, ignored
[INFO 2023-05-01 15:56:29,701 client-main ParseConfigFile.hpp:1400] unsupported config line:     HashKnownHosts yes, ignored
[INFO 2023-05-01 15:56:29,701 client-main ParseConfigFile.hpp:1400] unsupported config line:     GSSAPIAuthentication yes, ignored
[INFO 2023-05-01 15:56:29,702 client-main TerminalClientMain.cpp:244] Parsed ssh config file, connecting to localhost
[V1 2023-05-01 15:56:29,702 client-main TerminalClientMain.cpp:16] Connecting
[V4 2023-05-01 15:56:29,702 client-main TcpSocketHandler.cpp:83] Before selecting sockFd
[V4 2023-05-01 15:56:29,703 client-main TcpSocketHandler.cpp:87] sockFd 7is selected7
[INFO 2023-05-01 15:56:29,703 client-main TcpSocketHandler.cpp:96] Connected to server: localhost using fd 7
[V1 2023-05-01 15:56:29,703 client-main UnixSocketHandler.cpp:166] Closing connection: 7
miker985@localhost's password:
Error in authentication with etserver: Error:  Connection error communicating with et daemon: No such file or directory.

, please make sure you don't print anything in server's .bashrc/.zshrc

Shutting down sentry

Note that Failed a call to readAll: Broken pipe occurs before I can enter my password

EDIT: I tried manually linking etterminal to /usr/bin and get the same error

miker985 avatar May 01 '23 23:05 miker985

Can you print/log sshBuffer from here https://github.com/MisterTea/EternalTerminal/blob/master/src/terminal/SshSetupHandler.cpp#LL75C9-L75C9 to see what it is returning. Also do you have any errors in your etterminal log file (server side)?

jshort avatar May 08 '23 22:05 jshort