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
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!
{{Short description|Fatal error condition associated with Unix-like computer operating systems}} [[File:Ubuntu 4.10 kernel paic.png|thumb|Kernel panic in [[Ubuntu version history#Ubuntu 4.10 (Warty Warthog)|Ubuntu 4.10]], this one due to a VFS error.]] {{Use mdy dates|date=October 2013}} [[File:Kernel-panic.jpg|thumb|A kernel panic message from a [[Linux]] system]] [[File:Osol-dtrace-kp.png|alt=An OpenSolaris kernel panic.|thumb|An [[OpenSolaris]] kernel panic.]] [[File:Ubuntu 13.04 VirtualBox Kernel Panic.png|thumb|Kernel panic in [[Ubuntu version history#1304|Ubuntu 13.04 "Raring Ringtail"]] (Linux kernel 3.8) in [[Oracle VM VirtualBox]]]] A '''kernel panic''' (sometimes abbreviated as '''KP'''<ref>{{Cite web|title = KP - Kernel Panic (Linux) {{!}} AcronymFinder|url = http://www.acronymfinder.com/Kernel-Panic-(Linux)-(KP).html|website = www.acronymfinder.com|access-date = 2016-01-06|archive-date = October 26, 2015|archive-url = https://web.archive.org/web/20151026173210/http://www.acronymfinder.com/Kernel-Panic-(Linux)-(KP).html|url-status = live}}</ref>) is a safety measure taken by an [[operating system]]'s [[Kernel (operating system)|kernel]] upon detecting an internal [[Fatal system error|fatal error]] in which either it is unable to safely recover or continuing to run the system would have a higher risk of major data loss. The term is largely specific to [[Unix]] and [[Unix-like]] systems. The equivalent on [[Microsoft Windows]] operating systems is a [[Blue screen of death|stop error]], often called a "blue screen of death". The [[Kernel (operating system)|kernel]] routines that handle panics, known as <code>panic()</code> in [[AT&T Corporation|AT&T]]-derived and [[Berkeley Software Distribution|BSD]] Unix source code, are generally designed to output an [[error message]] to the [[system console|console]], dump an image of kernel memory to disk for [[post-mortem debugging]], and then either wait for the system to be manually rebooted, or initiate an automatic [[reboot]].<ref>{{cite web|url=http://www.unix.com/man-page/FreeBSD/9/panic/|title=FreeBSD 11.0 - man page for panic (freebsd section 9) - Unix & Linux Commands|website=www.unix.com|access-date=October 26, 2010|archive-date=April 1, 2024|archive-url=https://web.archive.org/web/20240401232331/https://www.unix.com/man-page/FreeBSD/9/panic/|url-status=live}}</ref> The information provided is of a highly technical nature and aims to assist a [[system administrator]] or [[software developer]] in diagnosing the problem. Kernel panics can also be caused by errors originating outside [[kernel space]]. For example, many Unix operating systems panic if the [[init]] process, which runs in [[user space and kernel space|user space]], terminates.<ref>{{cite web|url=http://www.unix.com/hp-ux/54221-boot-failure-init-died.html|title=boot failure-init died - Unix Linux Forums - HP-UX|website=www.unix.com|access-date=June 12, 2013|archive-date=April 1, 2024|archive-url=https://web.archive.org/web/20240401232240/https://www.unix.com/hp-ux/54221-boot-failure-init-died.html|url-status=live}}</ref><ref>{{cite newsgroup|url=https://groups.google.com/forum/#!original/comp.sys.sgi.admin/HRY5oflBe48/tgnMPZ3vZFQJ|title=Re: PANIC: init died|author=Randolph J. Herber|newsgroup=comp.sys.sgi.admin|date=September 1, 1999|access-date=December 9, 2017|archive-date=January 22, 2011|archive-url=http://arquivo.pt/wayback/20110122130054/https://groups.google.com/forum/#!original/comp.sys.sgi.admin/HRY5oflBe48/tgnMPZ3vZFQJ|url-status=live}}</ref> ==History== The [[Unix]] kernel maintains internal consistency and [[Runtime (program lifecycle phase)|runtime]] correctness with [[Assertion (software development)|assertions]] as the [[fault detection and isolation|fault detection]] mechanism. The basic assumption is that the hardware and the software should perform correctly and a failure of an assertion results in a ''panic'', i.e. a voluntary halt to all system activity.<ref name="SiewiorekSwarz1998">{{cite book|author1=Daniel P. Siewiorek|author2-link=Robert S. Swarz|author2=Robert S. Swarz|title=Reliable computer systems: design and evaluation|url=https://books.google.com/books?id=o15pmRSdQIIC&pg=PA622|access-date=May 6, 2011|year=1998|publisher=A K Peters, Ltd.|isbn=978-1-56881-092-8|page=622}}</ref> The kernel panic was introduced in an early version of Unix and demonstrated a major difference between the design philosophies of Unix and its predecessor [[Multics]]. Multics developer [[Tom van Vleck]] recalls a discussion of this change with Unix developer [[Dennis Ritchie]]: <blockquote>I remarked to Dennis that easily half the code I was writing in Multics was error recovery code. He said, "We left all that stuff out. If there's an error, we have this routine called panic, and when it is called, the machine crashes, and you holler down the hall, 'Hey, reboot it.{{' "}}<ref>{{cite web|url=http://www.multicians.org/unix.html|title=Unix and Multics|website=www.multicians.org|access-date=May 25, 2005|archive-date=August 5, 2012|archive-url=https://web.archive.org/web/20120805155922/http://www.multicians.org/unix.html|url-status=live}}</ref></blockquote> [[File:WiiUKernelPanic.png|thumb|A [[Wii U]] kernel panic log file.]] The original <code>panic()</code> function was essentially unchanged from Fifth Edition UNIX to the [[VAX]]-based UNIX 32V and output only an error message with no other information, then dropped the system into an endless idle loop. As the Unix [[codebase]] was enhanced, the <code>panic()</code> function was also enhanced to dump various forms of debugging information to the console. ==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> ==Operating system specifics== ===Linux=== {{See also|kdump (Linux)}} [[File:Kernel panic message.png|thumb|Kernel panic as seen on an iKVM console]] [[File:Drm panic message.png|thumb|Kernel panic with drm_panic enabled]] [[File:Drm panic with qr code.png|thumb|Kernel Panic with drm_panic enabled supporting logging to QR Codes]] Kernel panics appear in [[Linux]] like in other [[Unix-like]] systems; however, serious but non-fatal errors can generate another kind of error condition, known as a [[Linux kernel oops|kernel oops]].<ref>{{cite web|url=https://lwn.net/images/pdf/LDD3/ch04.pdf|title=''Linux Device Drivers'', Chapter 4|access-date=July 21, 2016|archive-date=November 14, 2014|archive-url=https://web.archive.org/web/20141114011920/http://lwn.net/images/pdf/LDD3/ch04.pdf|url-status=live}}</ref> In this case, the kernel normally continues to run after [[kill (Unix)|killing]] the offending [[process (computing)|process]]. As an oops could cause some subsystems or resources to become unavailable, they can later lead to a full kernel panic. On Linux, a kernel panic causes keyboard LEDs to blink as a visual indication of a critical condition.<ref>{{cite book | url = https://books.google.com/books?id=FyRhZJ3h3VQC&q=linux+kernel+panic+keyboard+led+blinking&pg=PA62 | title = Linux Troubleshooting for System Administrators and Power Users | date = May 2006 | access-date = 2016-02-05 | author1 = James Kirkland | author2 = David Carmichael | author3 = Christopher L. Tinker | author4 = Gregory L. Tinker | publisher = [[Prentice Hall]] | page = 62 | isbn = 9780132797399 | archive-date = April 1, 2024 | archive-url = https://web.archive.org/web/20240401232239/https://books.google.com/books?id=FyRhZJ3h3VQC&q=linux+kernel+panic+keyboard+led+blinking&pg=PA62#v=snippet&q=linux%20kernel%20panic%20keyboard%20led%20blinking&f=false | url-status = live }}</ref> As of Linux 6.10, drm_panic was merged allowing [[Direct Rendering Manager|DRM]] drivers to support drawing a panic screen to inform the user that a panic occurred. This allows a panic screen to appear even when a display server was running when the panic occurred.<ref>{{cite web |url=https://fedoraproject.org/wiki/Changes/EnableDrmPanic |title=Changes/EnableDrmPanic |work=Fedora Project Wiki}}</ref> As of Linux 6.12, drm_panic was extended where the stack trace can be encoded as a [[QR code]].<ref>{{cite mailing list |url=https://lore.kernel.org/dri-devel/20240829144654.GA145538@linux.fritz.box/ |title=[PULL] drm-misc-next |author=Thomas Zimmermann |date=29 August 2024 |mailing-list=dri-devel}}</ref> ===macOS=== When a kernel panic occurs in [[macOS|Mac OS X]] 10.2 through 10.7, the computer displays a multilingual message informing the user that they need to reboot the system.<ref>{{cite web|url=http://support.apple.com/kb/TS3742|title=OS X: About kernel panics - Apple Support|website=support.apple.com|archive-date=May 21, 2013|archive-url=https://web.archive.org/web/20130521042317/http://support.apple.com/kb/TS3742|url-status=dead}}</ref> Prior to 10.2, a more traditional Unix-style panic message was displayed; in 10.8 and later, the computer automatically reboots and the message is only displayed as a skippable warning afterward. The format of the message varies from version to version:<ref>{{cite web|url=http://osxbook.com/book/bonus/chapter5/panic/|title=A New Screen of Death for Mac OS X|website=OSXBook.com|access-date=April 30, 2011|archive-date=May 1, 2012|archive-url=https://web.archive.org/web/20120501191934/http://osxbook.com/book/bonus/chapter5/panic/|url-status=dead}}</ref> * 10.0–10.1: The system displays text on the screen, giving details about the error, and becomes unresponsive. * 10.2: Rolls down a black transparent curtain then displays a message on a white background informing the user that they should restart the computer. The message is shown in [[English language|English]], [[French language|French]], [[German language|German]] and [[Japanese language|Japanese]]. * 10.3–10.5: Similar to 10.2, but the background of the error message is dark grey. * 10.6–10.7: The text has been revised and now includes a [[Spanish language|Spanish]] translation. * 10.8 and later: The computer becomes unresponsive before it immediately reboots. After restarting, it shows a message for a few seconds informing the user that a problem caused the computer to restart, before continuing to boot. The message now includes a [[Chinese language|Chinese]] translation. If five new kernel panics occur within three minutes of the first one, the Mac will display a [[No symbol|prohibitory sign]] for thirty seconds, and then shut down; this is known as a "recurring kernel panic".<ref>{{cite web |title=OS X: About kernel panics |url=https://support.apple.com/en-us/TS3742 |url-status=dead |archive-url=https://web.archive.org/web/20180524032449/https://support.apple.com/en-us/TS3742 |archive-date=May 24, 2018 |website=Apple Support |publisher=Apple}}</ref> In all versions above 10.2, the text is superimposed on a [[Power symbol|standby symbol]] and is not full screen. Debugging information is saved in [[Non-volatile random-access memory|NVRAM]] and written to a log file on reboot. In 10.7 there is a feature to automatically restart after a kernel panic. In some cases, on 10.2 and later, white text detailing the error may appear in addition to the standby symbol. <gallery> File:Mac OS X 10.0 10.1 Kernel Panic.jpg|Mac OS X 10.0–10.1 kernel panic File:Mac OS X 10.2 Kernel Panic.jpg|Mac OS X 10.2 kernel panic File:MacOSX kernel panic.png|Mac OS X 10.3–10.5 kernel panic File:Panic10.6.png|[[Mac OS X 10.6]] and 10.7 kernel panic File:OS X Mountain Lion kernel panic.jpg|Message shown after a system restart due to a kernel panic in [[OS X 10.8]] and later versions </gallery> ==See also== {{Commons}} * [[Core dump]] * [[Blue screen of death]] * [[Fatal system error]] * [[Screen of death]] * [[Machine-check exception]] (MCE) * [[Reliability, availability and serviceability]] (RAS) ==References== {{Reflist|30em}} {{Error messages}} [[Category:Computer errors]] [[Category:Operating system kernels]] [[Category:Screens of death]]
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)
Pages transcluded onto the current version of this page
(
help
)
:
Template:' "
(
edit
)
Template:Cite book
(
edit
)
Template:Cite mailing list
(
edit
)
Template:Cite newsgroup
(
edit
)
Template:Cite web
(
edit
)
Template:Commons
(
edit
)
Template:Error messages
(
edit
)
Template:Reflist
(
edit
)
Template:See also
(
edit
)
Template:Short description
(
edit
)
Template:Use mdy dates
(
edit
)