Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Docker container dies immediately on Raspberry Zero #23

Open
KarlBaumann opened this issue Feb 9, 2020 · 30 comments
Open

Docker container dies immediately on Raspberry Zero #23

KarlBaumann opened this issue Feb 9, 2020 · 30 comments
Assignees
Labels

Comments

@KarlBaumann
Copy link

KarlBaumann commented Feb 9, 2020

pi@pi-zero-w:~ $ sudo docker start camera1
2020-02-09T20:53:58.340074224Z network connect 68c43e2bab7308ed42fbf78d10f81317e404e7e69454c3778077f8f168a1d63a (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, name=bridge, type=bridge)
2020-02-09T20:53:58.379730165Z volume mount 9c28d6d5b3bfe657ab416ab414ca585657bc8a6d2ecbf0dd252aa5c0f09cfa71 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, destination=/etc/opt/kerberosio/capture, driver=local, propagation=, read/write=true)
2020-02-09T20:53:58.380225164Z volume mount a2665ad5fd450b87d43a12ac397c12d7d1c420773d4c0801fbfe998a31460c43 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, destination=/etc/opt/kerberosio/config, driver=local, propagation=, read/write=true)
2020-02-09T20:53:58.380707163Z volume mount dab942a5b901f5024570eef77e7227f22c366ef0f396352209b9082993048124 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, destination=/etc/opt/kerberosio/logs, driver=local, propagation=, read/write=true)
2020-02-09T20:53:58.381287162Z volume mount 9c0dd533d2afc565ec22f6f8ad08ef27d05103f4ebf0e8877f285b8897bc8306 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, destination=/var/www/web/config, driver=local, propagation=, read/write=true)
camera1
2020-02-09T20:54:03.377042665Z container start 0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3 (image=kerberos/kerberos, name=camera1)
pi@pi-zero-w:~ $ 2020-02-09T20:54:04.389089139Z container die 0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3 (exitCode=139, image=kerberos/kerberos, name=camera1)
2020-02-09T20:54:05.106594056Z network disconnect 68c43e2bab7308ed42fbf78d10f81317e404e7e69454c3778077f8f168a1d63a (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, name=bridge, type=bridge)
2020-02-09T20:54:05.247325843Z volume unmount 9c28d6d5b3bfe657ab416ab414ca585657bc8a6d2ecbf0dd252aa5c0f09cfa71 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, driver=local)
2020-02-09T20:54:05.253083835Z volume unmount a2665ad5fd450b87d43a12ac397c12d7d1c420773d4c0801fbfe998a31460c43 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, driver=local)
2020-02-09T20:54:05.254248833Z volume unmount dab942a5b901f5024570eef77e7227f22c366ef0f396352209b9082993048124 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, driver=local)
2020-02-09T20:54:05.260828823Z volume unmount 9c0dd533d2afc565ec22f6f8ad08ef27d05103f4ebf0e8877f285b8897bc8306 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, driver=local)

@cedricve
Copy link
Member

@KarlBaumann do you have any more debugging info?

@KarlBaumann
Copy link
Author

Not really, I am new to Docker so I did not know how to debug it better.
Afterwards I uninstalled docker and installed it the "Raspbian" way.
This method kind a works, but very often kerberosio service is getting killed by OOM killer and I think this might have been the case with docker as well. Basically there is not enough RAM available.
I can try to set up the docker environment again later if that helps.

@cedricve
Copy link
Member

Not really, I am new to Docker so I did not know how to debug it better.
Afterwards I uninstalled docker and installed it the "Raspbian" way.
This method kind a works, but very often kerberosio service is getting killed by OOM killer and I think this might have been the case with docker as well. Basically there is not enough RAM available.
I can try to set up the docker environment again later if that helps.

Thanks that would be of great help.

@KarlBaumann
Copy link
Author

okay, after I set it up again, what would be the steps to get more debugging info?

@cedricve
Copy link
Member

try to run the docker container and run docker logs.

@KarlBaumann
Copy link
Author

Logs are compleately empty. I also do not see any messages in /var/log/messages about OOM killer, so it must be something else.

Could it be that that Docker image is simply not compatible with Pi Zero? Has anyone ever tested it?

@cedricve
Copy link
Member

cedricve commented Feb 13, 2020

its an armv7 processor?

@KarlBaumann
Copy link
Author

ARMv6:
image

@cedricve
Copy link
Member

interesting, which image did it download can you inspect the docker image kerberos/kerberos

@KarlBaumann
Copy link
Author

@cedricve
Copy link
Member

Thanks what happens if you just do docker run -p 80:80 -p 8889:8889 kerberos/kerberos.

@KarlBaumann
Copy link
Author

nothing
image

@cedricve
Copy link
Member

@KarlBaumann
Copy link
Author

Compleately the same with that image

@cedricve
Copy link
Member

will look into this @KarlBaumann

@cedricve cedricve added the bug label Mar 27, 2020
@cedricve cedricve self-assigned this Mar 27, 2020
@dbwest
Copy link

dbwest commented Aug 27, 2020

