The default version of Java in Ubuntu 18.04 (11) doesn't work properly with mcserver. I have the following setup as a pre-req which will get this server up and running now:
add-apt-repository -y ppa:webupd8team/java
apt -q -y remove openjdk-11*
apt -q -y purge openjdk-11*
apt -q -y install mailutils postfix curl wget file bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc tmux openjdk-8-jre-headless oracle-java8-set-default
I recently had perfect success with mcserver and Debian 9 with around 6 instances on two servers, working flawlessly. I would advise Debian for Minecraft.
Makes sense, just wanted to share a best practice for Ubuntu 18.04 for those that may prefer working with that flavor.
Makes sense as well, thanks for your share.
Do you think we should change LinuxGSM's documentation regarding Java applications for Ubuntu?
The thing is each distro only has one dependency possibility, so we need kind of a universal (for each distro) package requirement.
I think it's safe to say that JRE/JDK for Java 1.8 should be the requirement per some of the documentation I've been reading: https://minecraft.gamepedia.com/Server/Requirements. Just this package should work: openjdk-8-jre-headless.
I had to do a lot of digging to find this out, and there were a few Reddit threads where folks complained of this same issue, so this could be fairly prevalent: https://www.reddit.com/r/Minecraft/comments/8fpy67/failure_to_connect_to_authentication_servers_on/ and https://www.reddit.com/r/Minecraft/comments/8hih03/trouble_setting_up_server_on_ubuntu_1804/ as examples.
Minecraft Wiki
Hello! I can't connect to any servers due to an ```Failure to connect. Failed to login: The authentication servers are currently down for...
Edit: **Solved!** In short, you need java 8 \(having other version like 10/11 will cause problems so you need to uninstall those packages. Follow...
So to sum up, there is an issue with the default-jdk with the latest ubuntu, instead, it is advised to install openjdk-8-jre-headless, which is the default in Debian 9.
The two Debian 9 machines I got handy who had default-jdk installed show:
root@gaben:~# java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-1~deb9u1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
So documentation for Ubuntu should be altered.
And package check for java should probably let the user chose whatever version he likes and be:
if [ -z "$(which java)" ]; then
echo "Java is not installed"
exit 1
fi
Yes, that is accurate and sounds like a good plan. Thanks @UltimateByte !
I have changed from default-jre to openjdk-8-jre-headless as the package for Ubuntu.
will need to check to see if this issue exists with Project Zomboid as well.
I have done further testing and I don't think the java version is the issue. I have just tested using java-11-openjdk which is what the default-jre is for Ubuntu 18.04 and it works. The issue is related to the executable for Minecraft missing nogui
java -Xmx${javaram}M -jar ${serverfiles}/minecraft_server.jar nogui
Im going to fun further tests to make sure but I think that is the problem
Confirmed this fix and is now ready for next release
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
So to sum up, there is an issue with the
default-jdkwith the latest ubuntu, instead, it is advised to installopenjdk-8-jre-headless, which is the default in Debian 9.The two Debian 9 machines I got handy who had
default-jdkinstalled show:So documentation for Ubuntu should be altered.
And package check for java should probably let the user chose whatever version he likes and be: