6

I had a problem booting my computer, so I ran a Live cd and booted it into rescue mode, started SSH and went back home, then I fixed the boot error remotely, and now I want to restart my server so that I can boot my system, but when I try to run any of the following commands I get an error saying :

root@debian:~# reboot
Running in chroot, ignoring request.

root@debian:~# shutdown -r 0
Running in chroot, ignoring request.

So, my question is : Is it possible for me to restart my server from inside the chroot?

Hunter.S.Thompson
  • 8,839
  • 7
  • 26
  • 41

1 Answers1

3

For others who need this, there are a number of possible work-arounds. Some may not apply to your situation.

  1. Connect via another ssh session and reboot, as cas suggested.
  2. Type exit to leave the chroot and reboot, as Krzysztof Stasiak suggested.
  3. From within the chroot, ssh localhost and reboot (similar to #1 above).
  4. The servicectl project on GitHub is a "bash script start/stop service (daemons) for linux using systemd in chroot". (Systemd is the reason reboot is failing.) I haven't tried this myself.
  5. Type echo b |sudo tee /proc/sysrq-trigger. Use this as a last resort, as I'm not sure it will flush files to disk.
bitinerant
  • 784
  • 4
  • 14
  • 2
    I have to clarify a bit the last resort option. Sending `b` to `/proc/sysrq-trigger` will NOT trigger sync/unmount, it's distinct operations. So you should send `s` (sync), then `u` (remount readonly) and `b` at last, having to wait each of that operations to complete. See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html -- there's a good description. – Alex Offshore Aug 24 '21 at 10:20
  • The 5 messed up my entire system, I sended the s and u options first tho. – k.Cyborg May 13 '22 at 04:26