azerothcore / azerothcore-wotlk

Complete Open Source and Modular solution for MMO
http://www.azerothcore.org
GNU Affero General Public License v3.0
6.55k stars 2.63k forks source link

Container ac-db-import service "ac-db-import" didn't complete successfully: exit 1 #17656

Closed sw586 closed 9 months ago

sw586 commented 1 year ago

Current Behaviour

微信截图_20231108090403 微信截图_20231108090443 微信截图_20231108090630 Each step is based on the operation: https://www.azerothcore.org/wiki/install-with-docker Executing: docker compose up -d --build Error reported later: Container ac-db-import service "ac-db-import" didn't complete successfully: exit 1

Expected Blizzlike Behaviour

Docker version 24.0.7, build afdd53b Docker Compose version v2.21.0 CPU: ARM

Source

No response

Steps to reproduce the problem

https://www.azerothcore.org/wiki/install-with-docker git clone https://github.com/azerothcore/azerothcore-wotlk.git --depth 1 cd azerothcore-wotlk docker compose up -d --build

Extra Notes

No response

AC rev. hash/commit

Container ac-db-import service "ac-db-import" didn't complete successfully: exit 1

Operating system

Ubuntu 20.04 ARM

Custom changes or Modules

No response

Daeymon commented 12 months ago

I'm also unable to deploy a fresh build from this repo with docker compose up -d --build (no modules, fresh download of repo). Mine ends in: service "ac-db-import" didn't completed successfully: exit 126

I'm still able to successfully deploy from the "acore-docker" repo using docker compose up -d (after incorporating pull request 34).

To get some more detail, I did run it without the "-d" option and it gave me the error as: ac-db-import | /bin/bash: /entrypoint.sh: Permission denied

Kitzunu commented 12 months ago

@michaeldelago

StewartPolsky commented 12 months ago

I am having the same issue

michaeldelago commented 12 months ago

@Daeymon Can you share the full output when you run docker compose up ac-db-import? If it's many lines (more than 75), can you share the relevant error output as well as a few lines above and below?

@sw586 Can you perform a similar process as above?

I tested on a fresh ARM Amazon Linux 3 server:

$ docker compose logs ac-db-import --no-log-prefix
'/azerothcore/env/ref/etc/authserver.conf.dist' -> '/azerothcore/env/dist/etc/authserver.conf.dist'
'/azerothcore/env/ref/etc/dbimport.conf.dist' -> '/azerothcore/env/dist/etc/dbimport.conf.dist'
'/azerothcore/env/ref/etc/worldserver.conf.dist' -> '/azerothcore/env/dist/etc/worldserver.conf.dist'
cp: cannot create regular file '/azerothcore/env/dist/etc/authserver.conf.dist': Permission denied
cp: cannot create regular file '/azerothcore/env/dist/etc/dbimport.conf.dist': Permission denied
cp: cannot create regular file '/azerothcore/env/dist/etc/worldserver.conf.dist': Permission denied

This was fixed by running sudo chown -R ec2-user:ec2-user env/dist/. ec2-user is the default user in AWS EC2, so that's where that value comes from. The format is "USER:GROUP"

For me, this issue is caused by the env/dist/etc and env/dist/logs folders being created by the docker daemon, which makes them owned to root by default.

It's not clear if this is the issue either of you are experiencing, but this is definitely an issue nonetheless.

Daeymon commented 12 months ago

@michaeldelago , as requested:

# cd azerothcore-wotlk
# docker compose up ac-db-import
[+] Running 4/4
 ⠿ Network azerothcore-wotlk_default     Created                           0.3s
 ⠿ Network azerothcore-wotlk_ac-network  Created                           0.2s
 ⠿ Container ac-database                 Create...                         0.6s
 ⠿ Container ac-db-import                Creat...                          0.6s
Attaching to ac-db-import
ac-db-import  | /bin/bash: /entrypoint.sh: Permission denied
ac-db-import exited with code 126
michaeldelago commented 12 months ago

Interesting, thanks. Just to confirm, can you get your git commit hash (command git rev-parse HEAD)

few other sanity checks:

Daeymon commented 12 months ago

@michaeldelago Quite a bit here. Hopefully it helps.

Interesting, thanks. Just to confirm, can you get your git commit hash (command git rev-parse HEAD)

My server is a Terramaster F243 running a custom version of linux called TOS 5.1. Due to the remote-https command not present in the build of git from their application store, I can't clone the repo. So instead I've been using "GitHub Desktop" on my computer to clone the repo to a folder on the server. I'm not using git directly essentially.

is it the exact same output with docker compose up ac-db-import --build)?

Yes

