Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Kernel panic
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Causes== A panic may occur as a result of a hardware failure or a [[software bug]] in the operating system. In many cases, the operating system is capable of continued operation after an error has occurred. If the system is in an unstable state, rather than risking security breaches and data corruption, the operating system stops in order to prevent further damage, which helps to facilitate diagnosis of the error and may restart automatically.<ref name="Hancock2002">{{cite book|author=Steven M. Hancock|title=Tru64 UNIX troubleshooting: diagnosing and correcting system problems|url=https://books.google.com/books?id=wh438GgIJtEC&pg=PA119|access-date=May 3, 2011|date=November 22, 2002|publisher=Digital Press|isbn=978-1-55558-274-6|pages=119β126}}</ref> After recompiling a kernel binary image from [[source code]], a kernel panic while [[booting]] the resulting kernel is a common problem if the kernel was not correctly configured, compiled or installed.<ref name="Jang2006">{{cite book|author=Michael Jang|title=Linux annoyances for geeks|url=https://books.google.com/books?id=cNGbObmg6IwC&pg=PA267|access-date=April 29, 2011|year=2006|publisher=O'Reilly Media, Inc.|isbn=978-0-596-00801-7|pages=267β274}}</ref> Add-on hardware or malfunctioning [[RAM]] could also be sources of fatal kernel errors during start up, due to incompatibility with the OS or a missing [[device driver]].<ref name="Pogue2009">{{cite book|author=David Pogue|title=Switching to the Mac: The Missing Manual, Snow Leopard Edition|url=https://books.google.com/books?id=SjuiTv7DepEC&pg=PA589|access-date=May 4, 2011|date=December 17, 2009|publisher=O'Reilly Media, Inc.|isbn=978-0-596-80425-1|page=589}}</ref> A kernel may also go into <code>panic()</code> if it is unable to locate a [[root file system]].<ref name="Kroah-Hartman2007">{{cite book|author=Greg Kroah-Hartman|title=Linux kernel in a nutshell|url=https://books.google.com/books?id=1rFLGKO0dywC&pg=PA59|access-date=May 3, 2011|year=2007|publisher=O'Reilly Media, Inc.|isbn=978-0-596-10079-7|page=59}}</ref> During the final stages of kernel [[userspace]] initialization, a panic is typically triggered if the spawning of [[init]] fails. A panic might also be triggered if the init process terminates, as the system would then be unusable.<ref name="Mauerer2008">{{cite book|author=Wolfgang Mauerer|title=Professional Linux Kernel Architecture|url=https://books.google.com/books?id=e8BbHxVhzFAC&pg=PA1238|access-date=May 3, 2011|date=September 26, 2008|publisher=John Wiley and Sons|isbn=978-0-470-34343-2|pages=1238β1239|archive-date=April 1, 2024|archive-url=https://web.archive.org/web/20240401232239/https://books.google.com/books?id=e8BbHxVhzFAC&pg=PA1238|url-status=live}}</ref> The following is an implementation of the Linux kernel final initialization in <code>kernel_init()</code>:<ref name="lxr, init/main.c">{{cite web |url=http://lxr.linux.no/linux+v3.10/init/main.c#L811 |title=linux/init/main.c |website=[[LXR Cross Referencer]] |archive-url=https://web.archive.org/web/20221006174048/http://lxr.linux.no/linux+v3.10/init/main.c#L811 |archive-date=October 6, 2022 |url-status=live}}</ref> <syntaxhighlight lang="c"> static int __ref kernel_init(void *unused) { ... /* * We try each of these until one succeeds. * * The Bourne shell can be used instead of init if we are * trying to recover a really broken machine. */ if (execute_command) { if (!run_init_process(execute_command)) return 0; pr_err("Failed to execute %s. Attempting defaults...\n", execute_command); } if (!run_init_process("/sbin/init") || !run_init_process("/etc/init") || !run_init_process("/bin/init") || !run_init_process("/bin/sh")) return 0; panic("No init found. Try passing init= option to kernel. " "See Linux Documentation/init.txt for guidance."); } </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)