Nekmo / amazon-dash

Hack your Amazon Dash to run what you want.
MIT License
828 stars 67 forks source link

Raspberry: How to run it on a Pi #116

Open narfel opened 5 years ago

narfel commented 5 years ago

What is the purpose of your issue?

Well neither of my two things are a bug, but maybe it helps someone trying to get a docker container running. The docker image in the wiki is not for arm devices and is not marked as such. The error message "exec format error"" may also be a bit unspecific, although the whole thing just works on e.g. a raspberry. You have to build the image from the docker file (on the Pi) and then run it as instructed with something like: "docker run -it --network=host --name amazon-dash -v local_docker_datadir:/config nekmo/amazon-dash:latest amazon-dash run --ignore-perms --root-allowed --config /config/amazon-dash.yml" This example line has an additional --name flag to start/stop the container easier and i had to omit the amazon-dash.yml when running the docker image otherwise it would (again misleadingly) complain about not being able to connect to /config/amazon-dash.yml because it is a directory. Hint: It's not :)

Nekmo commented 5 years ago

I am not an expert in Docker, but as I know architecture should not be a problem. The program to be executed is native Python code and there are no dependencies not compatible with ARM.

Can you please paste the complete error messages? Thanks!

narfel commented 5 years ago

Neither am I sadly. But the problem is not with python, python tools or any of your code. Just that the container is not a multiarch or armhf. The base image architecture that was used to build the image is not armhf and will not run on a pi/arm device. If you build it yourself you will build a container for whatever architecture you are on. It sounds complicated and against dockers stipulation, but there is no way docker magically makes a architecture leap. That's at least as i understand it. The exact error message is "standard_init_linux.go:#: exec user process caused "exec format error"" with the number being whatever line the script fails. But it is misleading, there is no script error. It's just the first thing that breaks.

Nekmo commented 5 years ago

I have no chance to try, but you can change the image used in the Dockerfile. Replace "FROM python:3.7-alpine" with "FROM arm32v7/python:3.7.2-alpine3.7"

https://hub.docker.com/r/arm32v7/python/

If this works for you I can document it. Thanks!

narfel commented 5 years ago

I'm not sure if we're misunderstanding each other. I'm just talking about the image you get when you do a pull with docker pull nekmo/amazon-dash:latest That doesn't work on arm. If you build the image yourself from the docker file with docker image build <image name> you get all platform dependencies automatically resolved and it works. The Docker build process automatically takes the arm versions needed. There is no need to change the docker file as is.

tl;dr: If you want to use nekmo/amazon-dash on an arm device, you can't just run docker pull nekmo/amazon-dash, but instead have to run docker build -t nekmo/amazon-dash:latest .

Nekmo commented 5 years ago

I'm going to investigate how the Docker image can be uploaded using ARM. I do not have much experience about Docker Hub, thanks.

airdrummingfool commented 5 years ago

Thanks @narfel , I had no idea you could just build a Docker image directly on your device to avoid an architecture mismatch - that is a game-changer!

@Nekmo It might be helpful to add a note to the Readme about this. Since you can't run the image as-is from the Docker Hub, you have to build it locally and then use that custom-built image.

Here's what I did:

  1. Build the image (I called mine amazon-dash-rpi)
    sudo docker image build --tag amazon-dash-rpi --file Dockerfile https://github.com/Nekmo/amazon-dash.git
  2. Use "amazon-dash-rpi" in place of "nekmo/amazon-dash:latest" in the docker run command (or the docker-compose.yml file)
Nekmo commented 5 years ago

I will try to update the Docker hub image for Raspberry Pi users :+1:

zachsteffens commented 5 years ago

@airdrummingfool

sudo docker image build --tag amazon-dash-rpi --file Dockerfile https://github.com/Nekmo/amazon-dash.git

didn't work for me. had some unsatisfiable constraints.


  libpcap-1.9.0-r1:
    breaks: world[libpcap=1.8.1-r1]
    satisfies: tcpdump-4.9.2-r4[so:libpcap.so.1]
  scapy-2.4.2-r0:
    breaks: world[scapy=2.4.0-r0]
  tcpdump-4.9.2-r4:
    breaks: world[tcpdump=4.9.2-r3]```
xtools-at commented 5 years ago

I've had some troubles on a RPi too and was able to fix the broken scapy-install by getting it from apt: sudo apt-get install python-scapy (using Python 3.5) maybe this will do it for you: sudo apt-get install libcap-dev tcpdump python-scapy

shoejosh commented 5 years ago

For anyone else needing this for pi, I went ahead and pushed an image built on my pi until an an official ARM image is available from @Nekmo .

shoejosh/amazon-dash-rpi

The only change I made was to update a few dependencies to match the versions I already had installed on my pi so the image would build.

madbear2000 commented 5 years ago

Thanks @xtools-at I was having the same problem but your suggest install fixed the issue. @shoejosh Thanks also for the docker image it will be very useful

MaObOriginal commented 4 years ago

Any updates on this? Does an official arm image exist?