Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation instructions for Alpine Linux #188

Closed
demyxco opened this issue May 15, 2019 · 20 comments
Closed

Installation instructions for Alpine Linux #188

demyxco opened this issue May 15, 2019 · 20 comments

Comments

@demyxco
Copy link

demyxco commented May 15, 2019

Hello I've read #180 and tried to use the same libs in a Docker build but it just fails at 64%.

[ 58%] Building CXX object CMakeFiles/HtmCommon.dir/src/htm/HtmServer.cpp.o
[ 60%] Linking CXX static library libHtmCommon.a
[ 60%] Built target HtmCommon
Scanning dependencies of target htmd
[ 62%] Building CXX object CMakeFiles/htmd.dir/src/htm/HtmServerMain.cpp.o
[ 64%] Linking CXX executable htmd
/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: libet-lib.a(easylogging++.cc.o): in function `el::base::debug::StackTrace::generateNew()':
/EternalTerminal-master/external/easylogging++.cc:2795: undefined reference to `backtrace'
/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: /EternalTerminal-master/external/easylogging++.cc:2796: undefined reference to `backtrace_symbols'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/htmd.dir/build.make:90: htmd] Error 1
make[1]: *** [CMakeFiles/Makefile2:74: CMakeFiles/htmd.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

DOCKER RUN

RUN set -ex; \
    echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing/' >> /etc/apk/repositories; \
    apk --update --no-cache add --virtual .build-deps \
    \
    gcc g++ libc-dev make zip unzip libutempter-dev \
    cmake protobuf-dev libsodium-dev gflags-dev \
    libexecinfo-dev ncurses-dev boost-dev; \
    \
    wget https://github.com/MisterTea/EternalTerminal/archive/master.zip; \
    unzip master.zip; \
    cd EternalTerminal-master; \
    mkdir build; \
    cd build; \
    cmake ../; \
    make && make install; \
    apk del .build-deps

Can't seem to figure out what the error means, any help is appreciated! Thanks!

@MisterTea
Copy link
Owner

MisterTea commented May 15, 2019 via email

@demyxco
Copy link
Author

demyxco commented May 15, 2019

You can turn off the easy logging crash log compiler definition in CMakelists.txt

Remove line 114?

external/easylogging++.cc

@MisterTea
Copy link
Owner

No, remove this "-DELPP_FEATURE_CRASH_LOG"

@demyxco
Copy link
Author

demyxco commented May 15, 2019

Thanks that did it. Seems like it fails to run when the build dependencies are deleted.

@MisterTea
Copy link
Owner

MisterTea commented May 16, 2019 via email

@demyxco
Copy link
Author

demyxco commented May 16, 2019

This seems to work for me, others can chime in and do some testing.

file(STRINGS "/etc/os-release" ID)

IF(ID MATCHES "alpine") 
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DELPP_NO_DEFAULT_LOG_FILE -DELPP_THREAD_SAFE -DELPP_HANDLE_SIGABRT")
ELSE()
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DELPP_NO_DEFAULT_LOG_FILE -DELPP_FEATURE_CRASH_LOG -DELPP_THREAD_SAFE -DELPP_HANDLE_SIGABRT")
ENDIF()

@demyxco
Copy link
Author

demyxco commented May 18, 2019

Is there anything else I'm missing? Et just won't connect via Docker container. I can ssh just fine into it but not et. I've started the etserver in the container using --daemon flag. Is there something else I'm missing to start up?

Executed script on container up

#!/bin/sh

/usr/local/bin/etserver --daemon
/usr/sbin/sshd -D

Docker command

docker run -it --rm \
--name et \
-v et:/home/demyx/.ssh \
-p 2223:22 \
-p 2022:2022 \
demyx/eternal-terminal

This is a fresh install of Alpine Linux as the host OS so there's no firewalls. I've tried even using the Ubuntu image to see if it was an Alpine thing but same results. Nada.

@MisterTea
Copy link
Owner

What do the et logs in /tmp say? You may need to run in verbose mode.

@demyxco
Copy link
Author

demyxco commented May 19, 2019

Keeps saying the same thing:

et -v=9 [email protected]
Error starting ET process through ssh, please make sure your ssh works first
# Which does work

Log from macOS

cat etclient-2019-05-18_17_31_26.log
[INFO 2019-05-18 17:31:26,271 client-main ParseConfigFile.hpp:1313] /Users/cim/.ssh/confignot found
[INFO 2019-05-18 17:31:26,271 client-main ParseConfigFile.hpp:1289] unsupported config line: 	SendEnv LANG LC_*
, ignored
[INFO 2019-05-18 17:31:26,271 client-main TerminalClient.cpp:280] Parsed ssh config file, connecting to domain.tld

@MisterTea
Copy link
Owner

can you telnet to that machine on port 2022?

@demyxco
Copy link
Author

demyxco commented May 19, 2019

Yes, it shows connected.

@MisterTea
Copy link
Owner

Hmm, can you try running latest master on client?

brew install --HEAD et

@MisterTea
Copy link
Owner

Also turn on verbose logging on the server in /etc/et.cfg

This will generate many files in /tmp/et* Please look at all of them to find a meaningful error that we can work with.

@MisterTea
Copy link
Owner

Note that you will need to restart the et service after changing et.cfg

@demyxco
Copy link
Author

demyxco commented May 20, 2019

Server starts fine, just won't connect. I could use et client from container to connect to a different (Ubuntu) machine but not from my MacBook to container. I also tried connecting from my Manjaro box to the container, no luck.

htop

et.cfg

; et.cfg : Config file for Eternal Terminal
;

[Networking]
port = 2022

[Debug]
verbose = 9
silent = 0
logsize = 20971520

Log

[INFO 2019-05-19 23:14:33,041 etserver-main TerminalServer.cpp:287] Creating server
[INFO 2019-05-19 23:14:33,043 etserver-main TcpSocketHandler.cpp:202] Listening on 0.0.0.0:2022/2/1/6
[INFO 2019-05-19 23:14:33,043 etserver-main TcpSocketHandler.cpp:202] Listening on 0.0.0.0:2022/10/1/6

ls -al /tmp

drwxrwxrwt    1 root     root          4096 May 19 23:14 .
drwxr-xr-x    1 root     root          4096 May 19 23:14 ..
-rw-r--r--    1 root     root           289 May 19 23:14 etserver-2019-05-19_23-14.log
srwxrwxrwx    1 root     root             0 May 19 23:14 etserver.idpasskey.fifo
-rw-r--r--    1 root     root             0 May 19 23:14 etserver_stderr_2019-05-19_11-14

ls -al /usr/local/bin

total 51240
drwxr-xr-x    1 root     root          4096 May 19 22:32 .
drwxr-xr-x    1 root     root          4096 May  9 13:49 ..
-rwxr-xr-x    1 root     root           545 May 19 22:32 demyx
-rwxr-xr-x    1 root     root      10602760 May 19 21:57 et
-rwxr-xr-x    1 root     root      12930920 May 19 21:56 etserver
-rwxr-xr-x    1 root     root       9835512 May 19 21:57 etterminal
-rwxr-xr-x    1 root     root       9897872 May 19 21:56 htm
-rwxr-xr-x    1 root     root       9180400 May 19 21:56 htmd

Also turn on verbose logging on the server in /etc/et.cfg

This will generate many files in /tmp/et* Please look at all of them to find a meaningful error that we can work with.

Not much logs are generated.

Note that you will need to restart the et service after changing et.cfg

This is a minimal alpine image so there is no systemd or systemctl for me to use.

@demyxco
Copy link
Author

demyxco commented May 20, 2019

I'm getting close, et is trying to connect to the host OS instead of the container.

et [email protected] -logtostdout true
[INFO 2019-05-20 01:38:02,273 client-main ParseConfigFile.hpp:1313] /Users/cim/.ssh/confignot found
[INFO 2019-05-20 01:38:02,273 client-main ParseConfigFile.hpp:1289] unsupported config line: 	SendEnv LANG LC_*
, ignored
[INFO 2019-05-20 01:38:02,273 client-main TerminalClient.cpp:280] Parsed ssh config file, connecting to domain.tld
the input device is not a TTY
/bin/ash: etserver: not found
Error starting ET process through ssh, please make sure your ssh works first

@demyxco
Copy link
Author

demyxco commented May 20, 2019

et [email protected] -logtostdout true -jumphost domain.tld

[INFO 2019-05-20 03:45:44,674 client-main ParseConfigFile.hpp:1313] /Users/cim/.ssh/confignot found
[INFO 2019-05-20 03:45:44,674 client-main ParseConfigFile.hpp:1289] unsupported config line: 	SendEnv LANG LC_*
, ignored
[INFO 2019-05-20 03:45:44,674 client-main TerminalClient.cpp:280] Parsed ssh config file, connecting to domain.tld
channel 0: open failed: administratively prohibited: open failed
stdio forwarding failed
ssh_exchange_identification: Connection closed by remote host
Error starting ET process through ssh, please make sure your ssh works first

@demyxco
Copy link
Author

demyxco commented May 28, 2019

I finally got it! The key was to create an ssh alias ~/.ssh/config on the local computer (my MacBook for example).

Docker Hub: https://hub.docker.com/r/demyx/eternal-terminal

Host example
     HostName domain.tld
     User demyx
     Port 2223
docker run -dit \
-v demyx_ssh:/home/demyx/.ssh \
-p 2223:22 \ 
-p 2022:2022 \
demyx/eternal-terminal
et example

@demyxco demyxco closed this as completed May 28, 2019
@demyxco
Copy link
Author

demyxco commented Aug 5, 2019

Hi, I'm having compiling issues again. Not sure what you changed but a file is missing:

[  3%] Built target generated-code
Scanning dependencies of target TerminalCommon
[  5%] Building CXX object CMakeFiles/TerminalCommon.dir/src/terminal/PortForwardHandler.cpp.o
In file included from /usr/src/EternalTerminal/src/base/Connection.hpp:4,
                 from /usr/src/EternalTerminal/src/terminal/PortForwardHandler.hpp:6,
                 from /usr/src/EternalTerminal/src/terminal/PortForwardHandler.cpp:1:
/usr/src/EternalTerminal/src/base/Headers.hpp:62:10: fatal error: cxxopts.hpp: No such file or directory
 #include <cxxopts.hpp>
          ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/TerminalCommon.dir/build.make:71: CMakeFiles/TerminalCommon.dir/src/terminal/PortForwardHandler.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:121: CMakeFiles/TerminalCommon.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

I am compiling this for Docker so nothing has changed in my Dockerfile, except version changes for Alpine Linux. Every time I build this image, it would git clone a fresh copy of your repo.

@demyxco demyxco reopened this Aug 5, 2019
@demyxco
Copy link
Author

demyxco commented Aug 19, 2019

Successfully compiled by adding this flag to git clone:

--recurse-submodules

I had a custom CMakeLists.txt for a while but decided to do a sed replace on it to make it compile for Alpine:

sed -i 's/-DELPP_FEATURE_CRASH_LOG//g' EternalTerminal/CMakeLists.txt

@demyxco demyxco closed this as completed Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants