You are on page 1of 5

Kernel panic

A kernel panic (sometimes abbreviated as KP[1]) is a safety measure taken by an


operating system's kernel upon detecting an internal fatal error in which it either is
unable to safely recover or cannot have the system continue to run without having a
much higher risk of major data loss. The term is largely specific to Unix and Unix-
like systems. For Microsoft Windows operating systems the equivalent term is "Stop
error", resulting in a bug check[2] screen that presents the bug check code on a blue
background in early versions of Windows (colloquially known as a "Blue Screen of
Death" or BSoD), or on a green background on the Xbox One platform as well as in
A kernel panic message from aLinux
some Windows 10 builds.
system
The kernel routines that handle panics, known as panic() in AT&T-derived and
BSD Unix source code, are generally designed to output an error message to the
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.[3] 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 userspace,
terminates.[4][5]
Kernel panic in Ubuntu 13.04 (Linux
3.8) in Oracle VM VirtualBox

Contents
History
Causes
Operating system specifics
Linux
macOS
See also
References

History
The Unix kernel maintains internal consistency and runtime correctness with assertions as the 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.[6] 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 developerDennis Ritchie:

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.'"[7]
The original panic() 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.

Source code of panic() function in V6 UNIX:[8]

/*
* In case console is off,
* panicstr contains argument to last
* call to panic.
*/
char *panicstr ;

/*
* Panic is called on unresolvable
* fatal errors.
* It syncs, prints "panic: mesg" and
* then loops.
*/
panic(s)
char *s;
{
panicstr = s;
update ();
printf ("panic: %s \n", s);
for(;;)
idle();
}

As the Unix codebase was enhanced, the panic() 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. However, the system is in an unstable state and rather than risking security
breaches and data corruption, the operating system stops to prevent further damage and facilitate diagnosis of the error and, in usual
cases, restart.[9]

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.[10] Add-on hardware or malfunctioningRAM could also be sources of
fatal kernel errors during start up, due to incompatibility with the OS or a missing device driver.[11] A kernel may also go into
panic() if it is unable to locate a root file system.[12] 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.[13]

kernel_init():[14]
The following is an implementation of the Linux kernel final initialization in

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." );
}

Operating system specifics

Linux
Kernel panics appear in Linux like in other Unix-like systems, but they can also
generate another kind of error condition, known as akernel oops.[15] In this case, the
kernel normally continues to run after killing the offending process. As an oops
could cause some subsystems or resources to become unavailable, they can later lead
to a full kernel panic.

In Linux kernel, a kernel panic causes keyboard LEDs to blink as a visual indication
of a critical condition.[16]
Kernel panic as seen on an iKVM
console

macOS
When a kernel panic occurs in Mac OS X 10.2 through 10.7, the computer displays a multilingual message informing the user that
they need to reboot the system.[17] Prior to 10.2, a more traditional Unix-style panic message was displayed; in 10.8 and later, the
[18]
computer automatically reboots and displays a message after the restart.The format of the message varies from version to version:

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, French, German and Japanese.
10.3–10.5: The kernel panic is almost the same as version 10.2 but the background of the error screen is black.
10.6–10.7: The text has been revised and now includes aSpanish translation.
10.8 and later: The computer becomes unresponsive before it immediately reboots. When the computer starts back
up, it shows a message for a few seconds about the computer restarting because of a kernel panic, and then the
computer restarts back up. AChinese translation was also added.
Sometimes when there are five or more kernel panics within three minutes of the first one, the Mac will display a prohibitory sign for
30 seconds, and then shut down (this is known as a "recurring kernel panic").

In all versions above 10.2, the text is in superimposed on a standby symbol and is not full screen. Debugging information is saved in
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.
Mac OS X 10.0–10.1 Mac OS X 10.2 kernel Mac OS X 10.3–10.5 Mac OS X 10.6 and 10.7
kernel panic panic kernel panic kernel panic

Message after the


computer restarting
because of a kernel
panic in OS X 10.8 and
later versions

See also
Core dump
STOP Error
Blue Screen of Death

