Unable to start or upgrade ghost after CLI upgrade

Keywords: Ghost - AWS - Technical issue - Upgrade

bndiagnostic ID: bc71a0ea-cec7-d33f-d53a-d1d4adbca417

bndiagnostic output:

? Apache: Found possible issues
? Resources: Found possible issues
? Processes: Found possible issues
https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-errors-apache/
https://docs.bitnami.com/installer/faq/linux-faq/administration/increase-memory-linux/

bndiagnostic failure reason: The documentation did not make any significant change

Description:
This issue emerged after I had tried to create a new cert with Letsencrypt using the command line tool. At first I could not get ghost to start up. Then I upgraded the CLI and got into serious trouble.

After upgrading ghost-cli to 1.19.3, all the ghost commands stopped working:

bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su ghost ghost update
sh: 0: Can’t open ghost

bitnami@ip-xxx:/opt/bitnami/ghost$ ghost doctor
-bash: ghost: command not found

bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su ghost -c “ghost doctor”
sh: 1: ghost: not found

And the update does not work either:

bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su ghost -c “ghost update”
sh: 1: ghost: not found

I have no idea what to do next. I already upgraded from a t2.micro to t2.small AWS instance to see if memory was an issue, as suggested somewhere, but this did not make a difference.

What did you do to update the CLI? Did you follow our guide?

https://docs.bitnami.com/aws/apps/ghost/administration/update-cli/

Those are the instructions I followed. It suggests to run “npm audit fix”, which I’m pretty certain I did on an attempt, and suspect may have broken something.
When I now run “sudo npm install ghost-cli”, it ends fine with

+ ghost-cli@1.19.3
removed 12 packages, updated 1 package and audited 1972 packages in 20.021s

128 packages are looking for funding
  run `npm fund` for details

