Skip to content

Plugin Installation Fails Due to File Permissions #15

Description

@DoloMike

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions