Octopi - Shutdown and restart not working - missing /scripts/ directory

What is the problem?

The UI buttons for shutdown/restart tell "command sent successfully," but nothing happens and when I ssh in and check the octoprint service log, I see:

Mar 28 07:03:46 prusa octoprint[1294]: 2024-03-28 07:03:46,016 - octoprint.server.api.system - INFO - Performing command for core:shutdown: /scripts/system_shutdown.sh
Mar 28 07:03:46 prusa octoprint[1294]: 2024-03-28 07:03:46,590 - octoprint.server.api.system - WARNING - Command for core:shutdown failed with return code 127:
Mar 28 07:03:46 prusa octoprint[1294]: !
Mar 28 07:03:46 prusa octoprint[1294]: ! STDOUT:
Mar 28 07:03:46 prusa octoprint[1294]: !
Mar 28 07:03:46 prusa octoprint[1294]: !
Mar 28 07:03:46 prusa octoprint[1294]: ! STDERR:
Mar 28 07:03:46 prusa octoprint[1294]: ! /bin/sh: 1: /scripts/system_shutdown.sh: not found

And when I do an update through the UI, it reports that it could not restart as an error. There is no /scripts/ folder:

$ ls /
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

There is a folder like that in home dir, but it doesn't contain the needed file:

$ ls $HOME
OctoPrint  mjpg-streamer  oprint  scripts
$ ls $HOME/scripts
add-octoprint-checkout  install-desktop  safemode  welcome

I have this problem for few weeks, but I didn't get to doing a proper diagnostics, re-flashing the SD cards... and a bug report until now. So it is not something that would break just now.

What did you already try to solve it?

I downloaded a fresh OctoPi image through Raspberry Pi Imager, both stable and with the new webcam stack. I tried to find the missing script via find / -name system_shutdown.sh and it was not found. I tried to use a different SD card in case of some really weird consistent corruption, but there was no difference either.

Have you tried running in safe mode?

no, issue is not related to the running server but missing files

Did running in safe mode solve the problem?


Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

browser.user_agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36
connectivity.connection_ok: True
connectivity.enabled: True
connectivity.online: True
connectivity.resolution_check: octoprint.org
connectivity.resolution_ok: True
env.hardware.cores: 4
env.hardware.freq: 900.0
env.hardware.ram: 912715776
env.os.bits: 32
env.os.id: linux
env.os.platform: linux
env.plugins.pi_support.model: Raspberry Pi 2 Model B Rev 1.1
env.plugins.pi_support.octopi_camera_stack: webcamd
env.plugins.pi_support.octopi_version: 1.0.0
env.plugins.pi_support.octopiuptodate_build: 1.0.0-1.9.3-20231009151442
env.plugins.pi_support.octopiuptodate_build_short: 2023.10.09.151442
env.plugins.pi_support.throttle_check_enabled: True
env.plugins.pi_support.throttle_check_functional: True
env.plugins.pi_support.throttle_state: 0x0
env.python.pip: 22.3
env.python.version: 3.9.2
env.python.virtualenv: True
octoprint.last_safe_mode.date: unknown
octoprint.last_safe_mode.reason: unknown
octoprint.safe_mode: False
octoprint.version: 1.9.3
systeminfo.generated: 2024-03-28T07:42:55Z
systeminfo.generator: zipapi

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

  • RPi 2B
  • latest stable Raspberry Pi Imager (1.8.5)
  • OctoPi freshly downloaded (1.0.0 with octoprint 1.9.3)

Not sure why you're looking for a system_shutdown.sh script.

OctoPi comes preconfigured with the correct commands - although if you restored a backup this could be overwritten back to what you had before.

  • Restart OctoPrint: sudo service octoprint restart
  • Shutdown system: sudo shutdown -h now
  • Restart system: sudo shutdown -r now

There is no need for any .sh files, these have never existed in OctoPi for shutdown/restart. If you had them before, these are something you've created.

1 Like

Thank you. Yes, I did restore a backup every time. I should have mentioned that and try it without the backup. :sweat_smile:
I honestly don't remember if I set it up from scratch few weeks back or if I did a backup even then. It is possible that this is a relict from my old installation that was few years old.