Are there any modifications you've made? This could be in a docker-compose.override.yml, changes to the core itself, or changes to the docker build. please be very explicit here

I've made no modiciations to the repo. Is it a clean clone. As for the docker build, its the one the Terramaster team build specifically for their version of Linux. I'm not certain of the extent of their customizations. For example, I have to actually use docker-compose in the command line rather than docker compose since the latter doesn't work. Below is the version informaiton for docker:

# docker version
Client:
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.18.6
 Git commit:        20.10.17
 Built:             unknown-buildtime
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.6
  Git commit:       buildroot
  Built:
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:
 runc:
  Version:          1.1.3
  GitCommit:
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
# docker-compose version
Docker Compose version v2.12.2

What is the Host OS? (command uname -a)

Linux 5.15.59 #246 SMP Tue Sep 5 11:49:03 CST 2023 x86_64 GNU/Linux

what user id is running in the container (command docker compose run --build --entrypoint "/bin/bash -c" ac-db-import id)

# docker-compose run --entrypoint "/bin/bash -c" ac-db-import id
[+] Running 1/0
 ⠿ Container ac-database  Running                                                          0.0s
uid=1000(acore) gid=1000(acore) groups=1000(acore)

how does that user id compare to the user id of that on the host? (command id)

# id -nu 1000
TimeMachine

Can you shell into the container and manually run the dbimport?

# docker-compose build ac-db-import
[+] Building 3.9s (24/24) FINISHED
 => [internal] load build definition from Dockerfile                                       0.7s
 => => transferring dockerfile: 198B                                                       0.0s
 => [internal] load .dockerignore                                                          1.1s
 => => transferring context: 201B                                                          0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                            1.0s
 => [internal] load build context                                                          0.8s
 => => transferring context: 1.96MB                                                        0.3s
 => [skeleton 1/4] FROM docker.io/library/ubuntu:22.04@sha256:2b7412e6465c3c7fc5bb21d3e6f  0.0s
 => CACHED [skeleton 2/4] RUN mkdir -pv         /azerothcore/bin                           0.0s
 => CACHED [skeleton 3/4] RUN apt-get update                                               0.0s
 => CACHED [skeleton 4/4] WORKDIR /azerothcore                                             0.0s
 => CACHED [runtime 1/5] RUN apt-get update &&     apt-get install -y --no-install-recomm  0.0s
 => CACHED [build 1/8] RUN apt-get update                                                  0.0s
 => CACHED [build 2/8] COPY CMakeLists.txt /azerothcore/CMakeLists.txt                     0.0s
 => CACHED [build 3/8] COPY conf /azerothcore/conf                                         0.0s
 => CACHED [build 4/8] COPY deps /azerothcore/deps                                         0.0s
 => CACHED [build 5/8] COPY src /azerothcore/src                                           0.0s
 => CACHED [build 6/8] COPY modules /azerothcore/modules                                   0.0s
 => CACHED [build 7/8] WORKDIR /azerothcore/build                                          0.0s
 => CACHED [build 8/8] RUN --mount=type=cache,target=/ccache,sharing=locked     --mount=t  0.0s
 => CACHED [runtime 2/5] COPY --from=build /azerothcore/env/dist/etc/ /azerothcore/env/re  0.0s
 => CACHED [runtime 3/5] RUN groupadd --gid "1000"  "acore" &&     useradd -d /azerothcor  0.0s
 => CACHED [runtime 4/5] COPY apps/docker/entrypoint.sh /entrypoint.sh                     0.0s
 => CACHED [runtime 5/5] RUN chmod -v +x /entrypoint.sh                                    0.0s
 => CACHED [db-import 1/2] COPY --chown=acore:acore     data data                          0.0s
 => CACHED [db-import 2/2] COPY --chown=acore:acore     --from=build      /azerothcore/en  0.0s
 => exporting to image                                                                     0.8s
 => => exporting layers                                                                    0.0s
 => => writing image sha256:b24dbc9fa2114a379199b0e58e6dc356a5c1e7d15bb2e463517fb5da51c08  0.0s
 => => naming to docker.io/acore/ac-wotlk-db-import:master                                 0.0s
# docker-compose run --entrypoint /bin/bash ac-db-import
[+] Running 3/3
 ⠿ Network azerothcore-wotlk_default     Created                                           0.4s
 ⠿ Network azerothcore-wotlk_ac-network  Created                                           0.3s
 ⠿ Container ac-database                 Created                                           0.5s
[+] Running 1/1
 ⠿ Container ac-database  Started                                                          1.1s
acore@f69d1068bbf9:~$ stat /entrypoint.sh
  File: /entrypoint.sh
  Size: 572             Blocks: 8          IO Block: 4096   regular file
Device: 47h/71d Inode: 6672        Links: 1
Access: (0771/-rwxrwx--x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-11-06 10:14:13.219373018 +0000
Modify: 2023-11-06 10:14:13.219373018 +0000
Change: 2023-11-06 21:29:25.248911821 +0000
 Birth: 2023-11-06 21:29:13.504910817 +0000
acore@f69d1068bbf9:~$ /entrypoint.sh
/bin/bash: /entrypoint.sh: Permission denied
yannickdhondt commented 12 months ago

I had the same issue and solved it as @michaeldelago explained by modifying the permissions of the azerothcore-wotlk/env/dist folder. I had no default user so added a new one. Everything is working flawlessy now.

Kitzunu commented 12 months ago

Is this something we need fixing AC side or can it be considered resolved?

kakig commented 12 months ago

@michaeldelago I'm also having the same issue. Answering your questions:

git rev-parse HEAD

4dc5b324c581bfa382d7f9392fa52b7fac015e0b

is it the exact same output with docker compose up ac-db-import --build)?

yes.

What is the Host OS? (command uname -a)

Arch Linux Rolling

Linux colossus 6.6.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 08 Nov 2023 16:05:38 +0000 x86_64 GNU/Linux

what user id is running in the container (command docker compose run --build --entrypoint "/bin/bash -c" ac-db-import id)

uid=1000(acore) gid=1000(acore) groups=1000(acore)

how does that user id compare to the user id of that on the host? (command id)

uid=1000(<my_username>) gid=1000(<my_username>) groups=1000(<my_username>),98(power),108(vboxusers),957(gamemode),959(docker),964(autologin),969(libvirt),985(video),986(uucp),987(storage),996(audio),998(wheel)

Can you shell into the container and manually run the dbimport?

  • command docker compose run --build --entrypoint /bin/bash ac-db-import should drop you into a shell
    • do a stat /entrypoint.sh
acore@a9ae8b4f6fe0:~$ stat /entrypoint.sh
  File: /entrypoint.sh
  Size: 572             Blocks: 8          IO Block: 4096   regular file
Device: 3ch/60d Inode: 16029206    Links: 1
Access: (0751/-rwxr-x--x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-10-21 20:05:10.924936150 +0000
Modify: 2023-10-21 20:05:10.924936150 +0000
Change: 2023-11-12 15:09:39.199129457 +0000
 Birth: 2023-11-12 15:09:39.195795802 +0000

I've also tried running the chown env/dist command without luck.

StewartPolsky commented 12 months ago

@michaeldelago I will get all of the info for the questions you asked tomorrow. I am running Ubuntu 20.04 LTS. I've also tried running the chown env/dist command and still the same issue.

StewartPolsky commented 11 months ago

git rev-parse HEAD

4fabaee5975257f81dd77a728e42af60e3ad04d9

is it the exact same output with docker compose up ac-db-import --build)?

Yes

docker compose up ac-db-import --build
[+] Building 9.2s (24/24) FINISHED                               docker:default
 => [ac-db-import internal] load .dockerignore                             0.1s
 => => transferring context: 261B                                          0.0s
 => [ac-db-import internal] load build definition from Dockerfile          0.2s
 => => transferring dockerfile: 7.94kB                                     0.0s
 => [ac-db-import internal] load metadata for docker.io/library/ubuntu:22  0.4s
 => [ac-db-import internal] load build context                             6.3s
 => => transferring context: 648.76MB                                      6.2s
 => [ac-db-import skeleton 1/4] FROM docker.io/library/ubuntu:22.04@sha25  0.0s
 => CACHED [ac-db-import skeleton 2/4] RUN mkdir -pv         /azerothcore  0.0s
 => CACHED [ac-db-import skeleton 3/4] RUN apt-get update                  0.0s
 => CACHED [ac-db-import skeleton 4/4] WORKDIR /azerothcore                0.0s
 => CACHED [ac-db-import runtime 1/5] RUN apt-get update &&     apt-get i  0.0s
 => CACHED [ac-db-import build 1/8] RUN apt-get update                     0.0s
 => CACHED [ac-db-import build 2/8] COPY CMakeLists.txt /azerothcore/CMak  0.0s
 => CACHED [ac-db-import build 3/8] COPY conf /azerothcore/conf            0.0s
 => CACHED [ac-db-import build 4/8] COPY deps /azerothcore/deps            0.0s
 => CACHED [ac-db-import build 5/8] COPY src /azerothcore/src              0.0s
 => CACHED [ac-db-import build 6/8] COPY modules /azerothcore/modules      0.0s
 => CACHED [ac-db-import build 7/8] WORKDIR /azerothcore/build             0.0s
 => CACHED [ac-db-import build 8/8] RUN --mount=type=cache,target=/ccache  0.0s
 => CACHED [ac-db-import runtime 2/5] COPY --from=build /azerothcore/env/  0.0s
 => CACHED [ac-db-import runtime 3/5] RUN groupadd --gid "1000"  "acore"   0.0s
 => CACHED [ac-db-import runtime 4/5] COPY apps/docker/entrypoint.sh /ent  0.0s
 => CACHED [ac-db-import runtime 5/5] RUN chmod -v +x /entrypoint.sh       0.0s
 => CACHED [ac-db-import db-import 1/2] COPY --chown=acore:acore     data  0.0s
 => CACHED [ac-db-import db-import 2/2] COPY --chown=acore:acore     --fr  0.0s
 => [ac-db-import] exporting to image                                      0.1s
 => => exporting layers                                                    0.0s
 => => writing image sha256:552669aa8daeb021b4193d4451caa9ab66f48c98c30dc  0.1s
 => => naming to docker.io/acore/ac-wotlk-db-import:master                 0.0s
