Thue / rfwadmin

A web interface for controlling a MineCraft server, optimized for custom maps
GNU General Public License v3.0
68 stars 16 forks source link

Not sure if server is running #19

Closed powerunlimited closed 9 years ago

powerunlimited commented 10 years ago

I get a few odd error output near the end the install script

Starting Screen session... Started!
Starting Minecraft server... Command failed: java -Xms1024M -Xmx1024M -server -jar/var/lib/minecraft/jars/serverjars/minecraft_server.1.7.9.jar nogui & echo $! > /var/lib/minecraft/servers/default/minecraft.pid && fg; echo "MMMMinecraft is stopped"; exit

Started!

After that it exits normally and also shows that the server is running in the web interface but I'm not able to connect nor manage the server at all. It also refuses to stop says that it's unable to save. If I try to kill it It prints

Sending kill signal to first java process... 
Can't find screen id, so can't find screen pid
Couldn't find screen, so java presumably not running.
Minecraft process seems to have been killed!

Then I try to restart it resulting in the same situation as the first one

Starting Screen session... Started!
Starting Minecraft server... Command failed: java -Xms1024M -Xmx1024M -server -jar /var/lib/minecraft/jars/serverjars/minecraft_server.1.7.9.jar nogui & echo $! > /var/lib/minecraft/servers/default/minecraft.pid && fg; echo "MMMMinecraft is stopped"; exit
Started!

already tried deleting the /var/lib/minecraft directory and running the install script again, still the same problem
OS: Ubuntu 12.04 Anybody knows what's going on? thanks in advance~

Thue commented 10 years ago

What happens if you stand in /var/lib/minecraft/servers/default/server and execute

java -Xms1024M -Xmx1024M -jar /var/lib/minecraft/jars/serverjars/minecraft_server.1.7.9.jar nogui

Any interesting output? Could you also send me the contents of /var/lib/minecraft/servers/default/screen.log ?

Sorry for the late answer :(

powerunlimited commented 10 years ago

Ok I'll try it as soon as I have some spare time tomorrow. I suspect the problem is that I su ed to the user that was running the script instead of directly using the login session. This often causes permission errors in screen will also take a look at this.

Thue commented 10 years ago

Could be a permission error. Make sure that everything below /var/lib/minecraft/servers/default/ is owned by www-data.

Also when running the java command I suggested, do that as www-data, otherwise it might create stuff owned by root.

powerunlimited commented 10 years ago

OK somehow I got it to work. What I did,

make sure that all screen sessions were killed found one mcsrv running under www-data but didn't have the correct permissions to use it. killed

started a minecraft server from the web interface still outputs

Starting Screen session... Started!
Starting Minecraft server... Command failed: java -Xms1024M -Xmx1024M -server -jar /var/lib/minecraft/jars/serverjars/minecraft_server.1.7.9.jar nogui & echo $! > /var/lib/minecraft/servers/default/minecraft.pid && fg; echo "MMMMinecraft is stopped"; exit
Started!

went into screen finding that the server was actually running fine

tried to stop the server. works flawlessly check to make sure that there are no wild screen sessions. all killed

screen.log

 $ cd /var/lib/minecraft/servers/default/server
$ java -Xms1024M -Xmx1024M -server -jar /var/lib/minecraft/jars/serverjars/minecraft_server.1.7.9.jar nogui & echo $! > /var/lib/minecraft/servers/default/minecraft.pid && fg; echo "MMMMinecraft is stopped"; exit
java -Xms1024M -Xmx1024M -server -jar /var/lib/minecraft/jars/serverjars/minecraft_server.1.7.9.jar nogui
[23:05:51] [Server thread/INFO]: Starting minecraft server version 1.7.9
[23:05:51] [Server thread/INFO]: Loading properties
[23:05:51] [Server thread/INFO]: Default game type: SURVIVAL
[23:05:51] [Server thread/INFO]: Generating keypair
[23:05:51] [Server thread/INFO]: Starting Minecraft server on *:25565
[23:05:51] [Server thread/INFO]: Preparing level "world"
[23:05:51] [Server thread/INFO]: Preparing start region for level 0
[23:05:52] [Server thread/INFO]: Preparing spawn area: 97%
[23:05:52] [Server thread/INFO]: Done (1.111s)! For help, type "help" or "?"
list
[23:06:32] [Server thread/INFO]: There are 0/20 players online:
[23:06:32] [Server thread/INFO]:
say Server shutting down...
[23:20:28] [Server thread/INFO]: [Server] Server shutting down...
say Server going down! Saving world...
[23:20:28] [Server thread/INFO]: [Server] Server going down! Saving world...
save-all
[23:20:28] [Server thread/INFO]: Saving...
[23:20:28] [Server thread/INFO]: Saved the world
stop
[23:20:28] [Server thread/INFO]: Stopping the server
[23:20:28] [Server thread/INFO]: Stopping server
[23:20:28] [Server thread/INFO]: Saving players
[23:20:28] [Server thread/INFO]: Saving worlds
[23:20:28] [Server thread/INFO]: Saving chunks for level 'world'/Overworld
[23:20:28] [Server thread/INFO]: Saving chunks for level 'world'/Nether
[23:20:28] [Server thread/INFO]: Saving chunks for level 'world'/The End
[23:20:28] [Server Shutdown Thread/INFO]: Stopping server
[23:20:28] [Server Shutdown Thread/INFO]: Saving players
MMMMinecraft is stopped

Odd, I might try a full re-install and test it again just to make sure, maybe tomorrow. So any clue about whats causing the error?

Also

deleting the /var/lib/minecraft directory and running the install script again

fully re-installs rfwadmin right?

Thue commented 10 years ago

Ah, cool :).

deleting the /var/lib/minecraft directory and running the install script again fully re-installs rfwadmin right?

There is also some stuff under /var/www/rfwadmin . And /etc/init.d/minecraftdefault.sh and /etc/rc.d/_minecraft_default.sh . But those very likely didn't cause your problems, and rerunning the install script will just skip those if they already exist.

Thue commented 10 years ago

The problem seems to be related to this:

http://serverfault.com/questions/116775/sudo-as-different-user-and-running-screen/116830

I am not sure why it occurs, but I have also seen it spuriously. I am really not an expect on UNIX terminals, and it seems absurd to me that it can't just work as is...

Thue commented 10 years ago

I can reproduce it on the first run if I 1) clone a fresh vm with a Debian6 installation 2) install rfwadmin from scratch.

No matter what else I do, it doesn't seem to happen. Which is very annoying for trying to fix the problem...

gpmidi commented 10 years ago

I didn't think sudo was involved. If it is, what version of sudo is in use? There is a known issue with a sudo behavior change that breaks a lot of automation (like the stuff I use at work).

Thue commented 9 years ago

I switched from screen to tmux, seems to work now.