giuseppecastaldo / ha-addons

Home Assistant Whatsapp Add-on
Apache License 2.0
49 stars 18 forks source link

Issue Installing Addon - Non-zero code: 137 #28

Open Pixelartist opened 1 year ago

Pixelartist commented 1 year ago

Hello there,

I am trying to install your addon but with no success. I am getting:

The command '/bin/ash -o pipefail -c cd /Baileys && npm i -f && cd .. && npm install -f' returned a non-zero code: 137

Looking inside the logs it states:

23-05-22 01:36:13 ERROR (SyncWorker_2) [supervisor.docker.addon] Can't build f4fdf59d/aarch64-addon-whatsapp_addon:1.3.0: The command '/bin/ash -o pipefail -c cd /Baileys && npm i -f && cd .. && npm install -f' returned a non-zero code: 137
23-05-22 01:36:13 ERROR (SyncWorker_2) [supervisor.docker.addon] Build log: 
Step 1/15 : ARG BUILD_FROM
Step 2/15 : FROM $BUILD_FROM
 ---> 2e4819bfa7d6
Step 3/15 : RUN apk add --no-cache git npm
 ---> Using cache
 ---> 0bd82d502adf
Step 4/15 : COPY . /
 ---> Using cache
 ---> 2aa92055ca7e
Step 5/15 : RUN chmod a+x /run.sh
 ---> Using cache
 ---> 18c446487d46
Step 6/15 : RUN chmod a+x /finish.sh
 ---> Using cache
 ---> 260040c9196f
Step 7/15 : RUN cd /Baileys && npm i -f && cd .. && npm install -f
 ---> Running in 46898f2b39b6
npm
 WARN 
using --force Recommended protections disabled.

npm
 WARN
 skipping integrity check for git dependency ssh://git@github.com/adiwajshing/eslint-config.git 

npm
 WARN skipping integrity check for git dependency ssh://git@github.com/adiwajshing/eslint-config.git 

Killed

Removing intermediate container 46898f2b39b6

I am running HA on my RPI3.

Pixelartist commented 1 year ago

Tested the build on my machine - this works.

[+] Building 291.5s (11/11) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                          0.0s
 => => transferring dockerfile: 271B                                                                                                                          0.0s 
 => [internal] load .dockerignore                                                                                                                             0.0s 
 => => transferring context: 2B                                                                                                                               0.0s 
 => [internal] load metadata for ghcr.io/home-assistant/aarch64-base:3.16                                                                                     1.3s 
 => [1/6] FROM ghcr.io/home-assistant/aarch64-base:3.16@sha256:ca2b01d9d62952e3065801ab59566e23b1dbad8e6839f173dba9474ecc5d5eb7                               1.8s
 => => resolve ghcr.io/home-assistant/aarch64-base:3.16@sha256:ca2b01d9d62952e3065801ab59566e23b1dbad8e6839f173dba9474ecc5d5eb7                               0.0s 
 => => sha256:547446be3368f442c50ff95e2a2a9c85110b6b41bbb3c75b7e5ebb115f478b57 2.71MB / 2.71MB                                                                0.4s 
 => => sha256:fa21eb487ea52b31ae82e338894d4e4bb135cbe68a50ca926d6d8cb1fa749c10 109B / 109B                                                                    0.4s 
 => => sha256:7802bfe663ede349bcde3a92876ef2d8303fef98524aa6c795821eb72a586a86 31.29MB / 31.29MB                                                              0.9s
 => => sha256:ca2b01d9d62952e3065801ab59566e23b1dbad8e6839f173dba9474ecc5d5eb7 947B / 947B                                                                    0.0s 
 => => sha256:2e4819bfa7d662634e704bf6bbe117b63c88c8aa93c05f7f3cdfe7eab1cf6ef9 5.01kB / 5.01kB                                                                0.0s 
 => => extracting sha256:547446be3368f442c50ff95e2a2a9c85110b6b41bbb3c75b7e5ebb115f478b57                                                                     0.1s 
 => => extracting sha256:fa21eb487ea52b31ae82e338894d4e4bb135cbe68a50ca926d6d8cb1fa749c10                                                                     0.0s 
 => => extracting sha256:7802bfe663ede349bcde3a92876ef2d8303fef98524aa6c795821eb72a586a86                                                                     0.8s
 => [internal] load build context                                                                                                                             0.0s
 => => transferring context: 6.95kB                                                                                                                           0.0s
 => [2/6] RUN apk add --no-cache git npm                                                                                                                      5.2s
 => [3/6] COPY . /                                                                                                                                            0.1s
 => [4/6] RUN chmod a+x /run.sh                                                                                                                               0.6s
 => [5/6] RUN chmod a+x /finish.sh                                                                                                                            0.6s
 => [6/6] RUN cd /Baileys && npm i -f && cd .. && npm install -f                                                                                            279.0s
 => exporting to image                                                                                                                                        3.0s
 => => exporting layers                                                                                                                                       3.0s
 => => writing image sha256:57eb134222e4b4b402c59e2c04247a30b4f3bd097d9547465861309ceac0f64f                                                                  0.0s

Testing to build it on the PI.

Pixelartist commented 1 year ago

Build failed with the same reason, I am assuming that the build process is taking too much memory. I am using a Rasperry PI 3+. One could now start to get creative with the swap and try to somehow squeeze this through the pi. Can we maybe automate this build process with github actions and get already done images? Maybe the whole solution is too much for my little pi anyways?

justinswabey commented 9 months ago

I get this error message too after a long delay. Shame because this would be a really useful addon for me. Anybody any ideas?

benr77 commented 7 months ago

I get the same error, again on a Pi 3

justinswabey commented 7 months ago

I now have it working, although I'm afraid That I can't remember exactly what I did. Try removing it and re-installing. You need to re-start at each stage. I think that's basically what I did.

Pixelartist commented 7 months ago

I assume what you did by restarting is using the cache functionality of the build process the "squeeze" the build through the pi. It would then only eat the RAM necessary for the next build step and by crashing release the prvious. As mentioned before - I think it would be cool to have an image already which only needs to be downloaded.

benr77 commented 7 months ago

So I should run the install procedure manually in the console? And restart the Pi after each command?

Pixelartist commented 7 months ago

Hey - restarting the pi is not necessary (and would probably the effect that your docker build cache is gone). I can only assume what @justinswabey did, but I would do

  1. Start process in console
  2. Wait for it to fail
  3. Restart until no error appears
  4. Run and have fun
benr77 commented 7 months ago

What is the command to run in the console ? Just '/bin/ash -o pipefail -c cd /Baileys && npm i -f && cd .. && npm install -f' ??

Thank you

benr77 commented 7 months ago

I got it working by temporarily increasing the size of the swap file, so that there was enough memory for the normal install process to complete.