itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
9.32k stars 1.53k forks source link

"wget: command not found" when executing CurseForge start script. #1596

Open CursedDog19 opened 2 years ago

CursedDog19 commented 2 years ago

Describe the problem

Does the container have wget installed? The modpack I downloaded must use wget to fetch the forge server jar. Here is the modpack's included ServerStart.sh:

#!/usr/bin/env bash
# Start script generated by ServerPackCreator.
# This script checks for the Minecraft and Forge JAR-files, and if they are not found, they are downloaded and installed.
# If everything is in order, the server is started.

JAVA="java"
MINECRAFT="1.18.2"
FORGE="40.1.0"
ARGS=""
OTHERARGS="-Dlog4j2.formatMsgNoLookups=true"

if [[ ! -s "libraries/net/minecraftforge/forge/$MINECRAFT-$FORGE/forge-$MINECRAFT-$FORGE-server.jar" ]];then

  echo "Forge Server JAR-file not found. Downloading installer...";
  wget -O forge-installer.jar https://files.minecraftforge.net/maven/net/minecraftforge/forge/$MINECRAFT-$FORGE/forge-$MINECRAFT-$FORGE-installer.jar;

  if [[ -s "forge-installer.jar" ]]; then

    echo "Installer downloaded. Installing...";
    java -jar forge-installer.jar --installServer;

    if [[ -s "libraries/net/minecraftforge/forge/$MINECRAFT-$FORGE/forge-$MINECRAFT-$FORGE-server.jar" ]];then
      rm -f forge-installer.jar;
      echo "Installation complete. forge-installer.jar deleted.";
    fi

  else
    echo "forge-installer.jar not found. Maybe the Forges servers are having trouble.";
    echo "Please try again in a couple of minutes.";
  fi
else
  echo "Forge server present. Moving on..."
fi

if [[ ! -s "libraries/net/minecraft/server/$MINECRAFT/server-$MINECRAFT.jar" ]];then
  echo "Minecraft Server JAR-file not found. Downloading...";
  wget -O libraries/net/minecraft/server/$MINECRAFT/server-$MINECRAFT.jar https://launcher.mojang.com/v1/objects/125e5adf40c659fd3bce3e66e67a16bb49ecc1b9/server.jar;
else
  echo "Minecraft server present. Moving on..."
fi

if [[ -s "run.bat" ]];then
  rm -f run.bat;
  echo "Deleted run.bat as we already have START-SERVER.bat";
fi
if [[ -s "run.sh" ]];then
  rm -f run.sh;
  echo "Deleted run.sh as we already have START-SERVER.sh";
fi

if [[ ! -s "eula.txt" ]];then
  echo "Mojang's EULA has not yet been accepted. In order to run a Minecraft server, you must accept Mojang's EULA."
  echo "Type 'I agree' to indicate that you agree to Mojang's EULA."
  echo "Mojang's EULA is available to read at https://account.mojang.com/documents/minecraft_eula"
  echo "Do you agree to Mojang's EULA? [I agree/I disagree]"
  read ANSWER
  if [[ "$ANSWER" = "I agree" ]]; then
    echo "User agreed to Mojang's EULA."
    echo "#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)." > eula.txt;
    echo "eula=true" >> eula.txt;
  else
    echo "User did not agree to Mojang's EULA."
  fi
else
  echo "eula.txt present. Moving on...";
fi

echo "Starting server...";
echo "Minecraft version: $MINECRAFT";
echo "Forge version: $FORGE";
echo "Java args in user_jvm_args.txt: $ARGS";

# Forge requires a configured set of both JVM and program arguments.
# Add custom JVM arguments to the user_jvm_args.txt
# Add custom program arguments {such as nogui} to this file in the next line before the "$@" or
#  pass them to this script directly

$JAVA $OTHERARGS @user_jvm_args.txt @libraries/net/minecraftforge/forge/$MINECRAFT-$FORGE/unix_args.txt nogui "$@"

echo "Press any button to exit..."
read

Container definition

  mc:
    image: itzg/minecraft-server
    ports:
      - 25565:25565
    environment:
      EULA: "TRUE"
      MEMORY: 6G
      VERSION: 1.18.2
      TYPE: CURSEFORGE
      CF_SERVER_MOD: create_flavored.zip
      #USE_MODPACK_START_SCRIPT: "FALSE"
    tty: true
    stdin_open: true
    restart: unless-stopped
    volumes:
      - /home/mc_server:/data

Container logs

2022-07-13T05:39:28.892Z        INFO    mc-server-runner        Sending 'stop' to Minecraft server...
2022-07-13T05:39:28.892Z        INFO    mc-server-runner        Waiting for completion...
2022-07-13T05:39:28.893Z        INFO    mc-server-runner        Done
[init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 7 1000 1000 4096 Jul 13 05:32 /data'
[init] Resolved version given 1.18.2 into 1.18.2 and major version 1.18
[init] Resolving type given CURSEFORGE
[init] Looking for Feed-The-Beast / CurseForge server modpack.
[init] detected FTB, changing properties path to /data/FeedTheBeast/server.properties
[init] server.properties already created, skipping
[init] Checking for JSON files.
[init] Setting initial memory to 6G and max to 6G
[init] Running FTB /data/FeedTheBeast/ServerStart.sh in /data/FeedTheBeast ...
Forge Server JAR-file not found. Downloading installer...
/data/FeedTheBeast/ServerStart.sh: line 15: wget: command not found
forge-installer.jar not found. Maybe the Forges servers are having trouble.
Please try again in a couple of minutes.
Minecraft Server JAR-file not found. Downloading...
/data/FeedTheBeast/ServerStart.sh: line 37: wget: command not found
eula.txt present. Moving on...
Starting server...
Minecraft version: 1.18.2
Forge version: 40.1.0
Java args in user_jvm_args.txt:
Error: could not open `libraries/net/minecraftforge/forge/1.18.2-40.1.0/unix_args.txt'
Press any button to exit...
itzg commented 2 years ago

No, wget has long since been removed since people generally want the image to be as small as possible and there's already curl and mc-image-helper.

With that said, I can adjust the latter to the command line compatible but this is a low priority for me since supporting all these custom modpack scripts is a daunting amount of effort.

TheMasterofBlubb commented 1 year ago

In case someone stumbles over this question in some distant future.

Here a small workaround by simply installing wget on startup (yes that increases startup time, but the other option is building your own image, which might be to bothersome)

entrypoint: > sh -c "microdnf install wget -y && /start" replace the package manager with whatever the selected distro provides