skip to Main Content

i am trying to follow the following 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

4

Answers


  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.

    Login or Signup to reply.
  2. You have to stop and disable the service:

    sudo systemctl stop myproject
    sudo systemctl disable myproject
    
    Login or Signup to reply.
  3. 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
    
    Login or Signup to reply.
  4. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search