51

I know what a kernel panic is, but I've also seen the term "kernel oops". I'd always thought they were the same, but maybe not. So:

What is a kernel oops, and how is it different from a kernel panic?

45

An "oops" is a Linux kernel problem bad enough that it may affect system reliability.

Some "oops"es are bad enough that the kernel decides to stop running immediately, lest there be data loss or other damage. These are called kernel panics.

The latter term is primordial, going back to the very earliest versions of Linux's Unix forebears, which also print a "panic" message on the console when they happen. The original AT&T Unix kernel function that handles such conditions is called panic(). You can trace it back through the public source code releases of AT&T Unix to its very first releases:

  • The OpenSolaris version of panic() was released by Sun in 2005. It is fairly elaborate, and its header comments explain a lot about what happens in a panic situation.

  • The Unix V4 implementation of panic() was released in 1973. It basically just prints the core state of the kernel to the console and stops the processor.

  • That function is substantially unchanged in Unix V3 according to Amit Singh, who famously dissected an older version of Mac OS X and explained it. That first link takes you to a lovely article explaining macOS's approach to the implementation of panic(), which starts off with a relevant historical discussion.

  • The "unix-jun72" project to resurrect Unix V1 from scanned source code printouts shows a very early PDP-11 assembly version of this function, written sometime before June 1972, before Unix was fully rewritten in C. By this point, its implementation is whittled down to a 6-instruction routine that does little more than restart the PDP-11.

  • just happened to see your edits (presumably that's why I got some more upvotes on the question?) - really awesome, thanks for adding to this :) – strugee May 14 '17 at 3:28
14

An oops is a specific error the kernel encounters. An Oops contains the following information:

  • Brief description
  • Oops #
  • Which CPU it happened on, and the code the CPU was executing
  • Register contents

Oops is a way to debug kernel code, and there are utilities for helping with that. A kernel panic means the system cannot recover and must be restarted. However, with an Oops, the system can usually continue. You can configure klogd and syslogd to log oops messages to files, rather than to std out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.