References
1. "KP - Kernel Panic (Linux) | AcronymFinder"(http://www.acronymfinder.com/Kernel-Panic-(Linux)-(KP).html).
www.acronymfinder.com. Retrieved January 6, 2016.
2. "Bug Checks (Blue Screens)"(https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-checks--bl
ue-screens-). Hardware Dev Center - Microsoft.
3. "FreeBSD 11.0 - man page for panic (freebsd section 9) - Unix & Linux Commands"(http://www.unix.com/man-page/
FreeBSD/9/panic/). www.unix.com.
4. "boot failure-init died - Unix Linux Forums - HP-UX"(http://www.unix.com/hp-ux/54221-boot-failure-init-died.html).
www.unix.com.
5. Randolph J. Herber (September 1, 1999)."Re: PANIC: init died" (https://groups.google.com/forum/#!original/comp.sy
s.sgi.admin/HRY5oflBe48/tgnMPZ3vZFQJ). Newsgroup: comp.sys.sgi.admin (news:comp.sys.sgi.admin).
6. Daniel P. Siewiorek; Robert S. Swarz (1998). Reliable computer systems: design and evaluation(https://books.googl
e.com/books?id=o15pmRSdQIIC&pg=P A622). A K Peters, Ltd. p. 622.ISBN 978-1-56881-092-8. Retrieved May 6,
2011.
7. "Unix and Multics" (http://www.multicians.org/unix.html). www.multicians.org.
8. Source code /usr/sys/ken/prf.c from(http://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/sys/ken/prf.c)
V6 UNIX
9. Steven M. Hancock (November 22, 2002).Tru64 UNIX troubleshooting: diagnosing andcorrecting system
problemsHP Technologies SeriesITPro collection (https://books.google.com/books?id=wh438GgIJtEC&pg=P
A119).
Digital Press. pp. 119–126.ISBN 978-1-55558-274-6. Retrieved May 3, 2011.
10. Michael Jang (2006). Linux annoyances for geeks(https://books.google.com/books?id=cNGbObmg6IwC&pg=P
A26
7). O'Reilly Media, Inc. pp. 267–274.ISBN 978-0-596-00801-7. Retrieved April 29, 2011.
11. David Pogue (December 17, 2009).Switching to the Mac: The Missing Manual, Snow Leopard Edition(https://books.
google.com/books?id=SjuiTv7DepEC&pg=P A589). O'Reilly Media, Inc. p. 589.ISBN 978-0-596-80425-1. Retrieved
May 4, 2011.
12. Greg Kroah-Hartman (2007).Linux kernel in a nutshell(https://books.google.com/books?id=1rFLGKO0dywC&pg=P
A
59). O'Reilly Media, Inc. p. 59.ISBN 978-0-596-10079-7. Retrieved May 3, 2011.
13. Wolfgang Mauerer (September 26, 2008).Professional Linux Kernel Architecture(https://books.google.com/books?i
d=e8BbHxVhzFAC&pg=PA1238). John Wiley and Sons. pp. 1238–1239.ISBN 978-0-470-34343-2. Retrieved May 3,
2011.
14. linux/init/main.c (http://lxr.linux.no/linux+v3.10/init/main.c#L811), LXR Cross Referencer
15. "Linux Device Drivers, Chapter 4" (https://lwn.net/images/pdf/LDD3/ch04.pdf)(PDF).
16. James Kirkland; David Carmichael; Christopher L. T inker; Gregory L. Tinker (May 2006). Linux Troubleshooting for
System Administrators and Power Users(https://books.google.com/books?id=FyRhZJ3h3VQC&pg=P A62&lpg=PA62
&dq=linux+kernel+panic+keyboard+led+blinking&source=bl&ots=wKP0f1tr3x&sig=a-VwTVT6szIvHtK1v8O65LBa8w
M&hl=en&sa=X&redir_esc=y#v=onepage&q=linux%20kernel%20panic%20keyboard%20led%20blinking&f=false) .
books.google.com. Prentice Hall. p. 62. Retrieved February 5, 2016.
17. "OS X: About kernel panics - Apple Support"(http://support.apple.com/kb/HT1392). support.apple.com.
18. "A New Screen of Death for Mac OS X"(http://osxbook.com/book/bonus/chapter5/panic/)
. OSXBook.com.

Retrieved from "https://en.wikipedia.org/w/index.php?title=Kernel_panic&oldid=880987546


"

This page was last edited on 30 January 2019, at 19:06(UTC).

Text is available under theCreative Commons Attribution-ShareAlike License ; additional terms may apply. By using this
site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of theWikimedia
Foundation, Inc., a non-profit organization.

You might also like