Hi, I have a whole bunch of Raspberry Pi Zero Ws. And I am very psyched about getting kerberos.io working with them using Docker. uname -r on the units reveal they are ARMv6. I noticed there was no ARMv6 build in the Docker Hub registry. I also noticed that the instructions for cross compiling are on the readme.md. I tried a cross compile for ARMv6 and the build fails when grabbing PHP 7.1 packages from sury.org for debian stretch. I'll contact Sury about ARMv6 PHP packages, or changes to the Dockerfile might work. I have tried changing the PHP version, but that is all.

@dbwest
Copy link

dbwest commented Aug 27, 2020

FWIW... I opened this on Surý's bug tracker:
oerdnj/deb.sury.org#1455

@cedricve
Copy link
Member

thanks @dbwest yes we still need to add support for ARMv6, thanks for helping ;)

@dbwest
Copy link

dbwest commented Aug 27, 2020

Wow, immediately heard back that there is no support and no intention to support armv6 from Surý. I am seeing if a Raspian base image is a thing because there is an ArmPort for Raspian that supports hard-float and targets armv6.

@cedricve
Copy link
Member

cedricve commented Aug 27, 2020 via email

@dbwest
Copy link

dbwest commented Aug 27, 2020

That sounds good. I am doing some sort of hackery now where I changed the Dockerfile in my fork. Build is here and going now. It has at least gotten to the NASM bit with some changes to use Raspbian and get Node differently:
https://github.com/dbwest/kerberos-docker/runs/1036980595?check_suite_focus=true

You are right about an additional Dockerfile, or something better organized than what I am trying now. Provided this builds and pushes to my Dockerhub, I'll test it on some hardware.

The rest is organization and preferences and I'll leave the direction up to you on how to organize and fold it in to the upstream if desired.

@cedricve
Copy link
Member

That would be great @dbwest let me know if you need help or would get stuck. More then happy to help!

@dbwest
Copy link

dbwest commented Aug 27, 2020

So it looks like it built.
I am going to try deploying it to the pi zero w I want to use with kerberos.io, and if it works I will tidy this up and do a pull request with a new Dockerfile and submit for review.

https://hub.docker.com/repository/docker/dbwest/kerberos-io

@cedricve
Copy link
Member

cedricve commented Aug 27, 2020 via email

@dbwest
Copy link

dbwest commented Aug 27, 2020

I deployed it and there are still problems. Attaching the log FWIW. I tried deploying to balena.io with this repo: https://github.com/dbwest/kerberos

Logs attached from the failing service...
Capture
kerberos-balena-dbw_young-frog-27.08.20_17_27_16_(-0400).txt

I'll hook up the Pi Zero W soon, after I finish some other things I have to do, and get some debugging in with the image I uploaded to Docker hub, maybe by supressing the entrypoint and going into the container without it and trying to start things up inside and poke around.

@cedricve
Copy link
Member

cedricve commented Aug 28, 2020

Thanks for sharing ;) Can you show contents of run.sh

    27.08.20 16:22:13 (-0400) <main> /run.sh: line 49:    13 Done     

@dbwest
Copy link

dbwest commented Aug 29, 2020

#!/bin/bash

autoremoval() {
  while true; do
    sleep 60
    if [[ $(df -h /etc/opt/kerberosio/capture | tail -1 | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 90 ]];
    then
      echo "Cleaning disk"
      find /etc/opt/kerberosio/capture/ -type f | sort | head -n 100 | xargs rm;
    fi;
  done
}

copyConfigFiles() {
  # Check if the config dir is empty, this can happen due to mapping
  # an empty filesystem to the volume.
  TEMPLATE_DIR=/etc/opt/kerberosio/template
  CONFIG_DIR=/etc/opt/kerberosio/config
  if [ "$(ls -A $CONFIG_DIR)" ]; then
      echo "Config files are available."
  else
      echo "Config files are missing, copying from template."
      cp /etc/opt/kerberosio/template/* /etc/opt/kerberosio/config/
      chmod -R 777 /etc/opt/kerberosio/config
  fi

  # Do the same for the web config
  TEMPLATE_DIR=/var/www/web/template
  CONFIG_DIR=/var/www/web/config
  if [ "$(ls -A $CONFIG_DIR)" ]; then
      echo "Config files are available."
  else
      echo "Config files are missing, copying from template."
      cp /var/www/web/template/* /var/www/web/config/
      chmod -R 777 /var/www/web/config
  fi
}

# replace SESSION_COOKIE_NAME
random=$((1+RANDOM%10000))
sed -i -e "s/kerberosio_session/kerberosio_session_$random/" /var/www/web/.env

autoremoval &
copyConfigFiles &

# changes for php 7.1
echo "[www]" > /etc/php/7.1/fpm/pool.d/env.conf
echo "" >> /etc/php/7.1/fpm/pool.d/env.conf
env | grep "KERBEROSIO_" | sed "s/\(.*\)=\(.*\)/env[\1]='\2'/" >> /etc/php/7.1/fpm/pool.d/env.conf
service php7.1-fpm start

/usr/bin/supervisord -n -c /etc/supervisord.conf

I poked around more in that container, and although cat works, ls and sed and other common utilities give segfaults. Think if I redo that container and add back in some common utilities then it will work...

@cedricve
Copy link
Member

@dbwest thanks, let us know if you have any break through ;)

@cedricve
Copy link
Member

@dbwest not sure if already changed something? I have some time to elaborate on this issue.

@kubo6472
Copy link

How is this handled on KiOS, that works with RPi Zero W no problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants