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?

3
  • 1
    have you tried exiting the chroot, or just ssh-ing in again on a second terminal?
    – cas
    Jul 21, 2017 at 2:21
  • use command exit to exit chroot and then reboot Jul 21, 2017 at 12:46
  • I have the same problem, provide chroot with root privileges.
    – razimbres
    Jul 18, 2018 at 14:08

1 Answer 1

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.
2
  • 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 kernel.org/doc/html/latest/admin-guide/sysrq.html -- there's a good description. Aug 24, 2021 at 10:20
  • The 5 messed up my entire system, I sended the s and u options first tho.
    – k.Cyborg
    May 13, 2022 at 4:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .