Server starts then crashes a few seconds later

I am using the latest MineOS installer .iso, downloaded today (April 16 2020). I am installing it using Virtualbox, I don’t think that is the issue since it works when I create the server using root. But just for the same of knowing as much about my install as possible.

Using the “mc” user I can use the WebUI to create a server and start it. The server starts and after a few seconds it stops itself with no explanation and no log files created. Sometimes it gets as far as asking about the EULA, sometimes not.

If I login to the WebUI using “root” everything works, I had it running long enough to login and play a half hour so far.

You didn’t mention if you first start the server and then accept the EULA or click on the EULA first then start the server. In Minecraft, when your server starts, does the game see the server and then crash? Do you have the server properties set the same as when you log into root?

It sometimes gets as far as asking about the EULA. If it does I click accept and it restarts. Then it goes offline a few seconds later like I described before. I use the same settings for both usernames, yes.

The game does see it running if it stays online long enough for the game to register a LAN session but it crashes while I try to log into it. It crashes either way though. If I just sit there and look at the WebUI it will crash also.

…The Play-by-Play…
I set the name of the server and change nothing else.
I go to Profiles and download the 1.15.2 profile from Mojang.
I press [Copy profile to live server files].
I select it under “Java Settings”.
I change both memory sizes to 512M.
I press [Start]
After a couple seconds I accept the EULA and restart.
It starts again.
After a few seconds it goes down.

This time right now as I am writing this and recording what I am doing for exactness…
I press [Start] again.
It stays up for around 20 seconds
It takes almost 400MB of memory
It goes down

Change the xmx to like 1-2 Gigs if possible and the xms 0. It is not a good idea to keep them equal.

Check your java version and if it is not jdk 8 then downgrade it (but i guess it is).

Type in the console the following line:
chmod -R a+rwx var/games/minecraft/servers/server_name

where server_name is your crashing servers name

This is literally the exact opposite of almost everything I’ve been preaching for 10 years, though.

This is definitely not something I would recommend here, either. The problem is probably permissions, but whatever it is, basically, giving chmod permissions like this is definitely not normal troubleshooting paths, as far as I’m concerned. Files don’t need to be universally writable (even if this might workaround the issue), they need to be properly owned by the correct user, so chown is appropriate here, instead.

This is because you logged in as root. Basically, doing this – logging in as root, then starting the server is literally what broke it all.

This should never happen. Nobody should ever do it, but people new to Linux tend to be rewarded when they try something that doesn’t work, but doing it as the most powerful user on the system.

When you do that, you make it so only the most powerful user on the system can work, going forward (on that server).

Step 1:

Never login to the webui as root. Yes, it’s possible that I could prohibit it in code, but I don’t want to do that. If people will continue logging in as root, I’ll give them the opportunity to learn what broke, and hopefully learn to do things differently.

Step 2:

chown all your files to be owned by mc:mc (or whatever non-root user you use. That should apply to /var/games/minecraft/servers/*, etc.:

chown -R mc:mc /var/games/minecraft/servers/*
chown -R mc:mc /var/games/minecraft/archives/*
chown -R mc:mc /var/games/minecraft/backup/*

Step 3:

Never login to the webui as root. Log in as the user from the above command and try again.

I understand the problem about the chmod but i usually say this since it is a simpler and almost the same solution as chown. Of course there are files that does not need to be write-able but why is it a problem if they are?

And sorry i do not really know much about jvm arguments. I have seen others talk about this and that’s where that xmx-xms should not be the same came from. Would you please explain why is it good to keep them at the same?

Because if there is more than one login on the system, then that user, unprivileged can do this:

rm -rf /var/games/minecraft/servers/*

You’ve given _all users, no matter who you are, write access to each of the files (tamper with file) and the ability to delete the files. It’s poor security practice, even if security of a casual minecraft server is not the highest focus.

Also, here’s my own personal take on it: Need help with java crashing with SIGSEGV error

Thanks for explaining it and you have good points there. Will definitely read the stackoverflow link asap and i did not think through the security issues of this too much, i admit that.