AbdBarho / stable-diffusion-webui-docker

Easy Docker setup for Stable Diffusion with user-friendly UI
Other
6.71k stars 1.12k forks source link

download-1 | exec /docker/download.sh: exec format error #619

Open blue-eyed-g opened 11 months ago

blue-eyed-g commented 11 months ago

I follow the page:https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Setup git clone the repo,then docker compose --profile download up --build in the folder. and then an error occured: [+] Building 2.2s (9/9) FINISHED docker:default => [download internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [download internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 171B 0.0s => [download internal] load metadata for docker.io/library/bash:alpine3.15 2.1s => [download 1/4] FROM docker.io/library/bash:alpine3.15@sha256:463b668dccc38f32a5b 0.0s => [download internal] load build context 0.0s => => transferring context: 128B 0.0s => CACHED [download 2/4] RUN apk add parallel aria2 0.0s => CACHED [download 3/4] COPY . /docker 0.0s => CACHED [download 4/4] RUN chmod +x /docker/download.sh 0.0s => [download] exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:5f350568a8839f416aa58d37fca2ec7538cf1439febec1aad3fb7a2d 0.0s => => naming to docker.io/library/webui-docker-download 0.0s [+] Running 1/0 ✔ Container webui-docker-download-1 Created 0.0s Attaching to download-1 download-1 | exec /docker/download.sh: exec format error download-1 exited with code 1

i don't know how to solve it, can anybody help me? thanks

simonmcnair commented 10 months ago

can you verify download.sh ?

blue-eyed-g commented 10 months ago

can you verify download.sh ?

sorry, i cant. i dont know how to open download.sh.

jsjolund commented 10 months ago

Can you describe in more detail how to reproduce this? Follow the bug report template that you deleted when you wrote the issue:

Hardware / Software

blue-eyed-g commented 10 months ago

Has this issue been opened before?

Describe the bug try to run docker compose --profile download up --build, and then error occure:

[+] Building 2.2s (9/9) FINISHED docker:default => [download internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [download internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 171B 0.0s => [download internal] load metadata for docker.io/library/bash:alpine3.15 2.1s => [download 1/4] FROM docker.io/library/bash:alpine3.15@sha256:463b668dccc38f32a5b 0.0s => [download internal] load build context 0.0s => => transferring context: 128B 0.0s => CACHED [download 2/4] RUN apk add parallel aria2 0.0s => CACHED [download 3/4] COPY . /docker 0.0s => CACHED [download 4/4] RUN chmod +x /docker/download.sh 0.0s => [download] exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:5f350568a8839f416aa58d37fca2ec7538cf1439febec1aad3fb7a2d 0.0s => => naming to docker.io/library/webui-docker-download 0.0s [+] Running 1/0 ✔ Container webui-docker-download-1 Created 0.0s Attaching to download-1 download-1 | exec /docker/download.sh: exec format error download-1 exited with code 1

Which UI

no

Hardware / Software

Steps to Reproduce

  1. git clone https://github.com/AbdBarho/stable-diffusion-webui-docker.git
  2. cd stable-diffusion-webui-docker/
  3. docker compose --profile download up --build
  4. See error

Additional context no

DevilaN commented 10 months ago

CRLF vs CR line endings issue maybe?

Conversion is done by local git during pulling files. This behavior depends on git configuration.

blue-eyed-g commented 10 months ago

CRLF vs CR line endings issue maybe?

Conversion is done by local git during pulling files. This behavior depends on git configuration.

How to check if the configuration is correct? i did not modify any configuration on git global or repo

simonmcnair commented 10 months ago

The files you're talking about haven't been updated in 5 months or so, and no one else has reported the issue. This leads me to believe that you may have corruption or an interrupted download. I would recommend deleting the tree and starting again from scratch and seeing if it happens again.

simonmcnair commented 10 months ago

I would also ensure that you are using docker installed from https://docs.docker.com/desktop/install/archlinux/ not from any distribution package manager.

I am using Debian and it works fine for me.

jsjolund commented 10 months ago

I would also ensure that you are using docker installed from https://docs.docker.com/desktop/install/archlinux/ not from any distribution package manager.

I am using Debian and it works fine for me.

I am using Arch Linux, and the docker from the package manager works fine.

simonmcnair commented 10 months ago

I would also ensure that you are using docker installed from https://docs.docker.com/desktop/install/archlinux/ not from any distribution package manager. I am using Debian and it works fine for me.

I am using Arch Linux, and the docker from the package manager works fine.

I am sure it does work fine. It probably just doesn't satisfy the requirements of https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Setup which state https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Setup#make-sure-you-have-the-latest-version-of-docker-and-docker-compose-installed

Normally there is a delay between Docker releasing packages, and arch, or whichever distribution, repackaging them for their package manager. But if it works for you that's great. I was just covering the out of date docker angle.

DevilaN commented 10 months ago

If you have git-bash installed then in the shell you can check it using file command like this:

Correct line endings:

$ file services/download/download.sh 
services/download/download.sh: Bourne-Again shell script, ASCII text executable

Incorrect line endings:

$ file services/download/download.sh 
services/download/download.sh: Bourne-Again shell script, ASCII text executable, with CRLF line terminators
jsjolund commented 10 months ago

I am sure it does work fine. It probably just doesn't satisfy the requirements of https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Setup which state https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Setup#make-sure-you-have-the-latest-version-of-docker-and-docker-compose-installed

Normally there is a delay between Docker releasing packages, and arch, or whichever distribution, repackaging them for their package manager. But if it works for you that's great. I was just covering the out of date docker angle.

Slightly off-topic, but it does satisfy the version requirement (docker version 24.0.7).

https://docs.docker.com/engine/release-notes/24.0/

https://archlinux.org/packages/extra/x86_64/docker/

Arch Linux is a rolling-release distro and updates packages much faster than Debian.

simonmcnair commented 10 months ago

I am sure it does work fine. It probably just doesn't satisfy the requirements of https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Setup which state https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Setup#make-sure-you-have-the-latest-version-of-docker-and-docker-compose-installed Normally there is a delay between Docker releasing packages, and arch, or whichever distribution, repackaging them for their package manager. But if it works for you that's great. I was just covering the out of date docker angle.

Slightly off-topic, but it does satisfy the version requirement (docker version 24.0.7).

https://docs.docker.com/engine/release-notes/24.0/

https://archlinux.org/packages/extra/x86_64/docker/

Arch Linux is a rolling-release distro and updates packages much faster than Debian.

lol. It's later than mine ;-)

Docker version 24.0.2, build cb74dfc

[edit] one of my machines was up to date, one wasn't. turns out my sources on one machine didn't have docker in it. thanks for the assist !

jsjolund commented 10 months ago

@blue-eyed-g

I am also using Arch, with the same docker version, although with the standard kernel (not zen), and the download works for me.

Although git makes corrupted files unlikely, have you tried cloning again and re-running?

Also, please post your /etc/docker/daemon.json. It should look something like this:

{
  "runtimes": {
    "nvidia": {
      "path": "/usr/bin/nvidia-container-runtime",
      "runtimeArgs": []
    }
  },
  "default-runtime": "nvidia",
  "max-concurrent-uploads": 2,
  "features": {
    "buildkit": true
  }
}

Edit:

Also, are you using some unusual file system like zfs?

simonmcnair commented 10 months ago

@blue-eyed-g

I am also using Arch, with the same docker version, although with the standard kernel (not zen), and the download works for me.

Although git makes corrupted files unlikely, have you tried cloning again and re-running?

Also, please post your /etc/docker/daemon.json. It should look something like this:

{
  "runtimes": {
    "nvidia": {
      "path": "/usr/bin/nvidia-container-runtime",
      "runtimeArgs": []
    }
  },
  "default-runtime": "nvidia",
  "max-concurrent-uploads": 2,
  "features": {
    "buildkit": true
  }
}

Edit:

Also, are you using some unusual file system like zfs?

Another thing I learnt. I installed nvidia-container-runtime, but I never executed sudo nvidia-ctk runtime configure --runtime=docker

I wonder why I didn't get any errors.

blue-eyed-g commented 10 months ago

@jsjolund I am also using Arch, with the same docker version, although with the standard kernel (not zen), and the download works for me. Although git makes corrupted files unlikely, have you tried cloning again and re-running? Also, please post your /etc/docker/daemon.json. It should look something like this:

{
  "runtimes": {
    "nvidia": {
      "path": "/usr/bin/nvidia-container-runtime",
      "runtimeArgs": []
    }
  },
  "default-runtime": "nvidia",
  "max-concurrent-uploads": 2,
  "features": {
    "buildkit": true
  }
}

Edit: Also, are you using some unusual file system like zfs?

Another thing I learnt. I installed nvidia-container-runtime, but I never executed sudo nvidia-ctk runtime configure --runtime=docker

I wonder why I didn't get any errors.

I have tried remove the repo(rm -r stable-diffusion-webui-docker),remve the image((webui-docker-download:latest) and container(webui-docker-download-1). Then restart my arch. Clone the repo and run again. But the same error appeared.

This is my /etc/docker/daemon.json

{ "runtimes": { "nvidia": { "path": "nvidia-container-runtime", "runtimeArgs": [] } },

"data-root": "/home/username/docker"

}

simonmcnair commented 10 months ago

what happens when you run this from a terminal ? /usr/bin/env bash

blue-eyed-g commented 10 months ago

what happens when you run this from a terminal ? /usr/bin/env bash

nothing

blue-eyed-g commented 10 months ago

If you have git-bash installed then in the shell you can check it using file command like this:

Correct line endings:

$ file services/download/download.sh 
services/download/download.sh: Bourne-Again shell script, ASCII text executable

Incorrect line endings:

$ file services/download/download.sh 
services/download/download.sh: Bourne-Again shell script, ASCII text executable, with CRLF line terminators

Thanks, I have checked and it is correct

jsjolund commented 10 months ago

Well, I am out of ideas, so I asked ChatGPT:

Assuming the Dockerfile and script are correct and work on other systems, it's less likely that the issue is with the Docker system configuration itself. However, there are a few Docker-related aspects that might cause or contribute to the "exec format error" in certain scenarios:

To troubleshoot further, you can try running the container on a different system with a similar environment or checking the Docker daemon logs for more detailed error messages. Additionally, verifying that the Docker version is up-to-date and consistent with the version used in the working systems could also provide clues.

jsjolund commented 10 months ago

@blue-eyed-g

Just to make sure, have you checked that the folder /home/username/docker actually exists?

blue-eyed-g commented 10 months ago

thanks you everyone, maybe the problem is from download.sh, i just add echo "Script is starting after the line #!/usr/bin/env bash, then it works. but i dont know why.

lrstanley commented 10 months ago

FWIW, exec format error is very likely to be a mismatch in CPU architecture (funnily enough, also noted here by chatgpt https://github.com/AbdBarho/stable-diffusion-webui-docker/issues/619#issuecomment-1829780349). These are the two most common situations I've seen:

  1. mismatch inside of the given container/image.
    • e.g. one of the cli binaries, in this case bash, aria2c, or parallel from what I see in the download.sh script, being x86_64 (because of the base image being pulled), not being runnable by your architecture.
  2. mismatch between what architecture in general the container/image was built with.
    • usually caused by pulling down the wrong image, the "default" (and only) architecture type of the image not being the one you're running with, etc.
simonmcnair commented 10 months ago

FWIW, exec format error is very likely to be a mismatch in CPU architecture (funnily enough, also noted here by chatgpt #619 (comment)). These are the two most common situations I've seen:

  1. mismatch inside of the given container/image.

    • e.g. one of the cli binaries, in this case bash, aria2c, or parallel from what I see in the download.sh script, being x86_64 (because of the base image being pulled), not being runnable by your architecture.
  2. mismatch between what architecture in general the container/image was built with.

    • usually caused by pulling down the wrong image, the "default" (and only) architecture type of the image not being the one you're running with, etc.

I strongly disagree with this statement ;-). I don't know many people running Stable diffusion on ARM and x64 is pretty much a base requirement to do anything useful on Docker. I would say over 99.8% of people will be running x86_64. Just my opinion though.

simonmcnair commented 10 months ago

For me the most common reasons are probably carriage return, line feed conventions between Windows and Linux, corrupt download (although git shouldn't do that), corrupt filesystem (also unlikely). Out dated Docker, or failure of aria to download a file.