Ghost setup linux-user systemd

Hi, I am trying to familiarize myself with the backup and restore process of Ghost. While I successfully back everything up to remote storage, I encounter the following error when attempting to restore:

A SystemError occurred.

Message: Systemd process manager has not been set up or is corrupted.
Help: Run ghost setup linux-user systemd and try again.

I would like to note that I first restored the MySQL database. After that, I copied all the installation files (content, versions, current, config.production.json) to /var/www/demo with the correct user permissions and folder ownership. Despite this, the error persists. Any idea why this happened?

I’ll chip in since I replied to your originating post :slight_smile: .

Did you install Ghost using ghost-cli before you restored the database from the backup?

Here are the official docs that restores the backup generated from “ghost-cli backup” command.

I restored the database by importing the .sql file into MySQL. After that, I generated a new Ghost installation using ghost-cli. I then removed the content directory and config.production.json file, replacing them with the backed-up versions. However, I encountered the above error afterward.

If you haven’t already run the command recommended in the error message, that’s your first step. :)

I have run it more than 10 times and I get the same thing…

Delete the file ghost_xxx.service from the /lib/systemd/system/ directory, so that ghost can rebuild it again.

Run ls -la /lib/systemd/system/ghost* to search for the service file.
Assume /lib/systemd/system/ghost_localhost.service is your systemd file.
Move the file to a backup directory or rename it e.g. ghost_localhost.service_ or delete it: sudo rm /lib/systemd/system/ghost_localhost.service

Then runsudo systemctl daemon-reload.

Afterwards the ghost-cli should be able to build the service-file again: ghost setup linux-user systemd

The service file looks like:

[Unit]
Description=Ghost systemd service for blog: localhost
Documentation=https://ghost.org/docs/

[Service]
Type=simple
WorkingDirectory=/var/www/ghost
User=1000
Environment="NODE_ENV=production"
ExecStart=/usr/local/bin/node /usr/local/bin/ghost run
Restart=always

[Install]
WantedBy=multi-user.target
2 Likes