bgauduch / call-of-duty-2-docker-server

Minimal & lightweight Call of duty 2 server docker image - include libcod library
https://hub.docker.com/r/bgauduch/cod2server
MIT License
71 stars 17 forks source link

container wont start #49

Closed fcakyon closed 4 years ago

fcakyon commented 4 years ago

Hello,

After following the steps in readme, i copied all necessary files to cod2server/main, then started docker-compose, but the status on container is always "restarting". When I look for the logs it says "0 files in iwd files" but I do have them. ubuntu version: 18.04 docker version: 19.03.8 docker-compose version: 1.25.5

Sample logs: cod2_server_1 | > [LIBCOD] Compiled for: CoD2 1.3 cod2_server_1 | > [LIBCOD] Compiled May 2 2020 08:15:24 using GCC 8.3.0 cod2_server_1 | > [PLUGIN LOADED] cod2_server_1 | CoD2 MP 1.3 build linux-i386 Jun 23 2006 cod2_server_1 | ----- FS_Startup ----- cod2_server_1 | Current language: english cod2_server_1 | Current search path: cod2_server_1 | /home/cod2/.callofduty2/main cod2_server_1 | /home/cod2/main cod2_server_1 | /home/cod2/.callofduty2/raw cod2_server_1 | /home/cod2/.callofduty2/raw_shared cod2_server_1 | /home/cod2/.callofduty2/devraw cod2_server_1 | /home/cod2/.callofduty2/devraw_shared cod2_server_1 | /home/cod2/raw cod2_server_1 | /home/cod2/raw_shared cod2_server_1 | /home/cod2/devraw cod2_server_1 | /home/cod2/devraw_shared cod2_server_1 | cod2_server_1 | File Handles: cod2_server_1 | ---------------------- cod2_server_1 | 0 files in iwd files cod2_server_1 | ERROR: No languages available because no localized assets were found cod2_server_1 | Sys_Error: Error during initialization: cod2_server_1 | Couldn't load default_localize_mp.cfg. Make sure Call of Duty is run from the correct folder. cod2_server_1 | cod2_server_1 | > [PLUGIN UNLOADED] cod2_server_1 | > [LIBCOD] Compiled for: CoD2 1.3 cod2_server_1 | > [LIBCOD] Compiled May 2 2020 08:15:24 using GCC 8.3.0 cod2_server_1 | > [PLUGIN LOADED] cod2_server_1 | CoD2 MP 1.3 build linux-i386 Jun 23 2006 cod2_server_1 | ----- FS_Startup ----- cod2_server_1 | Current language: english cod2_server_1 | Current search path: cod2_server_1 | /home/cod2/.callofduty2/main cod2_server_1 | /home/cod2/main cod2_server_1 | /home/cod2/.callofduty2/raw cod2_server_1 | /home/cod2/.callofduty2/raw_shared cod2_server_1 | /home/cod2/.callofduty2/devraw cod2_server_1 | /home/cod2/.callofduty2/devraw_shared cod2_server_1 | /home/cod2/raw cod2_server_1 | /home/cod2/raw_shared cod2_server_1 | /home/cod2/devraw cod2_server_1 | /home/cod2/devraw_shared cod2_server_1 | cod2_server_1 | File Handles: cod2_server_1 | ---------------------- cod2_server_1 | 0 files in iwd files cod2_server_1 | ERROR: No languages available because no localized assets were found cod2_server_1 | Sys_Error: Error during initialization: cod2_server_1 | Couldn't load default_localize_mp.cfg. Make sure Call of Duty is run from the correct folder. cod2_server_1 | cod2_server_1 | > [PLUGIN UNLOADED]

fcakyon commented 4 years ago

Seems to be similar to this issue but couldnt find the solution there

bgauduch commented 4 years ago

@fcakyon It looks like a volume mount issue, the server binary do not find the *.iwd files. I will try to reproduce using a fresh git repository clone, in the meantime please check that you added the game files in the correct folder: YOUR_SERVER_PATH/cod2server/main.

bgauduch commented 4 years ago

@fcakyon I cannot reproduce using a fresh git clone and copying all the *.iwd files to cod2ser/main, please check with the above comment and make sure you are up to date with master branch.

fcakyon commented 4 years ago

I have copied all .iwd files from a steam installation on windows to ubuntu call-of-duty-2-docker-server/cod2server/main and run docker-compose on main project path. it is correct right?

bgauduch commented 4 years ago

It is correct indeed.

Are you up to date with master ? Did you modify the provided docker-compose.yaml file before running the docker-compose up command?

fcakyon commented 4 years ago

I have just fetched and checkout to master and did not modified the docker-compose.yaml:

version: "3.6" services: cod2_server:

You can chose a different server version, see available image tags:

https://hub.docker.com/r/bgauduch/cod2server/tags

image: bgauduch/cod2server:latest restart: unless-stopped ports:

  • "20500:20500/udp"
  • "20510:20510/udp"
  • "28960:28960/tcp"
  • "28960:28960/udp" volumes:
  • ./cod2server/main:/home/cod2/main

    Configure server parameters

    command: [ "+set", "dedicated", "2", "+set", "net_port", "28960", "+set", "sv_cheat", "0", "+set", "sv_punkbuster", "0", "+exec", "punkbuster.cfg", "+exec", "server_mp.cfg" ]

    Allow server shell interaction

    stdin_open: true tty: true

