1

I have the following systemd unit file for a Python server using Gunicorn, located at /etc/systemd/system/gunicorn-fizzbuzz.service:

[Unit]
Description=Gunicorn server for FizzBuzz

[Service]
Restart=on-failure
User=deploy
WorkingDirectory=/home/deploy/current/fizzbuzz
EnvironmentFile=/home/deploy/current/fizzbuzz/env/env-fizzbuzz

ExecStart=/home/deploy/current/fizzbuzz/.venv/bin/gunicorn \
    --bind unix:/tmp/fizzbuzz.socket \
    fizzbuzz.wsgi:application

[Install]
WantedBy=multi-user.target

When I try to enable this service with systemctl daemon-reload && systemctl enable gunicorn-fizzbuzz.service, I get the error Failed to lookup unit file state: Invalid argument. Apparently this is a generic systemd error message indicating that something is wrong with my unit file.

I have checked

  • that a user named deploy exists
  • that /home/deploy/current/fizzbuzz exists
  • that /home/deploy/current/fizzbuzz/env/env-fizzbuzz exists
  • that the ExecStart command works

Can anyone see how this unit file is incorrect? I am running Ubuntu 18.04 with version 4.15.0-144-generic of the Linux kernel.

iafisher
  • 938
  • 7
  • 14
  • I assume you found & tried all options presented [here](https://stackoverflow.com/questions/48177558/what-does-failed-to-execute-operation-invalid-argument-mean-when-running-syst)? – tink Jul 17 '21 at 20:45
  • What do you know, the very last answer, with 0 upvotes, is what worked for me. – iafisher Jul 17 '21 at 21:51
  • Heh. Can we close this as a dupe, then, or do you just want to delete it? – tink Jul 17 '21 at 21:52
  • Well, that question isn't very helpful for this specific problem because it doesn't contain the specific error message `Failed to lookup unit file state: Invalid argument` so it doesn't show up in search results. If we mark this question as a dupe, will it still be discoverable? – iafisher Jul 17 '21 at 21:55
  • I think so - dupes to the best of my knowledge hang around. I may be wrong, though. – tink Jul 17 '21 at 21:58
  • 1
    Marked as dupe. Thanks for the help! – iafisher Jul 17 '21 at 22:05
  • Welcome. And it indeed won't get roomba'ed, there's an upvote for your cooperation and the "pointer" to the other thread. – tink Jul 17 '21 at 22:23

0 Answers0