MinecraftServerControl / mscs

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

Error starting the server #293

Closed Vrokky closed 2 years ago

Vrokky commented 3 years ago

I just install MSCS, and have done the Quick Start. But when I start my first server I get the following error.

Error starting the server: couln't retrieve the server's process ID.

What do I have to do?

sandain commented 3 years ago

Please post the contents of the console.out file for the server. That will have information about the cause of the issue.

rickyninja commented 3 years ago

I was watching this issue because I'm having the same problem with an older version of mscs while trying to update the server for Minecraft 1.17. I think Mojang has compiled the server with a newer java version than we are running in our server environments. I'm having a similar issue updating my Minecraft client on linux, and suspect it's for same reason.

https://stackoverflow.com/questions/55550802/jni-error-a-class-has-been-compiled-by-a-more-recent-version-of-the-java-runti

minecraft@minecraft> cat worlds/rickyninja/console.out
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
sandain commented 3 years ago

@rickyninja You are right, you have an old version of Java installed. That can be fixed by running sudo update-alternatives --config java, at least on a Debian/Ubuntu system, and choosing a more recent version (assuming you have already installed it).

rickyninja commented 3 years ago

I installed openjdk-11 via stretch-backports, and it still won't start the server. Looks like server was compiled with java 16. I don't see a java version 16 available even on my Debian Buster machine. @sandain Do you think this was a mistake on Mojang's part to compile using such a new version of Java? Yep, Java 16 is required for Minecraft 1.17.

minecraft@minecraft> cat worlds/rickyninja/console.out
Error: LinkageError occurred while loading main class net.minecraft.server.Main
        java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 55.0

minecraft@minecraft> sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number:
Vrokky commented 3 years ago

Error: LinkageError occurred while loading main class net.minecraft.server.Main java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 55.0

sandain commented 3 years ago

@Vrokky, you are having the same issue as @rickyninja. You are using an old version of Java. I think this was probably a mistake on Mojang's part. It is extremely easy to compile a version that is still compatible with Java 8 and all future versions, I'm not sure why they aren't doing that.

@rickyninja: Bullseye has Java 17 available. You could try manually downloading those packages and installing them. It appears that the dependencies are also available on Buster, so it might not break your system.

Java 17 is also available in Ubuntu Hirsute and Impish.

sandain commented 3 years ago

I'm on my work computer which does not have access, but according to Google, you can submit a bug to https://bugs.mojang.com. Ask them to include the following in their Ant build script (assuming they are using Ant)

<property name="ant.build.javac.source" value="1.8"/>
<property name="ant.build.javac.target" value="1.8"/>
rickyninja commented 3 years ago

I was able to get the server running by upgrading my server container by hand from debian stretch -> buster -> bullseye and installing openjdk-17-jdk. I'm not sure what I'll do regarding getting my client to run; I'm not ready to update my primary desktop to Bullseye (unstable release). Some conventions in /etc/apt/sources.list changed between buster and bullseye, so wanted to share those here.

minecraft@minecraft> mscs start rickyninja
The version manifest cache was out of date, it has been removed.
Downloading current Minecraft version manifest.
Erase is control-H (^H).r: rickyninja
.

minecraft@minecraft> mscs status rickyninja
Minecraft Server Status:
  rickyninja: running (query server offline).
    Process ID: 1587.
    Memory used: 1904784 kB.

minecraft@minecraft> cat /etc/apt/sources.list
#deb http://deb.debian.org/debian bullseye main
#deb http://security.debian.org/debian-security bullseye/updates main

deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main

deb http://deb.debian.org/debian-security/ bullseye-security main
deb-src http://deb.debian.org/debian-security/ bullseye-security main

# Tue 08 Jun 2021 11:18:25 PM UTC
# https://wiki.debian.org/DebianTesting#How_to_upgrade_to_Debian_.28next-stable.29_Testing
# https://unix.stackexchange.com/questions/528751/cannot-update-apt-list-repository-no-longer-has-a-release-file
# Disabled until bullseye is a stable release.
#deb http://deb.debian.org/debian bullseye-updates main
#deb-src http://deb.debian.org/debian bullseye-updates main
sandain commented 3 years ago

@rickyninja: You can manually download the deb files from Bullseye to your desktop:

wget http://ftp.us.debian.org/debian/pool/main/o/openjdk-17/openjdk-17-jre_17~19-1_amd64.deb
wget http://ftp.us.debian.org/debian/pool/main/o/openjdk-17/openjdk-17-jre-headless_17~19-1_amd64.deb

and install them with

sudo dpkg -i openjdk-17-jre_17~19-1_amd64.deb openjdk-17-jre_17~19-1_amd64.deb

However, this may not work without installing additional dependencies that might break your system. However, if you don't try chasing the dependencies down the rabbit hole, there is very little risk in trying this.

rickyninja commented 3 years ago

@sandain Thanks for the suggestion on trying openjdk-17 from bullseye. I gave it a try and it wants a newer version of libc6 as a dependency. I'm worried that attempting to upgrade libc via manually compiling will break a lot of software.

AdoptOpenJDK looks like it may be a PPA for newer java builds. I'll dig into this later, and see where it goes.

jeremys@skynet> sudo dpkg -i openjdk-17-jre_17~19-1_amd64.deb
[sudo] password for jeremys:
Selecting previously unselected package openjdk-17-jre:amd64.
(Reading database ... 288395 files and directories currently installed.)
Preparing to unpack openjdk-17-jre_17~19-1_amd64.deb ...
Unpacking openjdk-17-jre:amd64 (17~19-1) ...
dpkg: dependency problems prevent configuration of openjdk-17-jre:amd64:
 openjdk-17-jre:amd64 depends on openjdk-17-jre-headless (= 17~19-1); however:
  Package openjdk-17-jre-headless is not installed.
 openjdk-17-jre:amd64 depends on libc6 (>= 2.29); however:
  Version of libc6:amd64 on system is 2.28-10.

dpkg: error processing package openjdk-17-jre:amd64 (--install):
 dependency problems - leaving unconfigured
Processing triggers for desktop-file-utils (0.23-4) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for gnome-menus (3.31.4-3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:
 openjdk-17-jre:amd64

jeremys@skynet> sudo dpkg -i openjdk-17-jre-headless_17~19-1_amd64.deb
Selecting previously unselected package openjdk-17-jre-headless:amd64.
(Reading database ... 288411 files and directories currently installed.)
Preparing to unpack openjdk-17-jre-headless_17~19-1_amd64.deb ...
Unpacking openjdk-17-jre-headless:amd64 (17~19-1) ...
dpkg: dependency problems prevent configuration of openjdk-17-jre-headless:amd64:
 openjdk-17-jre-headless:amd64 depends on libc6 (>= 2.29); however:
  Version of libc6:amd64 on system is 2.28-10.
 openjdk-17-jre-headless:amd64 depends on libgcc-s1 (>= 3.0); however:
  Package libgcc-s1 is not installed.

dpkg: error processing package openjdk-17-jre-headless:amd64 (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 openjdk-17-jre-headless:amd64

jeremys@skynet> apt policy libc6
libc6:
  Installed: 2.28-10
  Candidate: 2.28-10
  Version table:
 *** 2.28-10 500
        500 http://ftp.us.debian.org/debian buster/main amd64 Packages
        100 /var/lib/dpkg/status

jeremys@skynet> apt show libc6
Package: libc6
Version: 2.28-10
Priority: optional
Section: libs
Source: glibc
Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
Installed-Size: 12.6 MB
Depends: libgcc1
Recommends: libidn2-0 (>= 2.0.5~)
Suggests: glibc-doc, debconf | debconf-2.0, libc-l10n, locales
Conflicts: openrc (<< 0.27-2~)
Breaks: hurd (<< 1:0.5.git20140203-1), libtirpc1 (<< 0.2.3), locales (<< 2.28), locales-all (<< 2.28), nocache (<< 1.1-1~), nscd (<< 2.28), r-cran-later (<< 0.7.5+dfsg-2)
Replaces: libc6-amd64
Homepage: https://www.gnu.org/software/libc/libc.html
Tag: role::shared-lib
Download-Size: 2,867 kB
APT-Manual-Installed: yes
APT-Sources: http://ftp.us.debian.org/debian buster/main amd64 Packages
Description: GNU C Library: Shared libraries
 Contains the standard libraries that are used by nearly all programs on
 the system. This package includes shared versions of the standard C library
 and the standard math library, as well as many others.
sandain commented 3 years ago

@rickyninja: Yeah, I wouldn't install a newer libc6.. That has the potential to break a lot of things.

rickyninja commented 3 years ago

I got the game client working by installing java 16 via that AdoptOpenJDK PPA I mentioned earlier. This may be a better option to install java 16 for servers instead of using Debian Bullseye, which is still pre-release (testing).

I had some JVM args that were not compatible with java 16 too. One of them was -XX:-UseConcMarkSweepGC. There was another but my log file got truncated before I took notes. I found these issues by tailing ~/.minecraft/launcher_log.txt while starting the game. I know for certain that I edited my client's JVM args a while back to allocate more memory to upgrade one of my worlds. I don't recall if I added these incompatible args earlier, or if they came with the minecraft-launcher install package.

It feels weird to be documenting how I fixed my Minecraft game client in an issue for mscs, but maybe it will get indexed in search engines and be useful to someone else. :)

jeremys@skynet> sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                                 Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/adoptopenjdk-16-hotspot-amd64/bin/java   1161      auto mode
  1            /usr/lib/jvm/adoptopenjdk-16-hotspot-amd64/bin/java   1161      manual mode
  2            /usr/lib/jvm/java-11-openjdk-amd64/bin/java           1111      manual mode
  3            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java        1081      manual mode
Vrokky commented 3 years ago

https://ubuntuhandbook.org/index.php/2021/03/oracle-java-16-released-install-ubuntu-20-04/

This works for me :)

RSAKing commented 3 years ago

https://ubuntuhandbook.org/index.php/2021/03/oracle-java-16-released-install-ubuntu-20-04/

This works for me :)

TKs! This works to for me.