Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Installation Fails Due to File Permissions #15

Open
DoloMike opened this issue Nov 23, 2024 · 0 comments
Open

Plugin Installation Fails Due to File Permissions #15

DoloMike opened this issue Nov 23, 2024 · 0 comments

Comments

@DoloMike
Copy link

Description

In WSL2, the Minecraft server container fails to download and save plugins (e.g., WorldEdit) to the /data/plugins/ directory. The following error appears in the container logs:

java.nio.file.AccessDeniedException: /data/plugins/worldedit-bukkit-7.3.0.jar

This issue occurs when the local plugins directory has restrictive permissions, preventing the container from writing files.


Root Cause

  1. Permissions Issue:

    • The local ./plugins directory was owned by root with restrictive permissions (drwxr-xr-x).
    • The container process, running as a non-root user, could not write to the directory.
  2. File System Binding:

    • The ./plugins directory is mounted to /data/plugins in the container using docker-compose.yml.
    • The container requires write permissions on the mounted directory to save downloaded plugins.

Steps to Reproduce

  1. Create a plugins directory locally:
  2. Mount the directory in docker-compose.yml:
   volumes:
     - ./plugins:/data/plugins
  1. Start the Minecraft server container: docker-compose up
  2. Observe the container logs showing a java.nio.file.AccessDeniedException when attempting to download plugins:
    docker logs -f <container-id>

Solution

Update Directory Permissions

  1. Change ownership of the local plugins directory:
    sudo chown -R $(whoami):$(whoami) plugins
  2. Ensure the directory is writable:
    chmod -R 777 plugins

Restart the Server

  1. Stop the Minecraft server container: docker-compose down
  2. Restart the server: docker-compose up

Verify Plugin Installation

  1. Check the container logs to confirm the plugin downloads successfully: docker logs -f <container-id>
  2. Verify the plugin exists in the plugins directory: ls ./plugins

Key Findings

  • The plugins directory must have appropriate write permissions (e.g., 777) to allow the container to write files.
  • Containers running as non-root users will fail to write to directories with restrictive permissions (e.g., drwxr-xr-x owned by root).

Recommended Fix

Update Documentation

  1. Ensure local directories used as Docker volumes (e.g., ./plugins/) are writable.
  2. Provide an example command to set appropriate permissions:
    chmod -R 777 plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant