agowa/MinecraftSystemdUnit

Not working for me

Closed this issue · 3 comments

When I try to start the service, nothing seems to happen (I guess that's normal).
When I run systemctl status minecraft@vanilla.service I get this:

minecraft@vanilla.service: Unit entered failed state.
minecraft@vanilla.service: Failed with result 'exit-code

Do you have any idea what I could be doing wrong?

agowa commented

Which Minecraft Server Version do you use?
Please poste the output of these commands:

  • systemctl status minecraft@vanilla.service
  • which java
  • java -version
  • which screen
  • screen -version
  • tree -L 3 /opt/
  • tail -n 20 /opt/minecraft/vanilla/logs/latest.log

I got the same issue. I´m using ubuntu 16.04 with openjdk-9.
Herre is the output of the commands:

systemctl status

minecraft@vanilla.service - Minecraft Server vanilla
   Loaded: loaded (/etc/systemd/system/minecraft@.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Thu 2017-07-27 11:30:04 CEST; 27s ago
  Process: 8287 ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval stuff "say SERVER SHUTTING DOWN. Saving map..."\015 (code=exited, status=1/FAILURE)
  Process: 8276 ExecStart=/bin/sh -c /usr/bin/screen -DmS mc-%i /usr/bin/java -server -Xms512M -Xmx2048M -XX:+UseG1GC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinH
 Main PID: 8276 (code=exited, status=0/SUCCESS)

Jul 27 11:30:04 XXXXX.XX.net systemd[1]: minecraft@vanilla.service: Control process exited, code=exited status=1
Jul 27 11:30:04 XXXXX.XX.net systemd[1]: minecraft@vanilla.service: Unit entered failed state.
Jul 27 11:30:04 XXXXX.XX.net systemd[1]: minecraft@vanilla.service: Failed with result 'exit-code'.

which java

/usr/bin/java

java -version

openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)

which screen

/usr/bin/screen

screen -version

Screen version 4.03.01 (GNU) 28-Jun-15

tree -L 3 /opt/

/opt/
`-- minecraft
    `-- vanilla
        |-- banned-ips.json
        |-- banned-players.json
        |-- eula.txt
        |-- logs
        |-- minecraft_server.1.12.jar.bak
        |-- minecraft_server.jar
        |-- ops.json
        |-- server.properties
        |-- usercache.json
        |-- whitelist.json
        `-- world

tail -n 20 /opt/minecraft/vanilla/logs/latest.log

This is from the server being run with the command line before using the systemdunit

[20:12:31] [Server thread/INFO]: Preparing spawn area: 12%
[20:12:32] [Server thread/INFO]: Preparing spawn area: 15%
[20:12:33] [Server thread/INFO]: Preparing spawn area: 19%
[20:12:34] [Server thread/INFO]: Preparing spawn area: 24%
[20:12:35] [Server thread/INFO]: Preparing spawn area: 30%
[20:12:36] [Server thread/INFO]: Preparing spawn area: 36%
[20:12:37] [Server thread/INFO]: Preparing spawn area: 42%
[20:12:38] [Server thread/INFO]: Preparing spawn area: 49%
[20:12:39] [Server thread/INFO]: Preparing spawn area: 58%
[20:12:40] [Server thread/INFO]: Preparing spawn area: 68%
[20:12:41] [Server thread/INFO]: Preparing spawn area: 77%
[20:12:42] [Server thread/INFO]: Preparing spawn area: 87%
[20:12:43] [Server thread/INFO]: Preparing spawn area: 99%
[20:12:43] [Server thread/INFO]: Done (16.861s)! For help, type "help" or "?"
[20:14:23] [User Authenticator #1/INFO]: UUID of player DerDegu is 9c88bd7c-a767-4399-b93f-095dc2c161d6
[20:14:23] [Server thread/INFO]: $name[/XXX.XXX.XXX.XXX:63735] logged in with entity id 2452 at (-116.5, 67.0, 254.5)
[20:14:23] [Server thread/INFO]: $name joined the game
[20:14:26] [Server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 2088ms behind, skipping 41 tick(s)
[20:26:26] [Server thread/INFO]: $name lost connection: Disconnected
[20:26:26] [Server thread/INFO]: $name left the game

syslog

Jul 27 11:42:07 vmdXXXX systemd[1]: minecraft@vanilla.service: Service hold-off time over, scheduling restart.
Jul 27 11:42:07 vmdXXXX systemd[1]: Stopped Minecraft Server vanilla.
Jul 27 11:42:07 vmdXXXX systemd[1]: Started Minecraft Server vanilla.
Jul 27 11:42:07 vmdXXXX screen[8555]: No screen session found.
Jul 27 11:42:07 vmdXXXX systemd[1]: minecraft@vanilla.service: Control process exited, code=exited status=1
Jul 27 11:42:07 vmdXXXX systemd[1]: minecraft@vanilla.service: Unit entered failed state.
Jul 27 11:42:07 vmdXXXX systemd[1]: minecraft@vanilla.service: Failed with result 'exit-code'.

Might the problem be resolved if I used openjdk-8? or is it screen related?

agowa commented

@TheSquidly can you please add " -L -Logfile /tmp/screen.log" to the unit file right after "screen" in line 19.
After that run "systemctl daemon-reload && systemctl start minecraft@vanilla.service". That will generate a capture of everything happening within the screen session. Either java or screen aren't behaving right for you. Also I want to note, that openjdk 9 is a pre-release, the final version will be released next month.
Please also post the output of "ls -la /opt/minecraft/vanialla".