Error when trying to start server using script


#1

I’m getting this error with any user that’s not root when I’m trying to start spigot server with the script file.

script file:
#!/bin/bash
sleep 60
cd /usr/games/minecraft
./mineos_console.js -s Creative start

and the error it gives me:

internal/child_process.js:323
throw errnoException(err, ‘spawn’);
^
Error: spawn EPERM
at _errnoException (util.js:1022:11)
at ChildProcess.spawn (internal/child_process.js:323:11)
at Object.exports.spawn (child_process.js:502:9)
at /usr/games/minecraft/mineos.js:825:34
at fn (/usr/games/minecraft/node_modules/async/lib/async.js:746:34)
at /usr/games/minecraft/node_modules/async/lib/async.js:1213:16
at /usr/games/minecraft/node_modules/async/lib/async.js:166:37
at /usr/games/minecraft/node_modules/async/lib/async.js:706:43
at /usr/games/minecraft/node_modules/async/lib/async.js:167:37
at /usr/games/minecraft/node_modules/async/lib/async.js:1209:30


#2

Have you ever run that script as root? If so, that script would have started the Minecraft server process as root, creating files owned by root.

mc, then, cannot create/modify files owned by root, so non-root users like mc would fail.

Check the ownership of your files in /var/games/minecraft/servers/Creative. Every file and every directory, recursively, should be owned by mc:mc.


#3

I’ve tried to run it as a root and it works. But i need to run it with non root user. And all the server files are owned by the user I’m trying to run it as.


#4

Because you ran it as root, it no longer works for mc.

If you literally never ran it as root, it would work as mc. Fix with chown -R mc:mc /var/games/minecraft/servers/Creative.

I think if you dig deeper into the directories, you’ll see that there are files owned by root:root.


#5

same… did chown -R user:group /var/games/minecraft/servers/Creative


#6

Are you changing what you’re actually typing? It becomes increasingly difficult to troubleshoot issues on your machine when you share different things than what you’re doing.


#7

chown -R WarWolf:Staff /var/games/minecraft/servers/Creative

Running that script with ssh using that exact user still gives me that error. And it does nothing when spigot runs it during restart.


#8

What could be causing this?


#9

I would recommend running that chown as root to change ownership to your non root user and group, and then try it again without root (you’ve not indicated whether you’ve run that as root or not)


#10

i used root to run that chown command