[SOLVED] Systemctl doesnt work but ./webui.js does?

As the title says systemctl start mineos doesnt work but if i run /webui.js manually the webui runs??

Heres the systemctl status mineos.service :slight_smile:

systemd[1]: mineos.service: Service RestartSec=100ms expired, scheduling restart.
systemd[1]: mineos.service: Scheduled restart job, restart counter is at 5.
systemd[1]: Stopped Start MineOS minecraft front-end.
systemd[1]: mineos.service: Start request repeated too quickly.
systemd[1]: mineos.service: Failed with result ‘exit-code’.
systemd[1]: Failed to start Start MineOS minecraft front-end.

systemctl relies on the definitions provided inside the systemd script at /etc/systemd/system/mineos.service.

If, for any reason, any of these values don’t work for your existing environment, that would explain the failure. I’m assuming then, that you have an unchanged service file, so that also suggests to me that systemctl start mineos never worked, correct?

[Unit]
Description=Start MineOS minecraft front-end
After=network.target

[Service]
User=root
WorkingDirectory=/usr/games/minecraft
Type=forking
Environment="SHELL=/bin/bash"
ExecStart=/usr/bin/node service.js start
ExecStop=/usr/bin/node service.js stop
ExecReload=/usr/bin/node service.js restart
PIDFile=/var/run/mineos.pid
Restart=on-failure
KillMode=process

[Install]
WantedBy=multi-user.target

My best guess, therefore, is that you have multiple versions of node available.

This is because webui.js has as the shebang (first line of code):

#!/usr/bin/env node

Which is different from what the service file is invoking:

/usr/bin/node

If you have multiple versions of node, env will instead use your $PATH and find the first available node binary, whereas the service file always will choose /usr/bin/node.

Solutions:

  1. remove the system version of node (likely the version that doesn’t work) and replace /usr/bin/node with a symlink to your existing, working node.

  2. change the service file to point directly to the node version that does work. You can find out this path by typing which node as root, or by echo $PATH and walking through each dir to find the first node binary.

Here’s more information on how env works:

Thank you :slight_smile: That was it. couldnt find any info on it anywhere but didnt search for too long so just decided to ask here instead since i saw you were online atm :slight_smile:

I just did ´which node´ and changed it to that path