# Prompts have been disabled when trying to update ghost using cron

**URL:** <https://forum.ghost.org/t/prompts-have-been-disabled-when-trying-to-update-ghost-using-cron/43385>\
**Category:** Developer help\
**Created:** [December 14, 2023, 1:10pm UTC](https://forum.ghost.org/t/prompts-have-been-disabled-when-trying-to-update-ghost-using-cron/43385 "2023-12-14T13:10:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexander](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alexander](https://forum.ghost.org/u/alexander)\
**Post date:** [December 14, 2023, 1:10pm UTC](https://forum.ghost.org/t/prompts-have-been-disabled-when-trying-to-update-ghost-using-cron/43385/1 "2023-12-14T13:10:33Z")

</div>

If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be automatically closed.

If you aren’t running the latest version of Ghost, the first thing we’ll ask you to do is update to the latest version of Ghost.

- **What’s your URL**? This is the easiest way for others to help you  
[blog.talescript.com](http://blog.talescript.com)
- **What version of Ghost are you using?** If it’s not the latest, please update Ghost first before opening your topic

```auto
ghost version

Ghost-CLI version: 1.25.3
Ghost version: 5.75.1 (at /var/www/talescript)

```

And

- How was Ghost installed and configured?  
It was installed using the ghost install guide for ubuntu  
[How to install & setup Ghost on Ubuntu 20.04 or 22.04](https://ghost.org/docs/install/ubuntu/)

- What Node version, database, OS & browser are you using?

```auto
node --version
v18.17.1
cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
mysql --version
mysql Ver 8.0.35-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
Firefox

```

- What errors or information do you see in the console?

```auto
cat ghost_error.log 

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org

- Inspecting operating system
- Checking for deprecations

[13:25:03] Checking for Ghost-CLI updates [started]
[13:25:03] Checking for Ghost-CLI updates [completed]
[13:25:03] Ensuring correct ~/.config folder ownership [started]
[13:25:03] Ensuring correct ~/.config folder ownership [completed]

+ sudo systemctl is-active ghost_blog-talescript-com
/usr/lib/node_modules/ghost-cli/lib/ui/index.js:148
            throw new errors.SystemError('Prompts have been disabled, all options must be provided via command line flags');
            ^

SystemError: Prompts have been disabled, all options must be provided via command line flags
    at UI.prompt (/usr/lib/node_modules/ghost-cli/lib/ui/index.js:148:19)
    at Socket.<anonymous> (/usr/lib/node_modules/ghost-cli/lib/ui/index.js:248:22)
    at Socket.emit (node:events:526:35)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
  options: {
    message: 'Prompts have been disabled, all options must be provided via command line flags'
  },
  logMessageOnly: undefined,
  help: 'You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.',
  err: {}
}

Node.js v18.17.1

```

- What steps could someone else take to reproduce the issue you’re having?

I have a bash script to update ghost.

```auto
#!/usr/bin/bash

DIR=/var/www

sudo -u ghostUser bash << EOF
    cd $DIR/talescript && ghost update && \
    cd $DIR/johnswebsite && ghost update
EOF

```

_as an aside, I’m not too sure if using sudo in the script is a good practice or not_

I’ve added a nopasswd into visudo

```auto
ghostUser ALL=(ghostUser) NOPASSWD: /home/ghostUser/bin/update_ghost.sh

```

The cronjob was created using root `sudo crontab -e`

```auto
25 13 * * * /usr/bin/bash /home/ghostUser/bin/update_ghost.sh >> /home/ghostUser/bin/ghost_error.log 2>&1

```

After an extensive search, this is the closest workable suggestion I have managed to find but I am not entirely sure if it is the correct solution [[Using Ghost-CLI programatically · Issue #721 · TryGhost/Ghost-CLI · GitHub](https://github.com/TryGhost/Ghost-CLI/issues/721#issuecomment-880790638)]([https://Using](https://Using) Ghost-CLI programatically) (honestly I didn’t quite understand the proposed solution)

\*\*EDIT:\*\*So, I changed from using the root crontab to using the users crontab `crontab -e` and managed to get rid of the errors, however, it is not updating to the new version of ghost

```auto
cat ghost_error.log

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org

- Inspecting operating system
- Checking for deprecations

[15:19:05] Checking for Ghost-CLI updates [started]
[15:19:05] Checking for Ghost-CLI updates [completed]
[15:19:05] Ensuring correct ~/.config folder ownership [started]
[15:19:05] Ensuring correct ~/.config folder ownership [completed]

+ sudo systemctl is-active ghost_blog-talescript-com

```

---

<div class="post-metadata">

**Author:** ![markstos](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/markstos/32/18182_2.png) [@markstos](https://forum.ghost.org/u/markstos)\
**Post date:** [December 14, 2023, 2:30pm UTC](https://forum.ghost.org/t/prompts-have-been-disabled-when-trying-to-update-ghost-using-cron/43385/2 "2023-12-14T14:30:44Z")

</div>

I’m not sure exactly what’s going wrong, but it appears related to `sudo`. The system is trying to prompt for password. I’ll suggest a more modern, alternate solution using systemd timers and services.

In this design, we’ll create a systemd service and timer to update each update. Systemd will handle collecting the logs for each in their own “unit”, so you can look at the logs for each build individually.

This design still requires that `sudo` will be used, but this time to run `ghost update`, so first, I’d update your sudoers file:

## sudoers file

```auto
ghostUser ALL=(ghostUser) NOPASSWD: ghost update

```

Then let’s create the first system service file, named `/etc/systemd/system/ghost-update-talescript.service`

## systemd service file

```auto
[Unit]
Description=Update TaleScript Ghost Instance

[Service]
User=ghostUser
WorkingDirectory=/var/www/talescript
ExecStart=ghost update

```

Next, create a timer unit named `/etc/systemd/system/ghost-update-talescript.timer` to start it:

## systemd unit file

```auto
[Unit]
Description=Timer for Ghost TaleScript Update

[Timer]
OnCalendar= *-*-* 13:00:00

[Install]
WantedBy=timers.target

```

## Tell systemd you’ve added some files

```auto
sudo systemctl daemon-reload

```

## Test and view the logs

Try running the updater and viewing the logs. You may wish to use two different terminals for this, as the updater may appear to hang while it’s running

```auto
# In first terminal
sudo systemctl start ghost-update-talescript

# In a second terminal, which the progress
journalctl -fu ghost-update-talescript

```

## Enable the timer

Finally, set your timer to start at boot and start running immediately:

```auto
sudo systemctl enable --now ghost-update-talescript.timer

```

If everything works, you can create a second service unit and timer user offset by a half an hour or an hour to run the second one.

## Finding the logs

You’ll be able to find the logs for the runs under their unit names

```auto
journalctl -eu ghost-update-talescript
journalctl -eu ghost-update-johnswebsite
```

---

<div class="post-metadata">

**Author:** ![alexander](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alexander](https://forum.ghost.org/u/alexander)\
**Post date:** [December 14, 2023, 3:46pm UTC](https://forum.ghost.org/t/prompts-have-been-disabled-when-trying-to-update-ghost-using-cron/43385/3 "2023-12-14T15:46:27Z")

</div>

Thank you for the reply. I’m getting the same error but at least the logs are readable 🙂

- Prompts have been disabled
- sudo auth

```auto
journalctl -eu ghost-update-talescript
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal' can see all messages.
      Pass -q to turn off this notice.
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: at Readable.push (node:internal/streams/readable:234:10)
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: options: {
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: message: 'Prompts have been disabled, all options must be provided via command line fla>
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: },
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: logMessageOnly: undefined,
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: help: 'You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.',
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: err: {}
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: }
Dec 14 16:28:11 ubuntu-ghost-blog ghost[2091383]: Node.js v18.17.1
Dec 14 16:28:11 ubuntu-ghost-blog sudo[2091420]: pam_unix(sudo:auth): conversation failed
Dec 14 16:28:11 ubuntu-ghost-blog sudo[2091420]: pam_unix(sudo:auth): auth could not identify password for [ghostUser]

```

in visudo I did get some issues when I was trying to save the file. The only way I was able to get around the checker complaining, was adding the full path for ghost, instead of using just `ghost update`

```auto
ghostUser ALL=(ghostUser) NOPASSWD: /home/ghostUser/.npm-global/bin/ghost update

```

I don’t get what the issue is. When I run the script, it works. When I was running it with Cron I kinda figured the issue was that I had used root cron, which runs the commands as root instead of the ghostUser. Once I changed to running the script through the users cron, the script kinda ran but still had issues (the logs I was saving to a file were not that useful).

With the current issue on sytemd (which seems to be the same as with cron)

- Prompts have been disabled
- sudo auth

Just as a sanity check, I don’t need to restart the shell after making changes to the sudoers file, do I now?

EDIT: I’ve changed the ownership for the new services to the user (I don’t know if that makes a difference), but still getting kinda the same errors, but seems like it progresses and then fails when trying to update

```auto
Dec 14 18:09:24 ubuntu-ghost-blog ghost[2093936]: - Inspecting operating system
Dec 14 18:09:24 ubuntu-ghost-blog ghost[2093936]: - Checking for deprecations
Dec 14 18:09:24 ubuntu-ghost-blog ghost[2093936]: [18:09:24] Checking for Ghost-CLI updates [started]
Dec 14 18:09:25 ubuntu-ghost-blog ghost[2093936]: [18:09:25] Checking for Ghost-CLI updates [completed]
Dec 14 18:09:25 ubuntu-ghost-blog ghost[2093936]: [18:09:25] Ensuring correct ~/.config folder ownership [started]
Dec 14 18:09:25 ubuntu-ghost-blog ghost[2093936]: [18:09:25] Ensuring correct ~/.config folder ownership [completed]
Dec 14 18:09:25 ubuntu-ghost-blog ghost[2093936]: + sudo systemctl is-active ghost_blog-talescript-com
Dec 14 18:09:25 ubuntu-ghost-blog ghost[2093936]: /home/ghostUser/.npm-global/lib/node_modules/ghost-cli/lib/ui/index.js:148
Dec 14 18:09:25 ubuntu-ghost-blog ghost[2093936]: throw new errors.SystemError('Prompts have been disabled, all options must be provided via command line flags');
.......
Dec 14 18:09:25 ubuntu-ghost-blog sudo[2093975]: pam_unix(sudo:auth): conversation failed
Dec 14 18:09:25 ubuntu-ghost-blog sudo[2093975]: pam_unix(sudo:auth): auth could not identify password for [ghostUser]

```

---

<div class="post-metadata">

**Author:** ![markstos](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/markstos/32/18182_2.png) [@markstos](https://forum.ghost.org/u/markstos)\
**Post date:** [December 21, 2023, 2:51pm UTC](https://forum.ghost.org/t/prompts-have-been-disabled-when-trying-to-update-ghost-using-cron/43385/4 "2023-12-21T14:51:55Z")

</div>

Were you able to make progress on this or are you still stuck?
