Systemctl start mattermost.service is failing

I created the mattermost.service file in /lib/systemd/system directory per the website documentations. However, the getting the following error:

[root@bde3 mattermost]# systemctl start mattermost
Job for mattermost.service failed because the control process exited with error code.
See “systemctl status mattermost.service” and “journalctl -xe” for details.

[root@bde3 mattermost]# systemctl start mattermost
Job for mattermost.service failed because the control process exited with error code.
See “systemctl status mattermost.service” and “journalctl -xe” for details.
[root@bde3 mattermost]# systemctl status mattermost
● mattermost.service - Mattermost
Loaded: loaded (/usr/lib/systemd/system/mattermost.service; enabled; vendor preset: disabled)
Active: activating (start) since Tue 2022-09-27 11:48:41 CDT; 6ms ago
Main PID: 2333 ((ttermost))
Tasks: 0 (limit: 49565)
CGroup: /system.slice/mattermost.service
└─2333 (ttermost)

Sep 27 11:48:41 bde3.bluedragon.local systemd[1]: Starting Mattermost…

OUTPUT OF journalctl -xe

– Subject: Automatic restarting of a unit has been scheduled
– Defined-By: systemd
– Support: Red Hat Customer Experience & Engagement - Red Hat Customer Portal

– Automatic restarting of the unit mattermost.service has been scheduled, as the result for
– the configured Restart= setting for the unit.
Sep 27 11:49:22 bde3.bluedragon.local systemd[1]: Stopped Mattermost.
– Subject: Unit mattermost.service has finished shutting down
– Defined-By: systemd
– Support: Red Hat Customer Experience & Engagement - Red Hat Customer Portal

– Unit mattermost.service has finished shutting down.
Sep 27 11:49:22 bde3.bluedragon.local systemd[1]: Starting Mattermost…
– Subject: Unit mattermost.service has begun start-up
– Defined-By: systemd
– Support:

– Unit mattermost.service has begun starting up.
Sep 27 11:49:22 bde3.bluedragon.local systemd[2368]: mattermost.service: Failed to execute command: Permission denied
Sep 27 11:49:22 bde3.bluedragon.local systemd[2368]: mattermost.service: Failed at step EXEC spawning /opt/mattermost/bin/mattermost: Pe>
– Subject: Process /opt/mattermost/bin/mattermost could not be executed
– Defined-By: systemd
– Support:

– The process /opt/mattermost/bin/mattermost could not be executed and failed.

– The error number returned by this process is 13.
Sep 27 11:49:22 bde3.bluedragon.local systemd[1]: mattermost.service: Main process exited, code=exited, status=203/EXEC
Sep 27 11:49:22 bde3.bluedragon.local systemd[1]: mattermost.service: Failed with result ‘exit-code’.
– Subject: Unit failed
– Defined-By: systemd
– Support:

– The unit mattermost.service has entered the ‘failed’ state with result ‘exit-code’.
Sep 27 11:49:22 bde3.bluedragon.local systemd[1]: Failed to start Mattermost.
– Subject: Unit mattermost.service has failed
– Defined-By: systemd
– Support:

– Unit mattermost.service has failed.

I’m not sure why there’s a permission error. User and group mattermost exist and the file has correct permissions to execute:

[root@bde3 mattermost]# ls -lah bin/mattermost
-rwxrwxr-x. 1 mattermost mattermost 86M Sep 14 07:33 bin/mattermost

Well, after some more searching, it appears that turning off or making permissive SELinux fixed the issue.

I disabled SELinux by editing /etc/selinux/config and changing the entry:
SELINUX=enforcing
to
SELINUX=disabled

It worked before this changing the environment with:
setenforce 0

This changed SELinux to permissive.

However, I went ahead and disabled it and made it persistent by also editing file (above).

Hi dbrianhendrix, welcome to the Mattermost forums and thanks for sharing the solution with us!

To find out what the exact reason was, you can check your logfiles. Depending on your distribution and configuration, it will one of those files:

  • /var/log/messages
  • /var/log/audit/audit.log
  • /var/log/syslog
  • /var/log/secure

You should see log lines like SELinux is preventing which might then help you find out what the real problem was. If I need to guess I’d say that you did configure your Mattermost server to bind to a low-port (80 f.ex.) and this is prevented by default, maybe the required capability is also missing (as mentioned in the documentation) or some filesystem access has not been allowed.