found 30 vulnerabilities (14 moderate, 13 high, 3 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
  • but when I move on to the instructions to upgrade ghost, I immediately get:
bitnami@ip-xxx:/opt/bitnami/ghost/current$ cd ..
bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su bitnami ghost update
bash: ghost: No such file or directory

The situation seems similar to the one in this post, Can't run Ghost doctor or Ghost-cli - #8 by gongomgra
If I follow the suggestions, the process fails at the “npm install” command due to a permissions(?) issue:

bitnami@ip-xxx:/opt/bitnami/ghost/current$ sudo su ghost -c "npm install -g npm"
...
npm WARN checkPermissions Missing write access to /opt/bitnami/node/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /opt/bitnami/node/lib/node_modules/npm/node_modules/abbrev
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/opt/bitnami/node/lib/node_modules/npm/node_modules/abbrev'
npm ERR!  [Error: EACCES: permission denied, access '/opt/bitnami/node/lib/node_modules/npm/node_modules/abbrev'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/opt/bitnami/node/lib/node_modules/npm/node_modules/abbrev'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ghost/.npm/_logs/2022-05-04xxx-debug.log

Hi @sergex ,

I updated the ghost-cli version and could run the tool without problems

bitnami@bitnami-ghost-dbec:/opt/bitnami/ghost/current$ sudo su ghost -s /bin/bash -c "npm install ghost-cli"
npm WARN deprecated brute-knex@4.0.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

> sqlite3@5.0.6 install /opt/bitnami/ghost/versions/4.47.0/node_modules/knex-migrator/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

[sqlite3] Success: "/opt/bitnami/ghost/versions/4.47.0/node_modules/knex-migrator/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node" is installed via remote

> sharp@0.30.3 install /opt/bitnami/ghost/versions/4.47.0/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.12.2/libvips-8.12.2-linux-x64.tar.br
sharp: Integrity check passed for linux-x64
npm WARN @tryghost/express-dynamic-redirects@0.2.11 requires a peer of express@^4.17.1 but none is installed. You must install peer dependencies yourself.
npm WARN bookshelf@1.2.0 requires a peer of knex@>=0.15.0 <0.22.0 but none is installed. You must install peer dependencies yourself.
npm WARN express-lazy-router@1.0.4 requires a peer of express@^4.0.0 but none is installed. You must install peer dependencies yourself.

+ ghost-cli@1.19.3
added 39 packages from 199 contributors, removed 14 packages, updated 85 packages and audited 1970 packages in 63.297s

122 packages are looking for funding
  run `npm fund` for details

found 30 vulnerabilities (14 moderate, 13 high, 3 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
bitnami@bitnami-ghost-dbec:/opt/bitnami/ghost/current$ ghost version

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

Ghost-CLI version: 1.19.3
bitnami@bitnami-ghost-dbec:/opt/bitnami/ghost/current$ sudo su ghost -s /bin/bash -c "ghost version"
┌──────────────────────────────────────────────────────────────────────────────────┐
│Warning: MySQL 8 will be the required database in the next major release of Ghost.│
│     Make sure your database is up to date to ensure forwards compatibility.      │
└──────────────────────────────────────────────────────────────────────────────────┘

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

Ghost-CLI version: 1.19.3

Here’s what I get:

bitnami@ip-xxx:/opt/bitnami/ghost/current$ sudo su ghost -s /bin/bash -c "npm install ghost-cli"
npm WARN @tryghost/express-dynamic-redirects@0.2.9 requires a peer of express@^4.17.1 but none is installed. You must install peer dependencies yourself.
npm WARN bookshelf@1.2.0 requires a peer of knex@>=0.15.0 <0.22.0 but none is installed. You must install peer dependencies yourself.
npm WARN express-brute@1.0.1 requires a peer of express@4.x but none is installed. You must install peer dependencies yourself.
npm WARN express-lazy-router@1.0.4 requires a peer of express@^4.0.0 but none is installed. You must install peer dependencies yourself.

+ ghost-cli@1.19.3
removed 12 packages, updated 1 package and audited 1972 packages in 20.829s

128 packages are looking for funding
  run `npm fund` for details

found 30 vulnerabilities (14 moderate, 13 high, 3 critical)
  run `npm audit fix` to fix them, or `npm audit` for details


   ╭───────────────────────────────────────────────────────────────╮
   │                                                               │
   │      New major version of npm available! 6.14.15 → 8.9.0      │
   │   Changelog: https://github.com/npm/cli/releases/tag/v8.9.0   │
   │               Run npm install -g npm to update!               │
   │                                                               │
   ╰───────────────────────────────────────────────────────────────╯

bitnami@ip-xxx:/opt/bitnami/ghost/current$ ghost version
-bash: ghost: command not found
bitnami@ip-xxx:/opt/bitnami/ghost/current$ sudo su ghost -s /bin/bash -c "ghost version"
bash: ghost: command not found

Hi @sergex ,

I do not know what you did but it seems the PATH env var is broken or the ghost tool is not included in the correct folder. What’s the output of these commands?

echo $PATH
ls /opt/bitnami/ghost/current/bin

I suggest you compare this information with a fresh instance and check what’s wrong with the installation.

Thank you for looking into this!
Output:

bitnami@ip-xxx:~$ echo $PATH
/opt/bitnami/apache/bin:/opt/bitnami/apache2/bin:/opt/bitnami/common/bin:/opt/bitnami/ghost/bin:/opt/bitnami/gonit/bin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:/opt/bitnami/node/bin:/opt/bitnami/python/bin:/opt/bitnami/nami/bin:/opt/bitnami/apache/bin:/opt/bitnami/apache2/bin:/opt/bitnami/common/bin:/opt/bitnami/ghost/bin:/opt/bitnami/gonit/bin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:/opt/bitnami/node/bin:/opt/bitnami/python/bin:/opt/bitnami/nami/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
bitnami@ip-xxx:~$ ls /opt/bitnami/ghost/current/bin
ls: cannot access '/opt/bitnami/ghost/current/bin': No such file or directory

For a fresh new Lightsail (Ghost 4.44) instance I get precisely the same:

bitnami@ip-yyy:~$ echo $PATH
/opt/bitnami/apache/bin:/opt/bitnami/apache2/bin:/opt/bitnami/common/bin:/opt/bitnami/ghost/bin:/opt/bitnami/gonit/bin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:/opt/bitnami/node/bin:/opt/bitnami/python/bin:/opt/bitnami/nami/bin:/opt/bitnami/apache/bin:/opt/bitnami/apache2/bin:/opt/bitnami/common/bin:/opt/bitnami/ghost/bin:/opt/bitnami/gonit/bin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:/opt/bitnami/node/bin:/opt/bitnami/python/bin:/opt/bitnami/nami/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
bitnami@ip-yyy:~$ ls /opt/bitnami/ghost/current/bin
ls: cannot access '/opt/bitnami/ghost/current/bin': No such file or directory

Hi @sergex ,

Sorry, there was a typo in my previous message. The commands to run are these ones

echo $PATH
which ghost
ls /opt/bitnami/ghost/bin

The ghost tool should be inside that directory.

Getting somewhere perhaps? It seems to be pointing to a Ghost version that does not exist.

bitnami@ip-xxx:~$ echo $PATH
/opt/bitnami/apache/bin:/opt/bitnami/apache2/bin:/opt/bitnami/common/bin:/opt/bitnami/ghost/bin:/opt/bitnami/gonit/bin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:/opt/bitnami/node/bin:/opt/bitnami/python/bin:/opt/bitnami/nami/bin:/opt/bitnami/apache/bin:/opt/bitnami/apache2/bin:/opt/bitnami/common/bin:/opt/bitnami/ghost/bin:/opt/bitnami/gonit/bin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:/opt/bitnami/node/bin:/opt/bitnami/python/bin:/opt/bitnami/nami/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
bitnami@ip-xxx:~$ which ghost
bitnami@ip-xxx:~$ ls /opt/bitnami/ghost/bin
/opt/bitnami/ghost/bin
bitnami@ip-xxx:~$ ls -la /opt/bitnami/ghost/bin
lrwxrwxrwx 1 ghost bitnami 52 Nov 15 15:31 /opt/bitnami/ghost/bin -> /opt/bitnami/ghost/versions/4.22.3/node_modules/.bin
bitnami@ip-xxx:~$ ls /opt/bitnami/ghost/versions/4.22.3/node_modules/.bin
ls: cannot access '/opt/bitnami/ghost/versions/4.22.3/node_modules/.bin': No such file or directory
bitnami@ip-xxx:~$ ls /opt/bitnami/ghost/versions/4.22.3/node_modules/
ls: cannot access '/opt/bitnami/ghost/versions/4.22.3/node_modules/': No such file or directory
bitnami@ip-xxx:~$ ls /opt/bitnami/ghost/versions/
4.27.1  4.46.1

The bin folder seems to be pointing to an incorrect folder after the upgrade. Can you regenerate that symlink?

sudo ln -sf /opt/bitnami/ghost/versions/4.46.1/node_modules/.bin /opt/bitnami/ghost/bin

You can also review the rest of symlinks and update them if required

Thanks. Here is the result - ghost version works but something is still missing as ghost update still will not budge. Where would I look for other symlinks to update?

bitnami@ip-xxx:/opt/bitnami/ghost/current$ ls -la /opt/bitnami/ghost/bin
lrwxrwxrwx 1 root root 52 May 11 09:47 /opt/bitnami/ghost/bin -> /opt/bitnami/ghost/versions/4.46.1/node_modules/.bin
bitnami@ip-xxx:/opt/bitnami/ghost/current$ ghost version

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

Ghost-CLI version: 1.19.3
bitnami@ip-xxx:/opt/bitnami/ghost/current$ sudo su ghost -s /bin/bash -c "ghost version"
┌──────────────────────────────────────────────────────────────────────────────────┐
│Warning: MySQL 8 will be the required database in the next major release of Ghost.│
│     Make sure your database is up to date to ensure forwards compatibility.      │
└──────────────────────────────────────────────────────────────────────────────────┘

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

Ghost-CLI version: 1.19.3
bitnami@ip-xxx:/opt/bitnami/ghost/current$ cd /opt/bitnami/ghost
bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su ghost ghost update
sh: 0: Can't open ghost
bitnami@ip-xxx:/opt/bitnami/ghost$ ghost status

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

No installed ghost instances found

In the same directory things look fine as far as I can tell -

bitnami@ip-xxx:/opt/bitnami/ghost$ ls -la
total 24
drwxr-xr-x  4 ghost bitnami 4096 May 11 09:47 .
drwxr-xr-x 17 root  root    4096 May  2 19:13 ..
lrwxrwxrwx  1 root  root      52 May 11 09:47 bin -> /opt/bitnami/ghost/versions/4.46.1/node_modules/.bin
lrwxrwxrwx  1 ghost bitnami   37 Dec  8 23:12 config.production.json -> /bitnami/ghost/config.production.json
lrwxrwxrwx  1 ghost bitnami   22 Dec  8 23:12 content -> /bitnami/ghost/content
lrwxrwxrwx  1 ghost ghost     34 May  2 15:48 current -> /opt/bitnami/ghost/versions/4.46.1
-rw-r--r--  1 ghost bitnami  167 May  2 15:48 .ghost-cli
-rw-r--r--  1 root  root       0 May  9 09:26 .ghostpid
drwxr-xr-x  2 ghost bitnami 4096 Nov 15 15:54 licenses
-rw-r--r--  1 ghost ghost     27 May  2 16:49 package-lock.json
drwxr-xr-x  4 ghost bitnami 4096 May  2 15:48 versions

Update. If I give the update command as sudo su ghost -c "ghost update" instead of sudo su ghost ghost update as in the official instructions, it finds and updates Ghost, but does not update the symlink, despite claiming so (.46 vs .47):

bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su ghost -c "ghost update"
┌──────────────────────────────────────────────────────────────────────────────────┐
│Warning: MySQL 8 will be the required database in the next major release of Ghost.│
│     Make sure your database is up to date to ensure forwards compatibility.      │
└──────────────────────────────────────────────────────────────────────────────────┘

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

✔ Checking system Node.js version - found v14.18.1
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
✔ Checking for available migrations
✔ Checking for latest Ghost version

# 4.47.1

* 🐛 Fixed wrong newsletter used when sending scheduled post (#14732) - Simon Backx
* 🐛 Fixed members CSV export not filtering on subscribed (#14724) - Simon Backx
* 🐛 Fixed importing posts with a newsletter assigned - Matt Hanley

---

View the changelogs for full details:
* Ghost - https://github.com/tryghost/ghost/compare/v4.47.0...v4.47.1
* Admin - https://github.com/tryghost/admin/compare/v4.47.0...v4.47.1

🪄 Love open source? We're hiring [Node.js Engineers](https://careers.ghost.org/product-engineer-node-js) to work on Ghost full-time

✔ Fetched release notes
✔ Downloading and updating Ghost to v4.47.1
✔ Linking latest Ghost and recording versions
✔ Removing old Ghost versions
bitnami@ip-xxx:/opt/bitnami/ghost$ ls -la
total 24
drwxr-xr-x  4 ghost bitnami 4096 May 11 14:01 .
drwxr-xr-x 17 root  root    4096 May  2 19:13 ..
lrwxrwxrwx  1 root  root      52 May 11 09:47 bin -> /opt/bitnami/ghost/versions/4.46.1/node_modules/.bin
lrwxrwxrwx  1 ghost bitnami   37 Dec  8 23:12 config.production.json -> /bitnami/ghost/config.production.json
lrwxrwxrwx  1 ghost bitnami   22 Dec  8 23:12 content -> /bitnami/ghost/content
lrwxrwxrwx  1 ghost ghost     34 May 11 14:01 current -> /opt/bitnami/ghost/versions/4.47.1
-rw-r--r--  1 ghost bitnami  167 May 11 14:01 .ghost-cli
drwxr-xr-x  2 ghost bitnami 4096 Nov 15 15:54 licenses
-rw-r--r--  1 ghost ghost     27 May  2 16:49 package-lock.json
drwxr-xr-x  4 ghost bitnami 4096 May 11 14:01 versions

Ghost status now works if I use the hyphenated command format. The ctl script does not (apparently) work before gonit is poked to activate the daemon:

bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su ghost -c "ghost status"
┌──────────────────────────────────────────────────────────────────────────────────┐
│Warning: MySQL 8 will be the required database in the next major release of Ghost.│
│     Make sure your database is up to date to ensure forwards compatibility.      │
└──────────────────────────────────────────────────────────────────────────────────┘

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js

┌───────────┬────────────────────┬─────────┬─────────┬─────┬──────┬─────────────────┐
│ Name      │ Location           │ Version │ Status  │ URL │ Port │ Process Manager │
├───────────┼────────────────────┼─────────┼─────────┼─────┼──────┼─────────────────┤
│ localhost │ /opt/bitnami/ghost │ 4.47.1  │ stopped │ n/a │ n/a  │ n/a             │
└───────────┴────────────────────┴─────────┴─────────┴─────┴──────┴─────────────────┘
bitnami@ip-xxx:/opt/bitnami/ghost$ sudo /opt/bitnami/ctlscript.sh status
Cannot find any running daemon to contact. If it is running, make sure you are pointing to the right pid file (/var/run/gonit.pid)
bitnami@ip-xxx:/opt/bitnami/ghost$ sudo gonit status
Cannot find any running daemon to contact. If it is running, make sure you are pointing to the right pid file (/var/run/gonit.pid)
bitnami@ip-xxx:/opt/bitnami/ghost$ sudo gonit
Starting gonit daemon

However, the scripts still fail even with the demon:

bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su ghost -c "ghost status"
...
┌───────────┬────────────────────┬─────────┬─────────┬─────┬──────┬─────────────────┐
│ Name      │ Location           │ Version │ Status  │ URL │ Port │ Process Manager │
├───────────┼────────────────────┼─────────┼─────────┼─────┼──────┼─────────────────┤
│ localhost │ /opt/bitnami/ghost │ 4.47.1  │ stopped │ n/a │ n/a  │ n/a             │
└───────────┴────────────────────┴─────────┴─────────┴─────┴──────┴─────────────────┘
bitnami@ip-xxx:/opt/bitnami/ghost$ sudo /opt/bitnami/ctlscript.sh status
apache not running
ghost not running
mariadb not running
bitnami@ip-xxx:/opt/bitnami/ghost$ sudo /opt/bitnami/ctlscript.sh start
Starting services..
Job for bitnami.service failed because the control process exited with error code.
See "systemctl status bitnami.service" and "journalctl -xe" for details.

Systemctl log:

bitnami@ip-xxx:/opt/bitnami/ghost$ systemctl status bitnami.service
● bitnami.service - LSB: bitnami init script
   Loaded: loaded (/etc/init.d/bitnami; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2022-05-11 14:07:49 UTC; 11min ago
  Process: 1758 ExecStart=/etc/init.d/bitnami start (code=exited, status=1/FAILURE)
    Tasks: 551 (limit: 2373)
   Memory: 285.9M
   CGroup: /system.slice/bitnami.service
           ├─ 633 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
           ├─ 636 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
           ├─ 637 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
           ├─ 638 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
           ├─1040 /opt/bitnami/mariadb/sbin/mysqld --defaults-file=/opt/bitnami/mariadb/conf/my.cnf --basedir=/opt/bitnami/mariadb --datadir=/bitnami/mariadb/data --socket=/opt/bitnami/mariadb/tmp/mysql.sock --pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
           └─2101 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf

May 11 14:07:49 ip-xxx bitnami[1758]: ghost 14:07:49.65 ERROR ==> ghost did not start
May 11 14:07:49 ip-xxx bitnami[1758]: 2022-05-11T14:07:49.660Z - error: Unable to perform start operation Export start for ghost failed with exit code 1
May 11 14:07:49 ip-xxx bitnami[1758]: ## 2022-05-11 14:07:49+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/010_bitnami_agent_extra...
May 11 14:07:49 ip-xxx bitnami[1758]: ## 2022-05-11 14:07:49+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/020_bitnami_agent...
May 11 14:07:49 ip-xxx bitnami[1758]: ## 2022-05-11 14:07:49+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/030_update_welcome_file...
May 11 14:07:49 ip-xxx bitnami[1758]: ## 2022-05-11 14:07:49+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/040_bitnami_credentials_file...
May 11 14:07:49 ip-xxx bitnami[1758]: ## 2022-05-11 14:07:49+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/050_clean_metadata...
May 11 14:07:49 ip-xxx systemd[1]: bitnami.service: Control process exited, code=exited, status=1/FAILURE
May 11 14:07:49 ip-xxx systemd[1]: bitnami.service: Failed with result 'exit-code'.
May 11 14:07:49 ip-xxx systemd[1]: Failed to start LSB: bitnami init script.

Hi @sergex ,

you can get more information about the error when starting the service in the Ghost’s log files inside the /opt/bitnami/ghost/current directory.

Regarding the symlink to the bin folder, you can also update it to use current instead of the version

sudo ln -sf /opt/bitnami/ghost/current/node_modules/.bin /opt/bitnami/ghost/bin

I ran the script in current, but can’t make much out of the info (below).

Curiously, the linking does not seem to work to current and I now see that compared to a fresh instance, /opt/bitnami/ghost/current/node_modules/.bin is missing the ghost -> ../ghost-cli/bin/ghost link. Should I try to add this manually, and if so, how ought I do that?

bitnami@ip-172-31-35-228:/opt/bitnami/ghost/current$ sudo /opt/bitnami/ctlscript.sh start
Starting services..
Job for bitnami.service failed because the control process exited with error code.
See "systemctl status bitnami.service" and "journalctl -xe" for details.
bitnami@ip-172-31-35-228:/opt/bitnami/ghost/current$ systemctl status bitnami.service
● bitnami.service - LSB: bitnami init script
   Loaded: loaded (/etc/init.d/bitnami; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2022-05-12 22:09:41 UTC; 9s ago
  Process: 9484 ExecStart=/etc/init.d/bitnami start (code=exited, status=1/FAILURE)
    Tasks: 555 (limit: 2373)
   Memory: 294.0M
   CGroup: /system.slice/bitnami.service
           ├─ 633 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
           ├─1040 /opt/bitnami/mariadb/sbin/mysqld --defaults-file=/opt/bitnami/mariadb/conf/my.cnf --basedir=/opt/bitnami/mariadb --datadir=/bitnami/mariadb/data --socket=/opt/bitnami/mariadb/tmp/mysql.sock --pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
           ├─4553 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
           ├─4554 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
           ├─4555 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
           └─5005 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf

May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ghost 22:09:41.54 ERROR ==> ghost did not start
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: 2022-05-12T22:09:41.549Z - error: Unable to perform start operation Export start for ghost failed with exit code 1
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/010_bitnami_agent_extra...
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/020_bitnami_agent...
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/030_update_welcome_file...
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/040_bitnami_credentials_file...
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/050_clean_metadata...
May 12 22:09:41 ip-172-31-35-228 systemd[1]: bitnami.service: Control process exited, code=exited, status=1/FAILURE
May 12 22:09:41 ip-172-31-35-228 systemd[1]: bitnami.service: Failed with result 'exit-code'.
May 12 22:09:41 ip-172-31-35-228 systemd[1]: Failed to start LSB: bitnami init script.
bitnami@ip-172-31-35-228:/opt/bitnami/ghost/current$ journalctl -xe
May 12 22:08:33 ip-172-31-35-228 sudo[9464]: pam_unix(sudo:session): session closed for user root
May 12 22:08:39 ip-172-31-35-228 sudo[9475]:  bitnami : TTY=pts/0 ; PWD=/opt/bitnami/ghost/versions/4.47.1 ; USER=root ; COMMAND=/opt/bitnami/ctlscript.sh start
May 12 22:08:39 ip-172-31-35-228 sudo[9475]: pam_unix(sudo:session): session opened for user root by bitnami(uid=0)
May 12 22:08:39 ip-172-31-35-228 systemd[1]: bitnami.service: Found left-over process 633 (httpd) in control group while starting unit. Ignoring.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: bitnami.service: Found left-over process 1040 (mysqld) in control group while starting unit. Ignoring.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: bitnami.service: Found left-over process 4553 (httpd) in control group while starting unit. Ignoring.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: bitnami.service: Found left-over process 4554 (httpd) in control group while starting unit. Ignoring.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: bitnami.service: Found left-over process 4555 (httpd) in control group while starting unit. Ignoring.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: bitnami.service: Found left-over process 5005 (httpd) in control group while starting unit. Ignoring.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
May 12 22:08:39 ip-172-31-35-228 systemd[1]: Starting LSB: bitnami init script...
-- Subject: A start job for unit bitnami.service has begun execution
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit bitnami.service has begun execution.
--
-- The job identifier is 713.
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:08:39+00:00 ## INFO ## Running /opt/bitnami/var/init/pre-start/010_resize_fs...
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: resize2fs 1.44.5 (15-Dec-2018)
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: resize2fs: Device or resource busy while trying to open /dev/xvda
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: Couldn't find valid filesystem superblock.
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:08:39+00:00 ## INFO ## Running /opt/bitnami/var/init/pre-start/020_hostname...
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:08:39+00:00 ## INFO ## Running /opt/bitnami/var/init/pre-start/030_swap_file...
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:08:39+00:00 ## INFO ## Running /opt/bitnami/var/init/pre-start/040_check_if_demo_machine...
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:08:39+00:00 ## INFO ## Running /opt/bitnami/var/init/pre-start/050_change_boot_log_permissions...
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:08:39+00:00 ## INFO ## Running /opt/bitnami/var/init/pre-start/060_get_default_passwords...
May 12 22:08:39 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:08:39+00:00 ## INFO ## Starting services...
May 12 22:08:40 ip-172-31-35-228 bitnami[9484]: 2022-05-12T22:08:40.534Z - info: Saving configuration info to disk
May 12 22:08:40 ip-172-31-35-228 bitnami[9484]: 2022-05-12T22:08:40.813Z - info: Performing service start operation for apache
May 12 22:08:41 ip-172-31-35-228 bitnami[9484]: apache 22:08:41.02 INFO  ==> apache is already running
May 12 22:08:41 ip-172-31-35-228 bitnami[9484]: 2022-05-12T22:08:41.035Z - info: Performing service start operation for mariadb
May 12 22:08:41 ip-172-31-35-228 bitnami[9484]: mariadb 22:08:41.25 INFO  ==> mariadb is already running
May 12 22:08:41 ip-172-31-35-228 bitnami[9484]: 2022-05-12T22:08:41.252Z - info: Performing service start operation for ghost
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ghost 22:09:41.54 ERROR ==> ghost did not start
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: 2022-05-12T22:09:41.549Z - error: Unable to perform start operation Export start for ghost failed with exit code 1
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/010_bitnami_agent_extra...
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/020_bitnami_agent...
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/030_update_welcome_file...
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/040_bitnami_credentials_file...
May 12 22:09:41 ip-172-31-35-228 bitnami[9484]: ## 2022-05-12 22:09:41+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/050_clean_metadata...
May 12 22:09:41 ip-172-31-35-228 systemd[1]: bitnami.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStart= process belonging to unit bitnami.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
May 12 22:09:41 ip-172-31-35-228 systemd[1]: bitnami.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit bitnami.service has entered the 'failed' state with result 'exit-code'.
May 12 22:09:41 ip-172-31-35-228 systemd[1]: Failed to start LSB: bitnami init script.
-- Subject: A start job for unit bitnami.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit bitnami.service has finished with a failure.
--
-- The job identifier is 713 and the job result is failed.
May 12 22:09:41 ip-172-31-35-228 sudo[9475]: pam_unix(sudo:session): session closed for user root
lines 974-1042/1042 (END)

Since I couldn’t resolve this, I begun configuring my new Lightsail instance to replace the problematic one. Interestingly, the same issue with not being able to start Ghost cropped up! The blog was running fine and I was porting in old content successfully. Then, after running sudo /opt/bitnami/bncert-tool Ghost would refuse to start up with exactly the same error messages in systemctl as above.
I now suspect that either the Letsencrypt tool or something with the particulars of my domain (having the format new.xxx.com and no www. prefix configured) might be messing things up. Reverting bitnami.conf/bitnami-ssl.conf/host-https-vhost.conf/ghost-vhost.conf files back to pre-bncert-tool versions did not resolve the issue.

Some more output from the Lightsail instance here.

bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su ghost ghost doctor
sh: 0: Can't open ghost
bitnami@ip-xxx:/opt/bitnami/ghost$ sudo su ghost -s /bin/bash -c "npm install ghost-cli"

> yarn@1.22.15 preinstall /opt/bitnami/ghost/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

npm WARN saveError ENOENT: no such file or directory, open '/opt/bitnami/ghost/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/opt/bitnami/ghost/package.json'
npm WARN ghost No description
npm WARN ghost No repository field.
npm WARN ghost No README data
npm WARN ghost No license field.

+ ghost-cli@1.19.3
added 425 packages from 212 contributors and audited 425 packages in 24.157s

32 packages are looking for funding
  run `npm fund` for details

found 2 vulnerabilities (1 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details

Hi @sergex,

Does the same thing happen with a fresh Ghost instance, so without any configuration changes or migrating any data?

Regards,
Michiel