bgauduch commented 4 years ago

Well it seems you did everything right @fcakyon !

I sadly cannot reproduce this behavior, even starting from scratch in a new env and following the server setup guide (working on OSX in my case) 😢

It's clearly the volume that do not work properly, as per the log: cod2_server_1 | 0 files in iwd files. Maybe a permission issue on files (the container is using a non-root user, I've experienced such issues before) ?

I will try to reproduce on Ubuntu and see how it goes !

fcakyon commented 4 years ago

I'm running all the commands with sudo. What is your docker-compose version?

bgauduch commented 4 years ago

@fcakyon docker-compose version 1.25.4 (only one minor version difference) docker version 19.03.8

This issue might be the same as your problem, I'm quite sure the files in the mounted volume should be chown to the group ID of the user defined in the container. The issue being... I did not fix the group ID nor the user ID when creating the user in the container 😅

Quick'n dirty fix: use the docker-compose.dev.yaml and remove the USER statement in the Dockerfile:

  1. Edit the Dockerfile to comment / remove the USER instruction (will run the server as root inside the container);
  2. Launch the server using dev script: ./scripts/dev-up.sh;
  3. This will build and launch the server using the modified Dockerfile (it might take a while to build). Does it work ?

Proper fix: not sure yet. Maybe chown on container startup using an entrypoint script and make sure to pin the user and group ID in Dockerfile?

fcakyon commented 4 years ago

It's clearly the volume that do not work properly, as per the log: cod2_server_1 | 0 files in iwd files. Maybe a permission issue on files (the container is using a non-root user, I've experienced such issues before) ?

It was a permisson issue.

bgauduch commented 4 years ago

@fcakyon okay, how did you fix it ?

fcakyon commented 4 years ago

When I copy the files, their owner access was set to read and write and I thought that was OK. But their Group/Others access rights also should have been set accordingly.

Here is a gif showing how I fixed it: Alt Text

fcakyon commented 4 years ago

@fcakyon docker-compose version 1.25.4 (only one minor version difference) docker version 19.03.8

This issue might be the same as your problem, I'm quite sure the files in the mounted volume should be chown to the group ID of the user defined in the container. The issue being... I did not fix the group ID nor the user ID when creating the user in the container sweat_smile

Quick'n dirty fix: use the docker-compose.dev.yaml and remove the USER statement in the Dockerfile:

1. Edit the Dockerfile to comment / remove the [`USER` instruction](https://github.com/bgauduch/call-of-duty-2-docker-server/blob/master/Dockerfile#L49) (will run the server as root inside the container);

2. Launch the server using dev script: `./scripts/dev-up.sh`;

3. This will build and launch the server using the modified Dockerfile (it might take a while to build).
   Does it work ?

Proper fix: not sure yet. Maybe chown on container startup using an entrypoint script and make sure to pin the user and group ID in Dockerfile?

It may also be related with what you are saying here, did not test it

bgauduch commented 4 years ago

When I copy the files, their owner access was set to read and write and I thought that was OK. But their Group/Others access rights also should have been set accordingly.

Here is a gif showing how I fixed it: Alt Text

Thanks a lot for the explanation and the gif 👍

I believe it is related to the way Docker bind the user and group on Container creation: "By default, the docker container process runs with the supplementary groups looked up for the specified user" - source

bgauduch commented 4 years ago

@fcakyon docker-compose version 1.25.4 (only one minor version difference) docker version 19.03.8 This issue might be the same as your problem, I'm quite sure the files in the mounted volume should be chown to the group ID of the user defined in the container. The issue being... I did not fix the group ID nor the user ID when creating the user in the container sweat_smile Quick'n dirty fix: use the docker-compose.dev.yaml and remove the USER statement in the Dockerfile:

1. Edit the Dockerfile to comment / remove the [`USER` instruction](https://github.com/bgauduch/call-of-duty-2-docker-server/blob/master/Dockerfile#L49) (will run the server as root inside the container);

2. Launch the server using dev script: `./scripts/dev-up.sh`;

3. This will build and launch the server using the modified Dockerfile (it might take a while to build).
   Does it work ?

Proper fix: not sure yet. Maybe chown on container startup using an entrypoint script and make sure to pin the user and group ID in Dockerfile?

It may also be related with what you are saying here, did not test it

Okay ! It is a really dirty fix anyway.

bgauduch commented 4 years ago

@fcakyon I've added a chown in container entrypoint to avoid this issue in the futur in #51 It's not ideal because it will update file permissions on host as well but will prevent this issues.

fcakyon commented 4 years ago

Thanks for the quickfix. Will test it once I find some time. Currently server is working on a vds without any problem :)

rodas007 commented 4 years ago

@bgauduch Perfect and done what you told me and with this regression everything works again and manually changing the permissions of the .iwd files, punkbuster works perfect! thanks

bgauduch commented 4 years ago

@rodas007 good to hear, all good then 👌 I still have to find out a proper long-term fix for this file permission issue !

bgauduch commented 4 years ago

@rodas007, @fcakyon I did remove the the non-root user in the Dockerfile which was causing file permission issues (see #59 for more details) as a temporary fix.

You guys should be able to use the latest image tag without manual changes or trouble.

Closing this issue, feel free to fill a new one if anything else do get in your way when launching the server 😉