WARN[0000] buildx: failed to read current commit information with git rev-parse --is-inside-work-tree 
[+] Running 2/0
 ✔ Container ac-database   Running                                         0.0s 
 ✔ Container ac-db-import  Created                                         0.0s 
Attaching to ac-db-import
ac-db-import  | cp: cannot create regular file '/azerothcore/env/dist/etc/authserver.conf.dist': Permission denied
ac-db-import  | cp: cannot create regular file '/azerothcore/env/dist/etc/dbimport.conf.dist': Permission denied
ac-db-import  | '/azerothcore/env/ref/etc/authserver.conf.dist' -> '/azerothcore/env/dist/etc/authserver.conf.dist'
ac-db-import  | '/azerothcore/env/ref/etc/dbimport.conf.dist' -> '/azerothcore/env/dist/etc/dbimport.conf.dist'
ac-db-import  | '/azerothcore/env/ref/etc/worldserver.conf.dist' -> '/azerothcore/env/dist/etc/worldserver.conf.dist'
ac-db-import  | cp: cannot create regular file '/azerothcore/env/dist/etc/worldserver.conf.dist': Permission denied
ac-db-import exited with code 1

What is the Host OS? (command uname -a)

Linux 20.04.1-Ubuntu SMP GNU/Linux

What user id is running in the container (command docker compose run --build --entrypoint "/bin/bash -c" ac-db-import id)

uid=1000(acore) gid=1000(acore) groups=1000(acore)

how does that user id compare to the user id of that on the host? (command id)

uid=1000() gid=1000() groups=1000(),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare),134(docker)

Can you shell into the container and manually run the dbimport? command docker compose run --build --entrypoint /bin/bash ac-db-import should drop you into a shell do a stat /entrypoint.sh

acore@f18e3ff948b8:~$ stat /entrypoint.sh 
  File: /entrypoint.sh
  Size: 572         Blocks: 8          IO Block: 4096   regular file
Device: 46h/70d Inode: 2100004     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-11-13 15:19:15.715925408 +0000
Modify: 2023-11-12 19:33:23.805610950 +0000
Change: 2023-11-13 15:19:06.719834326 +0000
 Birth: 2023-11-13 15:19:06.699834124 +0000
michaeldelago commented 11 months ago

@StewartPolsky Can you confirm the ownership of the directory at env/dist/etc? it may be owned to root. That seems to be what's causing the error messages that you're seeing.

michaeldelago commented 11 months ago

@kakig @sw586 If either of you have a moment, can you test this PR

https://github.com/azerothcore/azerothcore-wotlk/pull/17698

One of the larger issues in triaging this is that it's not clear to me what may be different about your machines to cause issues. If there's any information you can provide for further context, please let me know.

StewartPolsky commented 11 months ago

@michaeldelago

ls -l env/dist/etc/
total 184
-rw-r--r-- 1 ($USER) ($USER) 14781 Nov 13 20:06 authserver.conf.dist
-rw-r--r-- 1 ($USER) ($USER)  11787 Nov 13 20:06 dbimport.conf
-rw-r--r-- 1 ($USER) ($USER)  11787 Nov 13 20:06 dbimport.conf.dist
-rw-r--r-- 1 ($USER) ($USER) 145696 Nov 13 20:06 worldserver.conf.dist

I have verified the ownership, and it correctly shows my user and not root

michaeldelago commented 11 months ago

great, thanks.

The last thing I can think of at the moment, is to check if you're mounting the volumes in read-only mode in an edit to the docker-compose.yml, or a docker-compose.override.yml file

Daeymon commented 11 months ago

@michaeldelago

Applied #17698.

I'm now getting:

ac-db-import         | cp: cannot stat '/azerothcore/env/dist/etc/authserver.conf.dist': Permission denied
ac-db-import         | cp: cannot stat '/azerothcore/env/dist/etc/dbimport.conf.dist': Permission denied
ac-db-import         | cp: cannot stat '/azerothcore/env/dist/etc/worldserver.conf.dist': Permission denied
ac-db-import exited with code 1
service "ac-db-import" didn't completed successfully: exit 1
kakig commented 11 months ago

@kakig @sw586 If either of you have a moment, can you test this PR

17698

One of the larger issues in triaging this is that it's not clear to me what may be different about your machines to cause issues. If there's any information you can provide for further context, please let me know.

My user is part of the docker group so that I can run docker commands without root, although I'm not sure if this makes it any different from using sudo. The Docker daemon is running as root.

I just tested the PR and it seems the server is working now. There is a lot of output from the containers, but most importantly, ac-db-import exited with code 0 and the ac-worldserver seems to be working now. I'll try logging in to the game later.

EDIT: yup, it is working. I could log in to the game and play for a bit.

vfce commented 10 months ago

I try to get the UID of user acore in ac-db-import, it's 1000:1000,so: cd azerothcore-wotlk/env/dist chown -R 1000:1000 etc chown -R 1000:1000 logs then: cd azerothcore-wotlk docker compose up -d it is working.

michaeldelago commented 9 months ago

I think it's clear that this is an issue with the way the source is getting cloned; I'll make a PR in order to help make the needed permissions more clear.

privatecore commented 6 months ago

The problem is that ac-worldserver, ac-authserver and ac-db-import are built with Dockerfile, but use a hardcoded user, acore:1000:1000. If the owner of azerothcore-wotlk/* does not match the user with the UID:GID equal to 1000:1000, ac-db-import will fail.

You will also encounter problems if you create a .env file with an owner of azerothcore-wotlk/* and related UID:GID that is not equal to 1000:1000.

Moreover, try not to run Docker as root, instead -> create additional user, apply changes from PR and then:

  1. chown <new_user>:<new_user> -R azerothcore-wotlk/
  2. cd azerothcore-wotlk
  3. echo -e "DOCKER_USER=<new_user>\nDOCKER_USER_ID=$(id -u <new_user)\nDOCKER_GROUP_ID=$(id -g <new_user)" > .env
  4. sudo -u <new_user> docker compose up -d --build
meanmischief commented 3 months ago

I try to get the UID of user acore in ac-db-import, it's 1000:1000,so: cd azerothcore-wotlk/env/dist chown -R 1000:1000 etc chown -R 1000:1000 logs then: cd azerothcore-wotlk docker compose up -d it is working.

sudo chown -R 1000:1000 env/dist/etc env/dist/logs this fixed my issue run this in azerothcore folder..

sw586 commented 2 months ago

@kakig @sw586如果你们有时间,可以测试一下这个 PR 吗?

17698

在分类时遇到的一个较大问题是,我不清楚您的机器可能存在哪些不同之处导致出现问题。如果您可以提供任何信息以进一步了解情况,请告诉我。

我的用户属于 docker 组,因此我可以在不使用 root 权限的情况下运行 docker 命令,尽管我不确定这与使用 sudo 是否有任何不同。Docker 守护程序以 root 权限运行。

我刚刚测试了 PR,服务器似乎现在正在运行。容器中有很多输出,但最重要的是,ac-db-import exited with code 0ac-worldserver 现在似乎正在运行。我稍后会尝试登录游戏。

编辑:是的,它正在运行。我可以登录游戏并玩一会儿。

@kakig @sw586 If either of you have a moment, can you test this PR

17698

One of the larger issues in triaging this is that it's not clear to me what may be different about your machines to cause issues. If there's any information you can provide for further context, please let me know.

My user is part of the docker group so that I can run docker commands without root, although I'm not sure if this makes it any different from using sudo. The Docker daemon is running as root.

I just tested the PR and it seems the server is working now. There is a lot of output from the containers, but most importantly, ac-db-import exited with code 0 and the ac-worldserver seems to be working now. I'll try logging in to the game later.

EDIT: yup, it is working. I could log in to the game and play for a bit.

sudo chown -R 1000:1000 /root/azerothcore-wotlk/env/dist/etc /root/azerothcore-wotlk/env/dist/logs cd /root/azerothcore-wotlk/ docker compose up --build ac-db-import