MinecraftServerControl / mscs

Powerful command-line control for UNIX and Linux powered Minecraft servers
https://minecraftservercontrol.github.io
BSD 2-Clause "Simplified" License
485 stars 62 forks source link

version manifest malformed JSON string #264

Closed ineptcamel closed 3 years ago

ineptcamel commented 3 years ago

I seem to be having some issue with the backup version manifest JSON.

~$ mscs create alpha
Creating world at default port 25565.
~$ mscs start alpha
The version manifest cache was out of date, it has been removed.
Downloading current Minecraft version manifest.
Error downloading the version manifest, using a backup.
Starting Minecraft Server: alphamalformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "(end of string)") at -e line 14, <> chunk 1.
Error updating the Minecraft server software.

Affects all worlds, even newly created ones. Force update output:

Removing cached version manifest.
Downloading current Minecraft version manifest.
Error downloading the version manifest, using a backup.
Stopping Minecraft Server: Dadland2.
Backing up Minecraft Server: Dadland2Warning: could not determine case sensitivi                                                   ty of source directory at
  /opt/mscs/worlds/Dadland2/rdiff-backup-data
because we can't find any files with letters in them.
It will be treated as case sensitive.
Warning: could not determine if source directory at
  /opt/mscs/worlds/Dadland2/rdiff-backup-data
permits trailing spaces or periods in filenames because we can't find any files.
It will be treated as permitting such files.
Warning: chars_to_quote file not found,
assuming no quoting in backup repository.
Warning: special_escapes file not found,
will assume need to escape DOS devices and trailing spaces based on file systems                                                   .
Fatal Error: File /opt/mscs/worlds/Dadland2 does not look like an increment file                                                   .

Try restoring from an increment file (the filenames look like
"foobar.2001-09-01T04:49:04-07:00.diff").
Error doing backup of world Dadland2
.
Removing Minecraft Server software: Dadland2.
Updating Server Software: Dadland2malformed JSON string, neither tag, array, obj                                                   ect, number, string or atom, at character offset 0 (before "(end of string)") at                                                    -e line 14, <> chunk 1.
Error updating the Minecraft server software.
ineptcamel commented 3 years ago

I think I may have misdiagnosed this. The error prints before the new line:

# Start each world requested, if not already running.
    printf "Starting Minecraft Server:"
    for WORLD in $WORLDS; do
      if ! serverRunning $WORLD; then
        printf " $WORLD"
        start $WORLD
      fi
    done
    printf ".\n"

so that takes me to the start command. The failure to update server software is here:

if [ ! -s "$SERVER_LOCATION/$SERVER_JAR" ]; then
    # Download the Minecraft server software.
    $WGET -qO "$SERVER_LOCATION/$SERVER_JAR" "$SERVER_URL"
    # Report any errors.
    if [ $? -ne 0 ]; then
      printf "Error updating the Minecraft server software.\n"
      exit 1
    fi

I think maybe one of the functions in there is failing? I'll keep investigating tomorrow.

ineptcamel commented 3 years ago

I added print statements to the following section to see where the problem was:

updateServerSoftware() {
  local SERVER_JAR SERVER_LOCATION SERVER_URL SERVER_VERSION SHA1 SHA1_FILE
  SERVER_JAR=$(getServerJar "$1")
  printf "$SERVER_JAR\n"
  if [ $? -ne 0 ]; then
    printf "$SERVER_JAR\n"
    exit 1
  fi
  SERVER_LOCATION=$(getServerLocation "$1")
  printf "$SERVER_LOCATION\n"
  if [ $? -ne 0 ]; then
    printf "$SERVER_LOCATION\n"
    exit 1
  fi
  SERVER_URL=$(getServerURL "$1")
  printf "$SERVER_URL\n"
  if [ $? -ne 0 ]; then
    printf "$SERVER_URL\n"
    exit 1
  fi
  SERVER_VERSION=$(getServerVersion "$1")
  printf "$SERVER_VERSION\n"
  if [ $? -ne 0 ]; then
    printf "$SERVER_VERSION\n"
    exit 1
  fi

and the output:

The cached copy of the version manifest is up to date.
Use the force-update option to ensure a new copy is downloaded.
Starting Minecraft Server: Dadland3
minecraft_server.1.16.3.jar
/opt/mscs/server
malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "(end of string)") at -e line 14, <> chunk 1.

1.16.3
.

So I've narrowed it down to getServerURL

sorry for extra comments, just tracking my t/s pattern here for future sake

ineptcamel commented 3 years ago

246 I think the issue may be here, as these are the last time the perl scripts were changed. This line seems to be the problem

$json = decode_json (get ($id->{url}));

from getMinecraftVersionDownloadURL. Resulting URL is "" which then breaks the next wget function in line 1540.

I realize now that this only ran because the server jar was 0 bytes, triggering the if statement. I manually moved in a 1.16.3 jar and now the server starts.

I still want to leave this issue open though since there is some sort of json formatting error. I have no experience in Perl to contribute though.

sandain commented 3 years ago

Hi @ineptcamel. I'm not sure what is going on with your setup. I just checked, and I'm able to update just fine. Could you please post a copy of your mscs.properties file for the world and your mscs.defaults file if you have made modifications to it. It appears that you are requesting a version that does not exist in the version_manifest.json or that the manifest file itself is corrupted.

ineptcamel commented 3 years ago

Hey @sandain thanks for getting back. Worked on this over the weekend, and it's nothing with this software.

On a fresh install of Ubuntu 20.04, I set up pihole for ad-blocking on my home network. Once that was all squared away, I installed mscs and setup a server. It worked for a couple of days and then just broke for no discernible reason. You can see my logic here earlier, but my final troubleshooting trace was to the wget calls for downloading the various necessary files from mojang.

It turns out my server could not connect to the internet via IPv4. The issue is covered here, with the only solution a fresh install. The situation in that pihole forum post is identical to mine, even down to the router.

I'm going to close this issue for now.