Everything Penguin

Focusing on Linux-based Operating Systems
htDig Search:

Operating Systems
  • /pub/OS/Linux

  • Storage
  • File Systems
  • HPC
  • /pub/Storage

  • Networking
  • /pub/Networking

  • Network Services
  • /pub/NetworkServices

  • Security
  • /pub/Security
  • Keytool/OpenSSL

  • Clustering
  • HA
  • DRM

  • Development
  • Design
  • C/C++
  • Java
  • Perl
  • Python
  • Shell
  • Web / J2EE

  • Not Linux ?
  • BSD
  • HP-UX
  • Mac
  • Solaris
  • VM
  • Windows
  • /pub/OS

  • Other
  • /pub
  • /pub/3rdParty
  •  Parent Directory

    Linux Kernel Panic
    Brett Lee
    ========================
    
    
    Topics:
    ------------
     - panic()
     - Core dump
     - Oops
     - SysRq
     - Misc
    
    
    
    Panic:
    ------------
    
    OMG, Panic!!!  Ok, I just had to write that...
    
    First of all, panic is not chaos, it is simply the kernel panic() routine.
    This routine is called when the kernel detects an internal fatal error.
    
    So, what happens when the panic() routine is called?
    
      Typically, this results in a stack trace to the console and dumping
      kernel memory to disk.  After that, the default is to just sit there
      waiting for someone to grab the information from the console.  Meaning,
      the *default* linux kernel will never reboot after panic.
    
      ** Note:  If you want the system to reboot after the panic, set:
                    "kernel.panic=20" in /etc/sysctl.conf
                For for an immediate change:
                    sysctl -w kernel.panic=20 
    
    
    
    Core dump
    ---------------------
    
    As mentioned above, when the kernel executes the panic() routine, one of the
    actions the kernel does before halting is to write a core file out to disk.
    
    This core file contains lots of useful information for debugging what caused
    the panic; the details of which seem mysterious to the untrained observer.
    Well, that is until they understand the Kernel Symbol Table.
    
    The Kernel Symbol Table (/boot/System.map) maps symbols (names) to their
    addresses in memory.  That means that with the symbol table, a debugger knows
    exactly where to go in the core file to find information about what task was
    running, what system call was being executed, what values were set, etc.
    
    A symbol table is static for a kernel build.  Symbol addresses may (and do)
    change between kernels, so a System.map installs with each kernel.
    
    
    
    Oops
    ---------------------
    
    An oops is an event that happens when the kernel detects a mistake.
    This is also called a soft panic.  On the flip side, a hard panic as discussed
    above is also known as Aieee!
    
    What happens when a kernel oops occurs?  The default is to declare an OOPS,
    kill the process that caused the oops, and continue running.
    
    As can be imagined, when there is a mistake in the kernel this could be
    anything; from something that doesn't matter to something that really matters.
    For this reason, it is wise to halt the system via the panic() routine.
    
    To set the kernel to panic on oops, use `sysctl -w kernel.panic_on_oops=1`
      For this to survive reboots, put it in /etc/sysctl.conf.
    
    After that, follow proceedure to capture stack trace and the core file.
    
    
    
    RAM
    --------------------
    
    After panic(), the kernel halts.  That means that whatever is in memory
    will be there until:
    
       1) the power is shut off, or
       2) another kernel boots up and starts writing all over it.
    
    Give you any ideas?  Like booting up another kernel that doesn't write all
    over the existing bits in RAM?
    
    If you did, you could scrape off the bits from the DIMMs and add that to
    the stack trace and core file.
    
    
    
    SysRq (System Request)
    --------------------
    
    SysRq is a way to get a little bit more control when the system panics.
    
    For example, the ctrl-alt-del keys don't work after a panic().  SysRq, however,
    does give provide some keystroke combinations that can be used after a panic().
    
    If the time comes when the SysRq keys are required, simply use the magic SysRq
    key combination:
    
        [ALT]+[SysRq]+[COMMAND], where:
    
        [SysRq] key is the "print screen" key, and 
        [COMMAND] is one of the following:
    
        b - reboot immediately without syncing or unmounting disks
        e - sends a SIGTERM to all running processes, except for init
        o - shut down system
        s - attempt to sync all mounted filesystems
        u - attempt to remount all mounted filesystems as read-only
    
        These keys need to be pressed together simultaneously to take effect.
    
        If you want to use SysRq, then set:  kernel.sysrq = 1
    
        In summary, auto-rebooting is great for remote systems, and
          the magic SysRq combo is very useful for local systems.
    
    From:  http://blogs.techrepublic.com.com/opensource/?p=158
    
    
    
    Misc
    --------------------
    
    kdump - google vmlinux kdump
          - Kdump doesn't support compressed kernel images; use image: vmlinux-kdump
          - http://manpages.ubuntu.com/manpages/jaunty/man8/makedumpfile.8.html
          - ftp.suse.com/pub/people/tiwai/kdump-training/kdump-training.pdf
          - http://weblogex.blogspot.com/2009/05/howto-use-kdump.html
    
    
    
    
    
    For more, see:
    
      http://penberg.blogspot.com/
      http://en.wikipedia.org/wiki/Kernel_panic
      http://en.wikipedia.org/wiki/Kernel_oops
      http://en.wikipedia.org/wiki/Linux_kernel_oops
      http://en.wikipedia.org/wiki/System.map
    

    Other Sites

    RFC's
  • FAQ's
  • IETF
  • RFC Sourcebook

  • Linux
  • Linux - Intro
  • Linux Kernel
  • Linux Kernel (LKML)
  • Bash - Intro
  • Bash - Advanced
  • Command Line
  • System Administration
  • Network Administration
  • Man Pages (& more)
  • More Guides
  • Red Hat Manuals
  • HOWTO's

  • Reference/Tutorials
  • C++ @ cppreference
  • C++ @ cplusplus
  • CSS @ echoecho
  • DNS @ Zytrax
  • HTML @ W3 Schools
  • Java @ Sun
  • LDAP @ Zytrax
  • Linux @ YoLinux
  • MySQL
  • NetFilter
  • Network Protocols
  • OpenLDAP
  • Quagga
  • Samba
  • Unix Programming



  • This site contains many of my notes from research into different aspects of the Linux kernel as well as some of the software provided by GNU and others. Thouugh these notes are not fully comprehensive or even completetly accurate, they are part of my on-going attempt to better understand this complex field. And, they are your to use.

    Should you wish to report any errors or suggestions, please let me know.

    Should you wish to make a donation for anything you may have learned here, please direct that donation to the ASPCA, with my sincere thanks.

    Brett Lee
    Everything Penguin

    The code for this site, which is just a few CGI scripts, may be found on GitHub (https://github.com/userbrett/cgindex).

    For both data encryption and password protection, try Personal Data Security (https://www.trustpds.com).


    "We left all that stuff out. If there's an error, we have this routine called 'panic', and when its called, the machine crashes, and you holler down the hall, 'Hey, reboot it.'"

        - Dennis Ritchie on Unix (vs Multics)


    Google
    [ Powered by Red Hat Linux ] [ Powered by Apache Server] [ Powered by MySQL ]

    [ Statistics by AWStats ]