Ghost: Fix the "Systemd process manager has not been set up or is corrupted" error - Guide #1

Discover how to fix the "Systemd process manager has not been set up or is corrupted" error with Ghost

🔀
Looking for the guide "RStudio: Clear the environment"? It has moved here.
🖥️
Ghost version: 5.9.1

I tried earlier today to update a couple of Ghost instances I run on a DigitalOcean droplet. I routinely update these instances, and I've never had any major issue — until today. On one of these instances, I got the following error when ghost update tried to restart Ghost:

Systemd process manager has not been set up or is corrupted

The CLI suggested running ghost setup linux-user systemd as a possible fix, but it didn't work. When trying to run the suggested command, I got the following message:

Systemd service has already been set up. Skipping Systemd setup

Running ghost doctor wasn't helpful either.

Browsing the official Ghost forum wasn't super helpful, as most of the topics where somebody reported such an issue end by the person either giving no update (so we don't know if they managed to fix it or not) and/or saying they fixed it by reinstalling Ghost. Reinstalling Ghost was not an option for me, so I kept looking.

I rebooted the droplet and Ghost restarted — but it gave me a “Bad gateway” error. Which was odd considering that running ghost ls gave no warnings. The instance was indeed running — but bizarrely.

I suspected the issue had something to do with permissions. Yesterday, I manually manipulated Ghost files — I was trying to fix was I thought was a bug, but it was just redirections.yaml behaving “normally”. I ran ls -lha within Ghost folder and compared it to what I got on the folder of another Ghost instance. Tada, I found some differences.

On the screenshot below, (2) and (3) were owned by ghuser instead of ghost and root respectively.

I ran sudo chown -R ghost:ghost content and sudo chown -R root:root system to change the ownership of these two folders to match what I had in the other, working instance. I then tried a ghost restart and this time, it worked: Ghost was able to restart.

Here's the text output of the permissions you're supposed to have:

ghuser@server:/var/www/www.example.com$ ls -lha
total 6.1M
drwxrwxr-x  6 ghuser ghuser 4.0K Aug 16 12:16 .
drwxr-xr-x 30 root   root   4.0K Aug 15 10:04 ..
-rw-rw-r--  1 ghuser ghuser  193 Aug 16 12:16 .ghost-cli
drwxrwxr-x  2 ghuser ghuser 4.0K May 24 11:26 backup
-rw-rw-r--  1 ghuser ghuser 6.1M May 24 11:26 backup-from-v4.48.0-on-2022-05-24-09-25-53.zip
-rw-rw-r--  1 ghuser ghuser  776 Aug 16 12:16 config.production.json
drwxrwxr-x 11 ghost  ghost  4.0K Mar 17 17:45 content
lrwxrwxrwx  1 ghuser ghuser   34 Aug 16 12:16 current -> /var/www/www.example.com/versions/5.9.4
drwxr-xr-x  3 root   root   4.0K Mar 17 17:46 system
drwxrwxr-x  4 ghuser ghuser 4.0K Aug 16 12:16 versions

After correcting the ownership of these two folders, I was able to successfully 1) restart the instance 2) update to Ghost 5.9.4. Problem fixed!

I'm not saying the Systemd process manager has not been set up or is corrupted error is always caused by a permission issue, but at the very least you're now aware that this is a possibility.

As I learned today, under no circumstance should you manually manipulate Ghost files and folders. Use the online interface or the CLI but do not make the same mistake I made.

Last but not least, here are two blog posts that gave me some pointers and may be interesting to read if you still can't fix the error (if you can't read the language, me neither; Safari built-in translator tool was good enough to give me a rough understanding of what was written):

Ghost 更新与迁移
Ubuntu 最近 Ghost 以及 Node 版本更新过程小结。
Ghost搭建自己的博客平台
这里只是记录我的搭建过程, 只是给一些刚好有一台服务器的新手看的, 注意搭建环境一样要和我的一样, 否则这个内容没有参考价值!!! Ghost的选择 我开始使用博客有三个阶段 流行博客平台: CSDN, 简书, 掘金, 自建静态网站: 通过 Github的 pages 服务,加上使用jekyll的静态博客. 优点:不需要自己有服务器, 缺点: 没有后台, 只能本地写markdown草稿, Git推送到Github, 不方便. 目前的Ghost: 优点: 博客后台, 可以极大自由的配置自己的博客主题.缺点: 需要有自己的服务器. 我采用的是Bandwagon, 当然也可以用Digital O…