zoukankan      html  css  js  c++  java
  • kernel.panic

    sysctl -a 

    kernel.panic = 0
    kernel.panic_on_io_nmi = 0
    kernel.panic_on_oops = 1
    kernel.panic_on_stackoverflow = 0
    kernel.panic_on_unrecovered_nmi = 0
    kernel.panic_on_warn = 0

    内核错误(Kernel panic)是指操作系统在监测到内部的致命错误,并无法安全处理此错误时采取的动作。
     
    中文名
    内核错误
    外文名
    Kernel panic
    级    别
    致命错误
    拼    音
    neihecuowu
    等同概念
    蓝屏死机
    内核错误(Kernel panic)是指操作系统在监测到内部的致命错误,并无法安全处理此错误时采取的动作。这个概念主要被限定在Unix以及类Unix系统中;对于MicrosoftWindows系统,等同的概念通常被称为蓝屏死机
    操作系统内核中处理Kernel panic的子程序(在AT&T派生类以及BSD类Unix中,通常为panic())通常被设计用来向控制台输出错误信息,向磁盘保存一份内核内存的转储,以便事后的调试,然后等待系统被手动重新引导,或自动重新引导。该程序提供的技术性信息通常是用来帮助系统管理员或者软件开发者诊断问题的。
    操作系统试图读写无效或不允许的内存地址是导致内核错误的一个常见原因。内核错误也有可能在遇到硬件错误或操作系统BUG时发生。在许多情况中,操作系统可以在内存访问违例发生时继续运行。然而,系统处于不稳定状态时,操作系统通常会停止工作以避免造成破坏安全和数据损坏的风险,并提供错误的诊断信息。
     
    Linux中由硬盘硬件错误导致的内核错误
    内核错误在早期的Unix系统中被引入,显示了在Unix与其前序的Multics在设计哲学上的主要差异之一。

     https://zh.wikipedia.org/wiki/内核错误

    内核错误(英语:Kernel Panic)是指操作系统在监测到内部的致命错误,并无法安全处理此错误时采取的动作。这个概念主要被限定在Unix以及类Unix系统中;对于Microsoft Windows系统,等同的概念通常被称为蓝屏死机

    操作系统内核中处理Kernel panic的子程序(在AT&T派生类以及BSD类Unix中,通常称为panic())通常被设计用来向控制台输出错误信息,向磁盘保存一份内核内存的转储,以便事后的调试,然后等待系统被手动重新引导,或自动重新引导。该程序提供的技术性信息通常是用来帮助系统管理员或者软件开发者诊断问题的。

    操作系统试图读写无效或不允许的内存地址是导致内核错误的一个常见原因。内核错误也有可能在遇到硬件错误或操作系统BUG时发生。在不同情况中,操作系统可以在内存访问违例发生时继续运行。然而,系统处于不稳定状态时,操作系统通常会停止工作以避免造成破坏安全和数据损坏的风险,并提供错误的诊断信息。

    内核错误在早期的Unix系统中被引入,显示了在Unix与Multics在设计哲学上的主要差异之一。Multics的开发者Tom van Vleck曾引述了一段在这个问题上与Unix开发者Dennis Ritchie的讨论:

    我提醒Dennis说,我在Multics中写的近半数代码都是错误恢复代码。他说:“我们不需要这些。我们有称为panic的子程序,如果发生了错误就可以调用这个函数,使得系统崩溃,然后你可以在大厅里面大叫:‘嘿,重启机器’。”[1]

    原始的panic()函数从UNIX第五版开始到基于VAX的UNIX 32V期间几乎没有变化,只是输出一条错误信息,然后就使系统进入NOP的死循环中。当改进UNIX的基础代码的时候,panic()函数也有所改进,可以向控制台输出多种格式的调试信息。

    https://en.wikipedia.org/wiki/Kernel_panic

    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 Windows 10 preview builds.[3]

    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.[4] 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, terminates.[5][6]

    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.[7] 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:

    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.'"[8]

    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:[9]

    /*
     * 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
    ", 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[edit]

    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.[10]

    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.[11] 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.[12] A kernel may also go into panic() if it is unable to locate a root file system.[13] 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.[14]

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

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

     What to do in case of a Linux kernel panic | Enable Sysadmin https://www.redhat.com/sysadmin/linux-kernel-panic

    What is a kernel panic?

    A kernel panic is one of several Linux boot issues. In basic terms, it is a situation when the kernel can't load properly and therefore the system fails to boot. During the boot process, the kernel doesn't load directly. Instead, initramfs loads in RAM, then it points to the kernel (vmlinuz), and then the operating system boots. If initramfs gets corrupted or deleted at this stage because of recent OS patching, updates, or other causes, then we face a kernel panic.

     
     
     
  • 相关阅读:
    原型模板分享——国外高阶版“大众点评”TripAdvisor
    插画手绘入门教程
    十大用户体验设计失败案例,你知道吗?
    用摹客,轻松管理设计规范!
    摹客“独门绝技”之评论审阅篇
    政务管理系统原型模板分享
    产品经理如何做需求分析?
    python基础知socket编程
    异常处理
    元类,__call__方法和单例模式
  • 原文地址:https://www.cnblogs.com/rsapaper/p/9413001.html
Copyright © 2011-2022 走看看