mmcc-xx / BirdCAGE

180 stars 18 forks source link

"exec ./start_app.sh: exec format error" on Dietpi Pi4 #19

Closed qwasy closed 1 year ago

qwasy commented 1 year ago

Im using an Pi4 4GB, with Dietpi 8.17.2 (latest atm) I modified the docker-compose.yaml IP, created the directories and pulled the container. But I get a exec format error. The complete docker-compose up log is:

birdcage-redis-1 | 1:C 26 May 2023 07:08:24.062 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo birdcage-redis-1 | 1:C 26 May 2023 07:08:24.062 # Redis version=7.0.11, bits=64, commit=00000000, modified=0, pid=1, just started birdcage-redis-1 | 1:C 26 May 2023 07:08:24.063 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf birdcage-redis-1 | 1:M 26 May 2023 07:08:24.076 monotonic clock: POSIX clock_gettime birdcage-redis-1 | 1:M 26 May 2023 07:08:24.091 Running mode=standalone, port=6379. birdcage-redis-1 | 1:M 26 May 2023 07:08:24.091 # Server initialized birdcage-redis-1 | 1:M 26 May 2023 07:08:24.092 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. birdcage-redis-1 | 1:M 26 May 2023 07:08:24.122 * Ready to accept connections birdcage-birdnetserver-1 | exec /usr/local/bin/python3: exec format error birdcage-birdcage_backend-1 | exec ./start_app.sh: exec format error birdcage-birdcage_frontend-1 | exec ./start_app.sh: exec format error birdcage-birdnetserver-1 exited with code 1 birdcage-birdcage_backend-1 exited with code 1 birdcage-birdnetserver-1 exited with code 1 birdcage-birdcage_frontend-1 exited with code 1

Am I missing something?

mmcc-xx commented 1 year ago

I haven't pushed images for the ARM platform, so I'm not surprised it doesn't work.

I'll look into doing so, but will have to rely on you do to the testing. I'll leave this open until I push some images and someone can try them out.

There is a project called BirdNET-Pi that is made especially for the pi (whose functionally I am significantly inspired by), but I think it expects to kind of "own" the machine.

Thanks!

mmcc-xx commented 1 year ago

OK I pushed arm64 images, which in theory should work on a Pi4 with a 64 bit OS installed. Please give it a try. You might need to decrease the concurrency environment variable. Then again, maybe not. Also it probably wouldn't hurt to delete any amd64 images that might have gotten downloaded to your Pi.

I'm going to see if I managed to screw up the amd64 images in the process.

qwasy commented 1 year ago

Short answer, no I tried it on the Pi4, still got the exec error. But Dietpi is aarch64, maybe that's a different docker tag thingi? I also tried it on an oralce ARM Server, there I get a "no matching manifest for linux/arm64/v8 in the manifest list entries " error. Both times, I deleted the old images and containers and rebuild it from scratch.

mmcc-xx commented 1 year ago

This is the build command I'm using: docker buildx build --platform linux/arm64 -t " mmcc73/birdnetserver:latest" --push .

I'll poke around to see if there's another platform I should be choosing.

mmcc-xx commented 1 year ago

OK - please try again. I think I had screwed up the build process. Perhaps now it is working?

Here are the current manifests. If you get the same error on your Pi, I'd like to confirm that it is pulling the right image. I think you can put @shablahblahblah from the manifest after the image name to specify the exact image you want.

For birdnetserver...

$ docker manifest inspect mmcc73/birdnetserver:latest                                                             {
   "schemaVersion": 2,
   "mediaType": "application/vnd.oci.image.index.v1+json",
   "manifests": [
      {
         "mediaType": "application/vnd.oci.image.manifest.v1+json",
         "size": 2018,
         "digest": "sha256:4dc5ffa756d6395720e2e41dbf93971ea3a79450e16b3193e8b56f56f9569838",
         "platform": {
            "architecture": "arm64",
            "os": "linux"
         }
      },

For birdcage_backend...

$ docker manifest inspect mmcc73/birdcage_backend:latest
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.oci.image.index.v1+json",
   "manifests": [
      {
         "mediaType": "application/vnd.oci.image.manifest.v1+json",
         "size": 3353,
         "digest": "sha256:3f91623e45ed99b61cbe9dfdee5bbc5d05c9c4d7ea95eaf6bd754d70a24e8bb5",
         "platform": {
            "architecture": "arm64",
            "os": "linux"
         }
      },

For birdcage_frontend...

$ docker manifest inspect mmcc73/birdcage_frontend:latest
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.oci.image.index.v1+json",
   "manifests": [
      {
         "mediaType": "application/vnd.oci.image.manifest.v1+json",
         "size": 3342,
         "digest": "sha256:0ea531d7e71287903732eb88e2ff9e8f55ca74378fd635b9f8b5c7ea80e46a13",
         "platform": {
            "architecture": "arm64",
            "os": "linux"
         }
      },
qwasy commented 1 year ago

So, on my Pi the container look like this:

docker manifest inspect mmcc73/birdnetserver:latest { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 2018, "digest": "sha256:4dc5ffa756d6395720e2e41dbf93971ea3a79450e16b3193e8b56f56f9569838", "platform": { "architecture": "arm64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 2018, "digest": "sha256:c0dc2f6c96fe5bd8c0d367c45d279619cc171a35d2afc1c6504f8e0b78e94230", "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 566, "digest": "sha256:de40dd7af7f09936a5d3fec9f2dd706dc2c03ae6c6c718cbf8c8971724e9500a", "platform": { "architecture": "unknown", "os": "unknown" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 566, "digest": "sha256:9471fc69afa7ff65931a80ca419201deea9c4edf453f6a46d3aedf2476ecf726", "platform": { "architecture": "unknown", "os": "unknown" } } ] }

docker manifest inspect mmcc73/birdcage_backend:latest { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 3353, "digest": "sha256:3f91623e45ed99b61cbe9dfdee5bbc5d05c9c4d7ea95eaf6bd754d70a24e8bb5", "platform": { "architecture": "arm64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 3353, "digest": "sha256:33ee6d1bedbfb3f122d97a1db92b1ef78f8424abb9e4b8c990944f0be41b30c1", "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 566, "digest": "sha256:a74735d4c4a0d4e3519342501ea999dbc504387bead2cb34c49f0d20f2c08204", "platform": { "architecture": "unknown", "os": "unknown" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 566, "digest": "sha256:25dff7c6c3f9288c29a883b7663f4559ffbd122e92a0456daeeb793483b13bef", "platform": { "architecture": "unknown", "os": "unknown" } } ] }

docker manifest inspect mmcc73/birdcage_frontend:latest { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 3342, "digest": "sha256:0ea531d7e71287903732eb88e2ff9e8f55ca74378fd635b9f8b5c7ea80e46a13", "platform": { "architecture": "arm64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 3342, "digest": "sha256:17d0d75581eb2b3707d4080c5e28b70bb0994a765f344740c217c70dd2590774", "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 566, "digest": "sha256:4fd16d5b8719ade27af129ca17372c6e9ab981f88982cd38b24dc9eec73f26f5", "platform": { "architecture": "unknown", "os": "unknown" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 566, "digest": "sha256:237cb1729fadbea94f6164277ff0f760bea9ce1e67aab08ef01c4b9d322457a0", "platform": { "architecture": "unknown", "os": "unknown" } } ] }

And they are starting, at least a bit more than before :D birdnetserver has a new error:

birdcage-birdnetserver-1 | Traceback (most recent call last): birdcage-birdnetserver-1 | File "server.py", line 12, in birdcage-birdnetserver-1 | import analyze birdcage-birdnetserver-1 | File "/analyze.py", line 15, in birdcage-birdnetserver-1 | import model birdcage-birdnetserver-1 | File "/model.py", line 17, in birdcage-birdnetserver-1 | import tflite_runtime.interpreter as tflite birdcage-birdnetserver-1 | File "/usr/local/lib/python3.8/site-packages/tflite_runtime/interpreter.py", line 33, in birdcage-birdnetserver-1 | from tflite_runtime import _pywrap_tensorflow_interpreter_wrapper as _interpreter_wrapper birdcage-birdnetserver-1 | ImportError: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/local/lib/python3.8/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so)

redis and frontend seem to work.

The oracle ARM server has the same GLIBC_2.33 error.

mmcc-xx commented 1 year ago

Progress!

mmcc-xx commented 1 year ago

If you are so inclined, try getting a shell into the birdnetserver container and do this:

pip uninstall grpcio
pip uninstall grpcio-status
pip install grpcio==1.44.0 --no-binary=grpcio
pip install grpcio-tools==1.44.0 --no-binary=grpcio-tools

Several places on The Internet have suggested this as a fix. In the mean time I'll start the build of a test image with this setup.

Apparently installing like this takes a lonnggg time as grpcio is built locally. But, it gets built against the GLIBC version that is there.

qwasy commented 1 year ago

The birdnetserver container keeps restarting all the time, getting a shell is not possible. I'll wait for your updated container.

mmcc-xx commented 1 year ago

Just as well... you'd have to install the build environment as well.

I've got it building and will advise when it is done. I have it pushing to mmcc73/birdnetserver_arm64:latest

mmcc-xx commented 1 year ago

OK - please try again, replacing mmcc73/birdnetserver:latest with mmcc73/birdnetserver_arm64:latest in your docker-compose file.

I've also made an arm64 vm to test stuff on as well.

mmcc-xx commented 1 year ago

OK - don't bother. I got the same error when trying it on my arm64 VM. I'm going to try something else and push another build.

mmcc-xx commented 1 year ago

I think we might have a winner, at lease for the birdnetserver image.

Please try again, replacing mmcc73/birdnetserver:latest with mmcc73/birdnetserver_arm64:latest in your docker-compose file.

I specified an older version of tflite_runtime and built grpcio. I was able to get the image to run on my arm64 VM.

qwasy commented 1 year ago

Yessss It's alive :D On the Dietpi Pi4 it's working fine. I tried it with some youtube live stream, and the logs show it detects some bird. Docker stats say max about 20% CPU and 500mb RAM usage for birdnetserver, 600mb and max of 100% CPU for birdnet backend. I can provide some logs, if you need? But yeah, it's working. (I didn't try oracle ARM yet)

Now I just need a microphone :D

mmcc-xx commented 1 year ago

That's awesome news!

Regarding microphone, this software doesn't have a way to read in from the sound card, if that's what you are thinking of doing. You'll need to somehow translate the sound input to an rtsp, rtmp or http stream. Maybe go2rtc would do such a thing? Or, consider getting a camera that provides an rtsp stream.

qwasy commented 1 year ago

I tried it as well on the oracle ARM server. It's working there fine. I'm having some problems with the reverse proxy. But that's something I will figure out when I got more time. Oracle is sometimes a pain with the IP v4 stuff...

Regarding the mic, yeah... I'm waiting for some i2s mic from aliexpress. I'll try that first with an esp and streaming. If they are to low quality, I'll search for a cloud free wifi cam with mic.

mmcc-xx commented 1 year ago

Regarding the mic, yeah... I'm waiting for some i2s mic from aliexpress. I'll try that first with an esp and streaming. If they are to low quality, I'll search for a cloud free wifi cam with mic.

I've been there... here's what I've experienced.

I could not get rtsp streaming to work, but I was able to get http streaming working.

I think the highest sample rate I was able to get working was 32KHz at 16 bit. It was much better than the mic in my camera.

However, it was not super reliable.

These libraries are super good: https://github.com/pschatzmann/arduino-audio-tools

I'll try to post the source code of what I did, but mostly it is copy and past of his examples.

That said, once I get this project in a place that I'm happy leaving it for a while, I'd like to work on a satellite recorder. I'm thinking rather than streaming audio, I'll set it up to capture audio and store the clips locally for some period of time, and then periodically turn on the wifi and push the clips to the server. This will help minimize radio interference while recording and will use less power, perhaps enabling it to run via battery power for a reasonable period of time.

I'm also thinking there would be a sneaker-net mode where a person would manually upload the clips if the recorder were placed somewhere outside of wifi range.

mmcc-xx commented 1 year ago

Since this seems to be working, I'm going to close this issue!