Question

Failed to start ghost.service: Unit ghost.service not found.

Posted October 7, 2016 37.5k views
GhostUbuntu 16.04

Hi,

Ubuntu 16 showed me that there was some update, so I updated it. Now whenever I am trying to start the Ghost service I get “Failed to start ghost.service: Unit ghost.service not found.”

But when I go to Ghost folder and “npm start –production” it, it works.

Any idea how to get the “sudo service ghost start” working?

2 comments
  • Can you clarify a bit. Were you using the Ghost one-click based on Ubuntu 14.04 and upgraded it to ubuntu 16.04? Did you install Ghost manually on a 16.04 droplet and if so, what steps did you follow to do so?

  • I think I resolved it. Something must have happened while updating the package. All I had to do was sudo dpkg –configure -a. Then it was up and running.

    Just to answer your question I used Ubuntu 16.04 Ghost one-click to make the droplet (5 months ago I guess). Then I got a notification - New release ‘16.04.1 LTS’ available - So I did - do-release-upgrade - to upgrade it. Then my laptop got disconnected from Digitalocean, so I reconnected then everything was normal. Then I tried all the stuff what I told you already in the question above.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

I encountered the same problem after upgrading my droplet to Ubuntu 16. I solved it by adding a systemd service configuration for ghost.

I created the following file: /lib/systemd/system/ghost.service

With this content

[Unit]
Description=Ghost: Just a blogging platform
After=network.target

[Service]
Type=simple
WorkingDirectory=/var/www/ghost
User=ghost
Group=ghost
ExecStart=/usr/bin/npm start --production
ExecStop=/usr/bin/npm stop --production
Restart=always
SyslogIdentifier=Ghost

[Install]
WantedBy=multi-user.target

This is based on the following systemd script: https://github.com/TryGhost/Ghost-Config/blob/master/systemd/ghost.service

  • Thanks for this. I had also just upgraded to Ubuntu 16 and can confirm that this works.

  • I added this file as you mentioned. But I cant start service…

    ● ghost.service - Ghost blog system for robertwang.tw
    Loaded: loaded (/etc/systemd/system/ghost.service; enabled; vendor preset: enabled)
    Active: inactive (dead) (Result: exit-code) since Thu 2017-01-12 10:15:07 EST; 2s ago
    Process: 2440 ExecStop=/usr/bin/npm stop –production (code=exited, status=217/USER)
    Process: 2438 ExecStart=/usr/bin/npm start –production (code=exited, status=217/USER)
    Main PID: 2438 (code=exited, status=217/USER)

    Jan 12 10:15:07 Rob-Ghost systemd[1]: ghost.service: Service hold-off time over, scheduling restart.
    Jan 12 10:15:07 Rob-Ghost systemd[1]: Stopped Ghost blog system for robertwang.tw.
    Jan 12 10:15:07 Rob-Ghost systemd[1]: ghost.service: Start request repeated too quickly.
    Jan 12 10:15:07 Rob-Ghost systemd[1]: Failed to start Ghost blog system for robertwang.tw.

    Not sure what that means. Could you give me some hints?

    • The status code (“217/USER”) seems to indicate that the user you specified in the service declaration is not valid on your system.

      Make sure the user you put in front of “User=” exists.

    • The same thing happened to me (Ubuntu Server 18.04) and I fixed it by deleting the existing ghost systemd files and re-running ghost setup. Probably cruft built up from multiple (and failed) updates/upgrades. Shrug.

      (buzz 514) $ ls /lib/systemd/system/*ghost*
      /lib/systemd/system/ghost_blog-example-com.service  /lib/systemd/system/ghost_localhost.service
      
      (buzz 515) $ ls /lib/systemd/system/ghost_blog-example-com.service
      /lib/systemd/system/ghost_blog-example-com.service
      
      (buzz 516) $ sudo rm /lib/systemd/system/*ghost*
      
      (buzz 517) $ ghost setup
      ...
      ? Do you wish to set up Systemd? Yes
      ✔ Creating systemd service file at /mnt/nginx/usr/share/nginx/node/ghost/system/files/ghost_blog-example-com.service
      + sudo ln -sf /mnt/nginx/usr/share/nginx/node/ghost/system/files/ghost_blog-example-com.service /lib/systemd/system/ghost_blog-example-com.service
      + sudo systemctl daemon-reload
      ✔ Setting up Systemd
      ? Do you want to start Ghost? Yes
      ...
      + sudo systemctl is-active ghost_blog-example-com
      ...
      + sudo systemctl start ghost_blog-example-com
      ✔ Starting Ghost
      + sudo systemctl is-enabled ghost_blog-example-com
      
      
Submit an Answer