fazalfarhan01 / EarnApp-Docker

Containerized version of BrightData's EarnApp
https://hub.docker.com/r/fazalfarhan01/earnapp
43 stars 24 forks source link

Lite version does not start on Raspberrypi4 #8

Closed N1CK145 closed 2 years ago

N1CK145 commented 2 years ago

Setup

root@raspberrypi:~/docker/earnapp-lite# cat docker-compose.yml
version: "3.3"
services:
    app:
        image: fazalfarhan01/earnapp:lite
        volumes:
            - ./etc:/etc/earnapp
        environment:
            EARNAPP_UUID: sdk-node-2d35ccabXXXXXXXXXXXXXXX63

 root@raspberrypi:~/docker/earnapp-lite# docker-compose up -d
              Creating network "earnapp-lite_default" with the default driver
              Creating earnapp-lite_app_1 ... done

root@raspberrypi:~/docker/earnapp-lite# docker-compose exec app earnapp status
ERROR: No container found for app_1
root@raspberrypi:~/docker/earnapp-lite# docker-compose ps
       Name          Command    State     Ports
-----------------------------------------------
earnapp-lite_app_1   install   Exit 134

Docker-Logs

root@raspberrypi:~/docker/earnapp-lite# docker-compose logs
Attaching to earnapp-lite_app_1
app_1  |
app_1  | ███████╗░█████╗░██████╗░███╗░░██╗░█████╗░██████╗░██████╗░  ██████╗░░█████╗░░█████╗░██╗░░██╗███████╗██████╗░
app_1  | ██╔════╝██╔══██╗██╔══██╗████╗░██║██╔══██╗██╔══██╗██╔══██╗  ██╔══██╗██╔══██╗██╔══██╗██║░██╔╝██╔════╝██╔══██╗
app_1  | █████╗░░███████║██████╔╝██╔██╗██║███████║██████╔╝██████╔╝  ██║░░██║██║░░██║██║░░╚═╝█████═╝░█████╗░░██████╔╝
app_1  | ██╔══╝░░██╔══██║██╔══██╗██║╚████║██╔══██║██╔═══╝░██╔═══╝░  ██║░░██║██║░░██║██║░░██╗██╔═██╗░██╔══╝░░██╔══██╗
app_1  | ███████╗██║░░██║██║░░██║██║░╚███║██║░░██║██║░░░░░██║░░░░░  ██████╔╝╚█████╔╝╚█████╔╝██║░╚██╗███████╗██║░░██║
app_1  | ╚══════╝╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚══╝╚═╝░░╚═╝╚═╝░░░░░╚═╝░░░░░  ╚═════╝░░╚════╝░░╚════╝░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝
app_1  | An image by https://github.com/fazalfarhan01
app_1  |
app_1  | Installing
app_1  | sleep: cannot read realtime clock: Operation not permitted
app_1  | touch: setting times of '/etc/earnapp/status': Operation not permitted
app_1  | Node.js[12]: ../src/util.cc:188:double node::GetCurrentTimeInMicroseconds(): Assertion `(0) == (uv_gettimeofday(&tv))' failed.
app_1  | /usr/bin/install: line 18:    12 Aborted                 (core dumped) earnapp start
app_1  | Node.js[13]: ../src/util.cc:188:double node::GetCurrentTimeInMicroseconds(): Assertion `(0) == (uv_gettimeofday(&tv))' failed.
app_1  | /usr/bin/install: line 19:    13 Aborted                 (core dumped) earnapp run

device information

root@rapsberrypi: uname -a
Linux raspberrypi 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021 armv7l GNU/Linux

Docker: 
Docker version 20.10.12, build e91ed57

Docker-Compose:
docker-compose version 1.21.0, build unknown
fazalfarhan01 commented 2 years ago

I haven't tested the image on a Pi.. planned to do it soon.. a fix should be available soon..

N1CK145 commented 2 years ago

I haven't tested the image on a Pi.. planned to do it soon.. a fix should be available soon..

Found a workaround

I've found a soloution. If I ran the container in privileged mode, it run's. It crashes because this line:

install.sh

echo "Installing"
sleep 2                         <- This little guy here crashes everything
cp /download/earnapp /usr/bin/earnapp
...

In docker:

app_1  | Installing

app_1  | sleep: cannot read realtime clock: Operation not permitted
...

New docker-compose:

...
lite:
    image: fazalfarhan01/earnapp:lite
    privileged: true
    volumes:
      - ./etc:/etc/earnapp
    environment:
      EARNAPP_UUID: sdk-node-BLA_BLA_BLA

Is it possible to grant rights to the clock? Or to create an "Virtual" clock? Sorry, I am very new to docker :D

fazalfarhan01 commented 2 years ago

I found an explanation so as to why it happens.

The issue with “No monotonic clock was available - timed services may be adversely affected if the time-of-day clock changes” or “nanosleep(100ms) failed. Operation not permitted” (wanted to place those explicit messages in for the search later :slight_smile: ) seems to only occur on recent Raspbian 32-bit installations running Docker.

It seems that this issue report 7 discusses the need for libseccomp2 library to be updated to address this issue. This solved the problem for me on a Raspbian 32-bit install:

# Install a few prerequisite packages to be able to do the build
sudo apt install build-essential git gperf
# Download the libseccomp2 release package and unpack
wget https://github.com/seccomp/libseccomp/releases/download/v2.5.1/libseccomp-2.5.1.tar.gz
tar zvxf libseccomp-2.5.1.tar.gz
cd libseccomp-2.5.1
# Build and install
./configure && make
sudo make install
# Preserve the original libraries from the .deb package from the base install
mkdir ~/old-libs
sudo mv /usr/lib/arm-linux-gnuabihf/libseccomp.so.2* ~/old-libs/
# Remove the library cache and rebuild
sudo rm /etc/ld.so.cache
sudo ldconfig

Orignal Source