Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to get unit file state for ghost_<url>.service #293

Closed
aileen opened this issue Jul 6, 2017 · 4 comments · Fixed by #298 or #315
Closed

Failed to get unit file state for ghost_<url>.service #293

aileen opened this issue Jul 6, 2017 · 4 comments · Fixed by #298 or #315
Labels
Milestone

Comments

@aileen
Copy link
Member

aileen commented Jul 6, 2017

I uninstalled all existing installations and started new again with the following settings:

  • mysqyl user: yes
  • system user: no
  • nginx: yes
  • ssl: no

Trying to start Ghost within the setup process prompted first in the warning to run ghost setup systemd. After doing so, trying to start Ghost again results in this error:

root@dev-aileen-01:~/cli1# ghost setup systemd
? Ghost-CLI would like to generate a systemd service file file. Yes, write config file
Running sudo command: ln -sf /root/cli1/system/files/ghost_128-199-61-218.service /lib/systemd/system/ghost_128-199-61-218.service
✔ Setting up systemd
root@dev-aileen-01:~/cli1# ghost start
✔ Validating config
Running sudo command: systemctl start ghost_128-199-61-218
Warning: ghost_128-199-61-218.service changed on disk. Run 'systemctl daemon-reload' to reload units.
✔ Starting Ghost
An error occurred.
Message: 'Failed to get unit file state for ghost_128-199-61-218.service: No such file or directory
'


Debug Information:
    Node Version: v6.11.0
    Ghost-CLI Version: 1.0.0-beta.5
    Environment: production
    Command: 'ghost start'

Additional log info available in: /root/.ghost/logs/ghost-cli-debug-2017-07-06T08_44_21_865Z.log
@aileen aileen added the bug label Jul 6, 2017
@aileen aileen added this to the 1.0.0-rc.1 milestone Jul 6, 2017
@kirrg001
Copy link
Contributor

kirrg001 commented Jul 6, 2017

What i did to get rid of the error:

rm /etc/systemd/system/ghost_localhost.service [not sure this step was needed]
sudo systemctl daemon-reload
ghost start

@aileen
Copy link
Member Author

aileen commented Jul 6, 2017

It worked for me without the first command

acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 6, 2017
closes TryGhost#293
- reload systemd daemon on template generation to persist any file changes
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 6, 2017
closes TryGhost#293
- reload systemd daemon on template generation to persist any file changes
acburdine added a commit that referenced this issue Jul 6, 2017
closes #293
- reload systemd daemon on template generation to persist any file changes
@kirrg001
Copy link
Contributor

kirrg001 commented Jul 6, 2017

I am running into this again:

'Failed to get unit file state for ghost_kate-ghost-test-acburdine-me.service: No such file or directory

sudo systemctl daemon-reload doesn't help this time.

systemctrl status ... looks great.

   Loaded: loaded (/var/www/ghost/system/files/ghost_kate-ghost-test-acburdine-me.service; bad; vendor preset: enabled)
   Active: active (running) since Thu 2017-07-06 20:51:19 UTC; 1s ago
     Docs: https://docs.ghost.org
 Main PID: 20218 (ghost)
    Tasks: 17
   Memory: 45.5M
      CPU: 1.541s
   CGroup: /system.slice/ghost_kate-ghost-test-acburdine-me.service
           ├─20218 ghost
           ├─20229 /bin/sh -c npm root -g
           └─20230 npm

Jul 06 20:51:19 dev-kate-01 systemd[1]: Started Ghost systemd service for blog: kate-ghost-test-acburdine-me.

The error is thrown directly from the CLI and that's why Ghost doesn't really start.

Stack: Error: Failed to get unit file state for ghost_kate-ghost-test-acburdine-me.service: No such file or directory

    at module.exports.sync (/usr/local/nvm/versions/node/v6.10.3/lib/node_modules/ghost-cli/node_modules/execa/index.js:298:26)
    at handleShell (/usr/local/nvm/versions/node/v6.10.3/lib/node_modules/ghost-cli/node_modules/execa/index.js:100:9)
    at Function.module.exports.shellSync (/usr/local/nvm/versions/node/v6.10.3/lib/node_modules/ghost-cli/node_modules/execa/index.js:307:43)
    at SystemdProcessManager.isEnabled (/usr/local/nvm/versions/node/v6.10.3/lib/node_modules/ghost-cli/extensions/systemd/systemd.js:36:19)

From here: https://github.com/TryGhost/Ghost-CLI/blob/master/extensions/systemd/systemd.js#L36

But the file exists:

root@dev-kate-01:/var/www/ghost# ll /lib/systemd/system/ghost_kate-ghost-test-acburdine-me.service
lrwxrwxrwx 1 root root 70 Jul  6 20:37 /lib/systemd/system/ghost_kate-ghost-test-acburdine-me.service -> /var/www/ghost/system/files/ghost_kate-ghost-test-acburdine-me.service
root@dev-kate-01:/var/www/ghost# ll /var/www/ghost/system/files/ghost_kate-ghost-test-acburdine-me.service
-rw-r--r-- 1 root root 375 Jul  6 20:37 /var/www/ghost/system/files/ghost_kate-ghost-test-acburdine-me.service

SEE
https://serverfault.com/questions/728543/unable-to-query-services-with-systemctl-is-enabled

I've changed https://github.com/TryGhost/Ghost-CLI/blob/master/extensions/systemd/systemd.js#L36 to only check if the file exists, then it worked. But this obviously not a replacement for the is-enabled feature?

@kirrg001 kirrg001 reopened this Jul 6, 2017
@acburdine
Copy link
Member

I figured out what this was. Will submit a fix soon.

acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jul 7, 2017
closes TryGhost#293
- expands error message regex to also check for failed unit file state
acburdine added a commit that referenced this issue Jul 10, 2017
closes #293
- expands error message regex to also check for failed unit file state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants