Systemd unit file not working

I’m following Install Mattermost on Ubuntu 20.04 LTS — Mattermost documentation to install MatterMost on a Ubuntu 20.04 LTS system with mysqld.

I can run /opt/mattermost/bin/mattermost as the mattermost user, and the server starts.

Using the systemd unit file in step 10 I get:

Nov 8 17:04:12 winky systemd[1]: mattermost.service: Failed to load environment files: No such file or directory
Nov 8 17:04:12 winky systemd[1]: mattermost.service: Failed to run ‘start’ task: No such file or directory
Nov 8 17:04:12 winky systemd[1]: mattermost.service: Failed with result ‘resources’.
Nov 8 17:04:12 winky systemd[1]: Failed to start Mattermost.

Hi jnojr and welcome to the Mattermost forums!

The systemd file in the documentation you mentioned does not contain any links to an environment file which is mentioned in your error message here, so please post the output of:

systemctl status mattermost

In there you will see a list of service files it is being liked to, most likely this will be /lib/systemd/system/mattermost.service only, but it could also be a different path or additional files. Post the contents of them all here so we can have a look.

Fixed!

I had somehow wound up with:

joliver@winky:~$ cat /etc/systemd/system/mattermost.service.d/omnibus-overrides.conf
[Unit]
After=postgresql.service
Requires=postgresql.service

[Service]
Environment=
EnvironmentFile=/etc/mattermost/mmomni.mattermost.env

[Install]
WantedBy=postgresql.service

Removed it, and all is well.

This is interesting - where did you get this file from? This should only be installed as part of the Omnibus installation.