gunicorn current command vanished from the unit file
Asked Answered
T

4

8

I am trying to follow this tutorial to deploy my flask app: https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04

I am seeing the error, current command vanished from the unit file, execution of the command list wont be resumed. When I check systemctl of the gunicorn I just configured.

and this is my unit file.

thank you in advance

Telegu answered 26/5, 2021 at 1:16 Comment(0)
F
7

My solution was to stop the project, reload daemon and start once again.

sudo systemctl stop PROJECT_NAME
sudo systemctl daemon-reload
sudo systemctl start PROJECT_NAME
sudo systemctl enable PROJECT_NAME
Fontana answered 13/12, 2022 at 18:15 Comment(0)
N
1

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.

Nial answered 18/9, 2021 at 20:12 Comment(0)
S
1

You have to stop and disable the service:

sudo systemctl stop myproject
sudo systemctl disable myproject
Spate answered 9/6, 2022 at 18:7 Comment(0)
F
1

For me, I was creating a Ruby application service and made a change in the systemd file to start in a different ip and i was having the same error. As the @kefeng91 suggested I did this

  1. systemctl stop example.service
  2. systemctl disable example.service
  3. systemctl enable example.service
  4. systemctl start example.service

and Worked after doing the

systemctl daemon-reload and checking in the

systemctl status example.service

As I understood in every change of the .service we need to stop and reload the service

Fecal answered 7/2, 2023 at 13:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.