Writefreely Service Fails to Start

I am about to give up on this. Any help would be appreciated.
Same issue as here and here. Neither had a solution listed. Web searches came up empty/irrelevant.

When I try to start the writefreely service it errors with a permission denied message.

Edit: Forgot OS info: Ubuntu 20.04.1 LTS

Contents of /etc/systemd/system/writefreely.service:

[Unit]
Description=WriteFreely Instance
After=syslog.target network.target

[Service]
Type=simple
StandardOutput=syslog
StandardError=syslog
WorkingDirectory=/var/www/domain
ExecStart=/var/www/domain/writefreely
Restart=always

[Install]
WantedBy=multi-user.target

Results from journalctl -f -u writefreely

Jan 18 21:50:25 localhost systemd[1]: Started WriteFreely Instance.
Jan 18 21:50:25 localhost systemd[64713]: writefreely.service: Failed to execute command: Permission denied
Jan 18 21:50:25 localhost systemd[64713]: writefreely.service: Failed at step EXEC spawning /var/www/domain/writefreely: Permission denied
Jan 18 21:50:25 localhost systemd[1]: writefreely.service: Main process exited, code=exited, status=203/EXEC
Jan 18 21:50:25 localhost systemd[1]: writefreely.service: Failed with result ‘exit-code’.
Jan 18 21:50:25 localhost systemd[1]: writefreely.service: Scheduled restart job, restart counter is at 5.
Jan 18 21:50:25 localhost systemd[1]: Stopped WriteFreely Instance.
Jan 18 21:50:25 localhost systemd[1]: writefreely.service: Start request repeated too quickly.
Jan 18 21:50:25 localhost systemd[1]: writefreely.service: Failed with result ‘exit-code’.
Jan 18 21:50:25 localhost systemd[1]: Failed to start WriteFreely Instance.

Results from systemctl status writefreely:

● writefreely.service - WriteFreely Instance
     Loaded: loaded (/etc/systemd/system/writefreely.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2021-01-18 21:50:25 UTC; 8h ago
    Process: 64713 ExecStart=/var/www/domain/writefreely (code=exited, status=203/EXEC)
   Main PID: 64713 (code=exited, status=203/EXEC)

Jan 18 21:50:25 localhost systemd[1]: writefreely.service: Scheduled restart job, restart counter is at 5.
Jan 18 21:50:25 localhost systemd[1]: Stopped WriteFreely Instance.
Jan 18 21:50:25 localhost systemd[1]: writefreely.service: Start request repeated too quickly.
Jan 18 21:50:25 localhost systemd[1]: writefreely.service: Failed with result 'exit-code'.
Jan 18 21:50:25 localhost systemd[1]: Failed to start WriteFreely Instance.

Results from ls -l /var/www/domain/writefreely/

-rw-r–r-- 1 root root 1612 Jan 18 21:25 config.ini
drwxr-xr-x 2 user user 4096 Apr 22 2020 keys
drwxr-xr-x 2 user user 4096 Apr 22 2020 pages
drwxr-xr-x 7 user user 4096 Apr 22 2020 static
drwxr-xr-x 4 user user 4096 Apr 22 2020 templates
-rwxr-xr-x 1 root root 51534752 Apr 22 2020 writefreely

Thank you for your time!

Hi, if you’re running ls -l /var/www/domain/writefreely/, then your systemd file doesn’t have the correct directory / executable path in it, which is why you’re getting the “Permission denied” error. Instead of this:

WorkingDirectory=/var/www/domain
ExecStart=/var/www/domain/writefreely

It should be this:

WorkingDirectory=/var/www/domain/writefreely
ExecStart=/var/www/domain/writefreely/writefreely

Could you try that and let us know if that works?

Thanks Matt, that resolved the permissions issue. It’s so obvious now :expressionless:

All good! Glad it worked, and thanks for confirming – I’ve marked this as “solved.”