gunicorn current command vanished from the unit file

Viewed 3800
2 Answers

You have to stop and disable the service:

sudo systemctl stop myproject
sudo systemctl disable myproject

I know I'm late in replying, but this is a really weird thing that seems to happen once in a while.

The fix is obscure: you will have to manually edit a system file, so be extra-careful when doing that. The file in question is /usr/lib/systemd/system/initrd-switch-root.service.

As root, open that file with your favourite editor, and scroll down to the line that says:

ExecStart=systemctl --no-block switch-root /sysroot

and change it to

ExecStart=/usr/bin/systemctl --no-block switch-root /sysroot

Then run systemctl daemon-reload, and you should be able to start your unit.

In my case (a completely different application), I have noticed that the error still lingers, but at least the application truly starts...

Source: https://github.com/systemd/systemd/issues/16076

Note that the above-mentioned fix was applied to systemd version 246 or 247 or so, back in mid-2020. However, Ubuntu 20.04.3 LTS, as of today (September 2021), still uses systemd 245. Your own Ubuntu 18.04 is very likely using an even earlier version.

Related