Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello,
On the internet there are a lot of articles explaining the Linux boot process, but I couldn't find any detailed information describing the shutdown process. When I run the halt command, what exactly happens in the system? How does the init process get affected during reboot/poweroff?
I made a simple Linux system using Busybox init, and unlike mainstream Linux distributions, the little system just prints "System Halted" when it shuts down but it doesn't actually terminate the QEMU or VirtualBox session. What's causing this to happen?
Any help/explanation would be appreciated!
Thanks.
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
Quote:
Originally Posted by Unturned3
Hello,
On the internet there are a lot of articles explaining the Linux boot process, but I couldn't find any detailed information describing the shutdown process. When I run the halt command, what exactly happens in the system? How does the init process get affected during reboot/poweroff?
I made a simple Linux system using Busybox init, and unlike mainstream Linux distributions, the little system just prints "System Halted" when it shuts down but it doesn't actually terminate the QEMU or VirtualBox session. What's causing this to happen?
Any help/explanation would be appreciated!
Thanks.
Would it not be the reverse of the start-up process ? I think it would be.
Basically, ACPI sends a signal to the BIOS to physically turn off a computer and VirtualBox does emulate the same functionality. If you are not using APCI then upon shutdown the CPU stops and you will see the displayed halted message.
Back in the old days one would have to physically press the power switch (it was not a momentary push button then) to remove power.
Thanks for the replies. I forgot to add ACPI support while compiling the kernel (to keep it small)! Turns out that's the reason why the VMs isn't quitting automatically.
However I still don't understand what happens to the init process when the system goes down. From what I've learned so far, I know that init will perform tasks such as killing services or unmounting disks upon shutdown, based on how it's configured. But does the init process actually exits? Won't that result in a kernel panic? (I guess the kernel is somehow notified that init will go down?)
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
Quote:
Originally Posted by Unturned3
...I know that init will perform tasks such as killing services or unmounting disks upon shutdown, based on how it's configured. But does the init process actually exits? Won't that result in a kernel panic? (I guess the kernel is somehow notified that init will go down?)
Init is a daemon process that continues running until the system is shut down. It is the direct or indirect ancestor of all other processes and automatically adopts all orphaned processes.
The above would imply that once services have been killed, disks unmounted, etc, the init process ending is the last thing that happens before ACPI does it's thing to kill power to the system.
Yes, if the init process was killed before that, then yes, it would cause a "kernel panic" to happen.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.