systemctl strange error: Invalid arguments

hsfzxjy picture hsfzxjy · Feb 13, 2017 · Viewed 19.8k times · Source

Here's my service file:

[Unit]
Description=Daphne Interface

[Service]
ExecStartPre=cd /home/git/hsfzmun/server
ExecStart=/bin/bash/ -c "cd /home/git/hsfzmun/server && /home/git/virtualenvs/hsfzmun/bin/daphne -b 0.0.0.0 -p 8001 -v2 config.asgi:channel_layer"
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all

[Install]
WantedBy=multi-user.target

When I execute sudo systemctl start daphnei I get:

Failed to start daphnei.service: Unit daphnei.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status daphnei.service' for details.

And the result of systemctl status daphnei.service:

* daphnei.service - Daphne Interface
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead) (Result: exit-code) since Mon 2017-02-13 19:55:10 CST; 13min ago
 Main PID: 16667 (code=exited, status=1/FAILURE)

What's wrong? I am using Ubuntu Server 16.04.

Answer

teejay picture teejay · Jul 19, 2018

Generally, to debug exact cause of "Invalid argument", you can use:

sudo systemd-analyze verify daphnei.service

or in case of user's local service:

sudo systemd-analyze --user verify daphnei.service