So on a system with systemd (e.g. Debian), when you get the following message:
$ sudo reboot
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Failed to talk to init daemon.
Check if you have Systemd
You can verify if it has systemd with:
$ ls -l /sbin/init
lrwxrwxrwx 1 root root 20 Jul 8 2021 /sbin/init -> /lib/systemd/systemd
Or with
$ sudo ls -l /proc/1/exe
lrwxrwxrwx 1 root root 0 Dec 27 10:03 /proc/1/exe -> /usr/lib/systemd/systemd
Force reboot on kernel level
So to solve this “fun” issue, you can restart it by echoing into some files, which are directly read by the kernel:
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger
echo 1 > /proc/sys/kernel/sysrq
, enables a System Request Key Hackecho b > /proc/sysrq-trigger
, perform the reboot.b
“Will immediately reboot the system without syncing or unmounting your disks.” Source: https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html
So this does not nicely shutdown your programs, so some data loss can happen, but does allow you to reboot, and it does flush everything that was just written to disk.
Other used sources: