Linux – When can one reboot from inside a chroot environment

chrootlinuxreboot

Sometimes when I chroot into some folder , I could use reboot to reset my box, but sometimes I can't.

So I want to know why I could do that sometimes and why.

UPDATE

The chroot environment is another Linux system installed on a different partition and I prepare the chroot as follows:

mount --bind /dev chroot/dev
mount --bind /sys chroot/sys
mount -t proc proc chroot/proc

Best Answer

It's /dev/initctl, which is (often? always?) used to interact with init (pid 1), e.g. Upstart.

From your updated chroot entrance sequence, you bound /dev/, so there is a /dev/initctl in your chroot. Triggering a reboot can this way reboot your system.

This probably won't be this way much longer, as many distributions (e.g. Debian) introduce /run/, where initctl then resides.

Related Question