Error kernel panic

From Wikipedia, the free encyclopedia

From Wikipedia, the free encyclopedia

A kernel panic message from a Linux system

A OpenSolaris 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 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 stop error, often called a «blue screen of death».

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.[2] 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.[3][4]

History[edit]

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.[5] 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.'»[6]

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

/*
 * 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: %sn", 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.[8]

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

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

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[edit]

Linux[edit]

Kernel panic as seen on an iKVM console

Kernel panics appear in Linux like in other Unix-like systems, but they can also generate another kind of error condition, known as a kernel oops.[14] 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.

On Linux, a kernel panic causes keyboard LEDs to blink as a visual indication of a critical condition.[15]

macOS[edit]

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.[16] Prior to 10.2, a more traditional Unix-style panic message was displayed; in 10.8 and later, the computer automatically reboots and displays a message after the restart. The format of the message varies from version to version:[17]

  • 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 a Spanish translation.
  • 10.8 and later: The computer becomes unresponsive before it immediately reboots. When the computer starts back up, it shows a warning message for a few seconds about the computer restarting because of a kernel panic, and then the computer restarts back up. The message now includes a Chinese translation.

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 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 kernel panic

    Mac OS X 10.0–10.1 kernel panic

  • Mac OS X 10.2 kernel panic

    Mac OS X 10.2 kernel panic

  • Mac OS X 10.3–10.5 kernel panic

    Mac OS X 10.3–10.5 kernel panic

  • Message shown after the computer restarts because of a kernel panic in OS X 10.8 and later versions

    Message shown after the computer restarts because of a kernel panic in OS X 10.8 and later versions

See also[edit]

  • Core dump
  • Blue screen of death
  • Screen of death

References[edit]

  1. ^ «KP — Kernel Panic (Linux) | AcronymFinder». www.acronymfinder.com. Retrieved January 6, 2016.
  2. ^ «FreeBSD 11.0 — man page for panic (freebsd section 9) — Unix & Linux Commands». www.unix.com.
  3. ^ «boot failure-init died — Unix Linux Forums — HP-UX». www.unix.com.
  4. ^ Randolph J. Herber (September 1, 1999). «Re: PANIC: init died». Newsgroup: comp.sys.sgi.admin.
  5. ^ Daniel P. Siewiorek; Robert S. Swarz (1998). Reliable computer systems: design and evaluation. A K Peters, Ltd. p. 622. ISBN 978-1-56881-092-8. Retrieved May 6, 2011.
  6. ^ «Unix and Multics». www.multicians.org.
  7. ^ Source code /usr/sys/ken/prf.c from V6 UNIX
  8. ^ Steven M. Hancock (November 22, 2002). Tru64 UNIX troubleshooting: diagnosing and correcting system problemsHP Technologies SeriesITPro collection. Digital Press. pp. 119–126. ISBN 978-1-55558-274-6. Retrieved May 3, 2011.
  9. ^ Michael Jang (2006). Linux annoyances for geeks. O’Reilly Media, Inc. pp. 267–274. ISBN 978-0-596-00801-7. Retrieved April 29, 2011.
  10. ^ David Pogue (December 17, 2009). Switching to the Mac: The Missing Manual, Snow Leopard Edition. O’Reilly Media, Inc. p. 589. ISBN 978-0-596-80425-1. Retrieved May 4, 2011.
  11. ^ Greg Kroah-Hartman (2007). Linux kernel in a nutshell. O’Reilly Media, Inc. p. 59. ISBN 978-0-596-10079-7. Retrieved May 3, 2011.
  12. ^ Wolfgang Mauerer (September 26, 2008). Professional Linux Kernel Architecture. John Wiley and Sons. pp. 1238–1239. ISBN 978-0-470-34343-2. Retrieved May 3, 2011.
  13. ^ linux/init/main.c, LXR Cross Referencer
  14. ^ «Linux Device Drivers, Chapter 4″ (PDF).
  15. ^ James Kirkland; David Carmichael; Christopher L. Tinker; Gregory L. Tinker (May 2006). Linux Troubleshooting for System Administrators and Power Users. Prentice Hall. p. 62. ISBN 9780132797399. Retrieved February 5, 2016.
  16. ^ «OS X: About kernel panics — Apple Support». support.apple.com.
  17. ^ «A New Screen of Death for Mac OS X». OSXBook.com.

Linux is used everywhere in the IT world. You’ve probably used Linux today, even if you didn’t realize it. If you have learned anything about Linux, then you know it is indeed a kernel. The kernel is the primary unit of the Linux operating system (OS) and is responsible for communications between a computer’s hardware and its processes.

In this article, you will learn about one situation related to the Linux kernel: The kernel panic. The term itself can make you panic, but if you have the proper knowledge, then you can remain calm. Every system admin faces this issue at least once in their career, but reinstalling the system is not the first solution you should turn to.

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.

If we dig into the boot process more, then we encounter the Linux «chicken/egg problem.»

[ Readers also liked: Terminals, shells, consoles, and command lines ]

When a Linux system boot process starts after the Master Boot Record (MBR) step, GRUB is loaded. The kernel needs to be loaded into RAM to start the OS, but the kernel is situated on the hard disk (/boot/vmlinuz), and the hard disk is not yet mounted on /. Without mounting, no files can be accessed, even the kernel. To overcome this, first initramfs/initrd loads in RAM directly and mounts the /boot partition in read-only mode. Next, it mounts the hard disk on the / partition, and the process continues.

# ls -lrth /boot/

This process emphasizes the importance of initramfs/initrd in the Linux boot process.

Why do kernel panics occur?

Kernel panics occur:

  1. If the initramfs file gets corrupted.
  2. If initramfs is not created properly for the specified kernel. Every kernel version has its own corresponding initramfs.
  3. If the installed kernel is not supported or not installed correctly.
  4. If recent patches have some flaws.
  5. If a module has been installed from online or another source, but the initrd image is not created with the latest installed module.

How to troubleshoot?

The first thing to do after seeing a kernel panic error is not to panic ,because now you are aware of the image file related to the error.

Step 1: Boot the system normally with your given kernel version.

Then you may see this error:

Press Enter or any key, and then you will see the following:

This is your kernel panic situation.

Step 2: Reboot your machine again and select the rescue prompt.

In RHEL 6 or earlier versions, we do not have this option, but in RHEL 7 and onwards, we have a built-in rescue image.

This image boots your OS normally.

Step 2.1: Go to /boot and list all files. Here you will see there is no initramfs file for your kernel, but there is an initramfs file for rescue by which you have booted your system, and another is for kdump.

The initramfs for the kernel is missing.

Step 3: You will need to create a new initramfs file that corresponds to your kernel version.

Step 3.1: First check your kernel version:

#uname -r

Step 3.2: Next, run the dracut command:

#dracut -f <initrd-image> <kernal-version>

3.3) List the /boot directory contents again. The initramfs file for the kernel is now created.

Step 4: Now, when you boot normally, your machine starts without a kernel panic error.

Step 5: There might be a situation that occurs when you boot your system with a rescue image with creating a new initramfs file where you couldn’t make a new file because it was already present.

At this point, we need to create an initramfs image with the mkinitrd command or dracut command.

Step 5.1: Check your kernel version first using the uname -r command.

Step 5.2: Run the mkinitrd command with the --force option and your kernel specification:

#mkinitrd --force <initrd-Image> <Kernel-Version>

Your initramfs file is regenerated by these short steps, and you can now start your OS without any errors.

[ Free ebook: Manage your Linux environment for success ]

Wrapping up

Now, anytime you see a kernel panic error, you will definitely not panic because you know why this error occurred and how to resolve it. This article covers one of the common Linux boot problems: kernel panic. There are so many other potential boot problems that can occur in Linux, but resolving those issues will become much less of a panic when you gain some advanced knowledge of your system.

1 Question at a time per the FAQ

  1. What is kernel panic?
    When the kernel can’t load properly or «freaks out» and fails to boot properly or crashes(see edit credit at the bottom).

  2. Why it occurs?
    Hosed updates, failing hardware, unsupported hardware, failed or missing drive or partition (see edit credit at the bottom)

  3. How can I understand kernel panic occurred?
    Watch boot prompts(turn off quiet kernel parameter) OR your machine fails to boot

  4. What effect it has on system?
    Failure to boot or system crash

  5. Does it only occur in Linux?
    No, all unix-like operating systems can have kernel panics. It’s the equivalent of a Windows Blue Screen of Death

  6. How can I prevent it?
    It normally doesn’t happen. Test updates and troubleshoot the problem. Use stable instead of development branches.

Additional note: Kernel panic and system failure/shutdown can be directly responsible for protecting your computer from physical damage. Examples include halting before extreme overheating or disk corruption. See edit credits at the bottom for direct quote.

edits

Per B. Roland Missing or corrupted disks or volumes can cause this as well.
(Good point and I overlooked it)

Per Kees Kernel panic can also occur while running.
note: Can happen when a function fails sort of gracefully inside the kernel, but most often happens during module or kernel loading(which is usually during boot). I thought I touched on it at «during boot or system crash», but I see how my answer to (1) stated it only occurs during boot.

Per rafalcieslak direct quote — ‘There is one very important thing that must be added: The main point in the whole kernel panic is to protect your computer. The kernel freezes not only because it failed to do something, but also in order to prevent your computer from f.e. overheating, hard drives corruption, and any other hardware problems, that may occur, if some incorrect orders are executed, of a module (for example a module responsible for controlling the fan) failed to load, etc. This is why the kernel prefers to freeze, than to overcome the problem.’

The first time I saw a kernel panic I experienced a rollercoaster of emotions. First, of course, panic, then confusion, followed by a bit of laughter. Why is a computer panicking? It doesn’t have feelings. At any rate, I’m sure a lot of system administrators don’t approach a kernel panic with the same dose as humor that I would. It can be a serious and scary issue. So, let’s discuss what a kernel panic is and how to fix it.

What is a Kernel Panic?

The ‘kernel panic’ error code may not be the best-worded error code. It’s not clear what’s going on other than the computer is having an issue with the kernel. In fact, a kernel panic does not have much to do with the kernel typically. Let’s talk about the Linux boot process quickly so we can explain that.

How Does the Linux Boot Process Work?

The boot process for Linux occurs throughout multiple steps. When a computer first turns on, the BIOS or UEFI takes control. The job of the BIOS/UEFI is to enumerate the hardware, make sure everything on the computer is in working order, and then pass priority to the bootloader to startup the OS installed on the storage drives of that computer.

When the BIOS/UEFI passes priority to the bootloader, it calls the MBR, or master boot record. The MBR is a small partition at the beginning of the primary storage drive in a computer. Traditionally the MBR would contain the information and instructions for calling the files needed to start the OS.

That MBR partition is incredibly small, though. In the world of modern OSes, it is not large enough to hold the entire bootloader needed to start the OS. This is especially true with multi-OS environments.

Taking a quick detour, the most common bootloader for Linux today is Grub2. Most major Linux distributions have migrated to using Grub2 as their default bootloader. Grub2 is a Linux bootloader capable of working with various types of hardware (including non-x86 based architectures) and filesystems. It is too large to fit entirely into the MBR partitions because of that. So, when the MBR calls the Grub2 bootloader, it is instead calling another bit of information that holds the instructions to start Grub2 and not Grub2 itself.

When the MBR calls the Grub2 bootloader, it mounts a file called initrd or initramfs (depending on the Linux OS). That file is like a tiny virtual hard drive that contains enough files and information to start the rest of the boot loader process. When the initrd file is mounted, that file then mounts key system partitions like the root filesystem and the boot partition. The boot partition contains the Linux kernel. Once those partitions are mounted, the initrd file starts loading the Linux kernel and the rest of the OS. A kernel panic occurs because something goes wrong with this part of the boot process.

The TLDR Version of Why Kernel Panics Happen

When the initrd can’t mount the boot or root partitions, or the Linux kernel can’t load properly, this is when a kernel panic occurs. To boil it down a little more, a kernel panic can occur because:

  • The /boot or root file system can’t be mounted due to a file system issue or a corrupted initrd file issue.

  • The /boot or root filesystem changed locations and the initrd file can’t find them.

  • Patches or kernel modules were installed on a system but the initrd file wasn’t updated to reflect that properly.

  • Patches or kernel modules were installed that have an issue with the computer system.

How Do You Fix a Kernel Panic?

There are a lot of ways to fix a kernel panic. Those methods for fixing a kernel panic might change between various Linux distributions, too. So, it would be beyond the scope of this article to explain every possible way to resolve a kernel panic issue. Instead, we’ll discuss the overall process for triaging and fixing a kernel panic issue.

Fix 1: Did you install updates recently?

It’s easy to install updates in Linux and not fully realize everything that is updating. Linux updates may include new kernel images or updates to drivers that include new kernel modules or patches. If these updates don’t configure the Grub config files properly, that could cause a kernel panic issue.

First, pay close attention to Grub when it first loads. Many Linux distributions will keep the old kernel and create a new line in Grub to boot from it. Instead of booting from the new kernel, try booting your computer with the old kernel instead.

If that does not work, try booting from a live Linux environment. Most Linux distributions include a live environment on their install media. Make sure to use the same distribution you currently have installed on the computer.

Once you can boot into the OS, either through the live environment or through an old kernel, remake the Grub configuration files. That will re-create the configuration files for the current system with the kernels and configs currently installed. Make sure to mount the OS root and boot partitions before remaking the configuration files. Also, make sure to target the boot partition of the computer and not the live environment, too.

If remaking the Grub configuration files does not work, the Grub automated config file tool also includes flags to include all kernel modules for a system in the boot loader. By default, Grub will only include what the computer needs to get off the ground. Then the rest of the kernel and kernel modules are started with the rest of the boot process. You can opt to have the entire kernel and all kernel modules load with Grub, but that can make Grub bloated and less efficient. It is a good way to recover a Linux bootloader, though.

Once you have the OS booted properly again, remake the Grub configuration files one more time just to clean things up.

Fix 2: Is the storage drive working properly?

A kernel panic could be caused by the boot and root partitions not being available as well. This could happen for any number of reasons. For instance, a hardware upgrade might have messed something up, or a storage drive might be failing.

The recovery process is largely the same as above, but you’ll want to add a couple of steps. After you load a Linux live environment, mount the storage drive manually. After the storage drive is mounted, check its partitions to make sure they exist and are healthy. After that is confirmed, use tools to check the drive itself for issues or failures. Any drive utility capable of reading the SMART information for a drive should work.

If you are having an issue with a drive, make sure to backup any important information right away. If the storage drive is not experiencing catastrophic failure, it may be able to be cloned to a new, working storage drive to fix this issue.

The Last Resort

When all else fails, re-install the bootloader from scratch. If you haven’t installed any recent updates, there haven’t been any hardware upgrades, and the storage drives and partitions appear to be working, something may have happened with the bootloader itself. In this case, re-install the bootloader along with its configuration files.

Kernel Panics

A kernel panic occurs when the Linux kernel enters an unrecoverable failure state. The state typically originates from buggy hardware drivers resulting in the machine being deadlocked, non-responsive, and requiring a reboot. Just prior to deadlock, a diagnostic message is generated, consisting of: the machine state when the failure ocurred, a call trace leading to the kernel function that recognized the failure, and a listing of currently loaded modules. Thankfully, kernel panics don’t happen very often using mainline versions of the kernel—such as those supplied by the official repositories—but when they do happen, you need to know how to deal with them.

Note: Kernel panics are sometimes referred to as oops or kernel oops. While both panics and oops occur as the result of a failure state, an oops is more general in that it does not necessarily result in a deadlocked machine—sometimes the kernel can recover from an oops by killing the offending task and carrying on.

Tip: Pass the kernel parameter oops=panic at boot or write 1 to /proc/sys/kernel/panic_on_oops to force a recoverable oops to issue a panic instead. This is advisable is you are concerned about the small chance of system instability resulting from an oops recovery which may make future errors difficult to diagnose.

Examine panic message

If a kernel panic occurs very early in the boot process, you may see a message on the console containing «Kernel panic — not syncing:», but once Systemd is running, kernel messages will typically be captured and written to the system log. However, when a panic occurs, the diagnostic message output by the kernel is almost never written to the log file on disk because the machine deadlocks before system-journald gets the chance. Therefore, the only way to examine the panic message is to view it on the console as it happens (without resorting to setting up a kdump crashkernel). You can do this by booting with the following kernel parameters and attempting to reproduce the panic on tty1:

systemd.journald.forward_to_console=1 console=tty1

Tip: In the event that the panic message scrolls away too quickly to examine, try passing the kernel parameter pause_on_oops=seconds at boot.

Example scenario: bad module

It is possible to make a best guess as to what subsystem or module is causing the panic using the information in the diagnostic message. In this scenario, we have a panic on some imaginary machine during boot. Pay attention to the lines highlighted in bold:

kernel: BUG: unable to handle kernel NULL pointer dereference at (null) [1]
kernel: IP: fw_core_init+0x18/0x1000 [firewire_core] [2]
kernel: PGD 718d00067 
kernel: P4D 718d00067 
kernel: PUD 7b3611067 
kernel: PMD 0 
kernel: 
kernel: Oops: 0002 [#1] PREEMPT SMP
kernel: Modules linked in: firewire_core(+) crc_itu_t cfg80211 rfkill ipt_REJECT nf_reject_ipv4 nf_log_ipv4 nf_log_common xt_LOG nf_conntrack_ipv4 ... [3] 
kernel: CPU: 6 PID: 1438 Comm: modprobe Tainted: P           O    4.13.3-1-ARCH #1
kernel: Hardware name: Gigabyte Technology Co., Ltd. H97-D3H/H97-D3H-CF, BIOS F5 06/26/2014
kernel: task: ffff9c667abd9e00 task.stack: ffffb53b8db34000
kernel: RIP: 0010:fw_core_init+0x18/0x1000 [firewire_core]
kernel: RSP: 0018:ffffb53b8db37c68 EFLAGS: 00010246
kernel: RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
kernel: RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffffffc16d3af4
kernel: RBP: ffffb53b8db37c70 R08: 0000000000000000 R09: ffffffffae113e95
kernel: R10: ffffe93edfdb9680 R11: 0000000000000000 R12: ffffffffc16d9000
kernel: R13: ffff9c6729bf8f60 R14: ffffffffc16d5710 R15: ffff9c6736e55840
kernel: FS:  00007f301fc80b80(0000) GS:ffff9c675dd80000(0000) knlGS:0000000000000000
kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
kernel: CR2: 0000000000000000 CR3: 00000007c6456000 CR4: 00000000001406e0
kernel: Call Trace:
kernel:  do_one_initcall+0x50/0x190 [4]
kernel:  ? do_init_module+0x27/0x1f2
kernel:  do_init_module+0x5f/0x1f2
kernel:  load_module+0x23f3/0x2be0
kernel:  SYSC_init_module+0x16b/0x1a0
kernel:  ? SYSC_init_module+0x16b/0x1a0
kernel:  SyS_init_module+0xe/0x10
kernel:  entry_SYSCALL_64_fastpath+0x1a/0xa5
kernel: RIP: 0033:0x7f301f3a2a0a
kernel: RSP: 002b:00007ffcabbd1998 EFLAGS: 00000246 ORIG_RAX: 00000000000000af
kernel: RAX: ffffffffffffffda RBX: 0000000000c85a48 RCX: 00007f301f3a2a0a
kernel: RDX: 000000000041aada RSI: 000000000001a738 RDI: 00007f301e7eb010
kernel: RBP: 0000000000c8a520 R08: 0000000000000001 R09: 0000000000000085
kernel: R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000c79208
kernel: R13: 0000000000c8b4d8 R14: 00007f301e7fffff R15: 0000000000000030
kernel: Code: <c7> 04 25 00 00 00 00 01 00 00 00 bb f4 ff ff ff e8 73 43 9c ec 48 
kernel: RIP: fw_core_init+0x18/0x1000 [firewire_core] RSP: ffffb53b8db37c68
kernel: CR2: 0000000000000000
kernel: ---[ end trace 71f4306ea1238f17 ]---
kernel: Kernel panic - not syncing: Fatal exception [5]
kernel: Kernel Offset: 0x80000000 from 0xffffffff810000000 (relocation range: 0xffffffff800000000-0xfffffffffbffffffff
kernel: ---[ end Kernel panic - not syncing: Fatal exception
  • [1] Indicates the type of error that caused the panic. In this case it was a programmer bug.
  • [2] Indicates that the panic happened in a function called fw_core_init in module firewire_core.
  • [3] Indicates that firewire_core was the latest module to be loaded.
  • [4] Indicates that the function that called function fw_core_init was do_one_initcall.
  • [5] Indicates that this oops message is, in fact, a kernel panic and the system is now deadlocked.

We can surmise then, that the panic occurred during the initialization routine of module firewire_core as it was loaded. (We might assume then, that the machine’s firewire hardware is incompatible with this version of the firewire driver module due to a programmer error, and will have to wait for a new release.) In the meantime, the easiest way to get the machine running again is to prevent the module from being loaded. We can do this in one of two ways:

  • If the module is being loaded during the execution of the initramfs, reboot with the kernel parameter rd.blacklist=firewire_core.
  • Otherwise reboot with the kernel parameter module_blacklist=firewire_core.

Reboot into root shell and fix problem

You’ll need a root shell to make changes to the system so the panic no longer occurs. If the panic occurs on boot, there are several strategies to obtain a root shell before the machine deadlocks:

  • Reboot with the kernel parameter emergency, rd.emergency, or -b to receive a prompt to login just after the root filesystem is mounted and systemd is started.

Note: At this point, the root filesystem will be mounted read-only. Execute # mount -o remount,rw / to make changes.

  • Reboot with the kernel parameter rescue, rd.rescue, single, s, S, or 1 to receive a prompt to login just after local filesystems are mounted.
  • Reboot with the kernel parameter systemd.debug-shell=1 to obtain a very early root shell on tty9. Switch to it with by pressing Ctrl-Alt-F9.
  • Experiment by rebooting with different sets of kernel parameters to possibly disable the kernel feature that is causing the panic. Try the «old standbys» acpi=off and nolapic.

Tip: See Documentation/admin-guide/kernel-parameters.txt in the Linux kernel source tree for all options.

  • As a last resort, boot with the Arch Linux Installation CD and mount the root filesystem on /mnt then execute # arch-chroot /mnt.

Disable the service or program that is causing the panic, roll-back a faulty update, or fix a configuration problem.

What is kernel panic?

A kernel panic refers to a computer error from which the system’s operating system (OS) cannot quickly or easily recover. It occurs when there is a low-level fatal error and the operating system’s kernel is unable to fix it.

A kernel panic error stops the system to prevent corruption of the system’s software, hardware or memory. It helps preserve data and allows technicians to run a debugger to determine the problem.

The term applies primarily to Unix-based operating systems such as Linux and BSD, and also to Mac OS X. The kernel panic error is similar to the blue screen of death (BSOD) error in Windows-based systems.

More about kernel panic

A kernel panic results in a failure to boot. It is used by an OS kernel to alert users to a problem, and prevent further issues once detected. During a kernel panic, the OS writes the contents of the kernel memory — also known as a kernel dump — to the disk. It also stops all CPU operations. To restart operations, the OS reboots automatically or waits for the user to reboot manually. The action taken depends on the OS configuration.

kernel layout

Kernels bridge operating systems and hardware.

A kernel panic produces a message or set of messages on the computer display This message may include information about error type, code module running at the time of the error and loaded drives.

It also creates a log detailing what happened. This information means little to inexperienced end users, but it can help technicians and troubleshooting teams diagnose and resolve system problems.

Kernel panic vs. system crash

A kernel panic is not the same as a system crash, although both can be annoying and even cause serious issues for the end user. In a kernel panic, the kernel terminates abnormally. In a system crash, the kernel forcefully terminates a software execution after detecting an abnormal condition. The goal is to minimize data loss or corruption in the device.

Causes of kernel panic

Kernel panic can be triggered by an inappropriate attempt by the OS to access or write to memory, and can also be caused by software bugs or malware. Other common causes of a kernel panic include:

  • a bug in the kernel (i.e., in a driver that is part of the kernel);
  • failure or improper installation of random access memory (RAM) chips;
  • hard disk damage or data corruption;
  • defective or corrupted system file, processor or memory;
  • unsupported hardware;
  • failed or missing drives or partitions; and
  • incompatible device drivers.

In Linux systems, kernel panic may be due to:

  • corruption of the initramfs file that must load in RAM and point to the kernel (vmlinuz);
  • if the initramfs file is not created properly for the specified kernel;
  • if the kernel is not installed properly; and
  • if recent OS patches are flawed.

Kernel panic in Linux

A Linux kernel panic is a system boot issue that occurs when the kernel can’t load properly, and prevents the system from booting. It usually manifests as a black screen filled with code.

During a normal boot process, the kernel (vmlinuz) doesn’t load directly. Instead, the initramfs file loads in the RAM. The file then points to the kernel which then results in OS booting. However, if the initramfs file is corrupted or deleted, it results in kernel panic. Such corruptions can occur due to recent OS updates or patches.

On Linux systems, «kernel oops» refers to a serious error that the OS can’t handle. Even if the system continues to run, it may cause instability issues, and result in a full kernel panic. Not all kernel oops errors cause a kernel panic, although many do.

Kernel panic in macOS

Kernel panic in a Mac is due to a failure of the macOS kernel. It usually results in sudden system restarts or a display message that instructs the user to manually restart. If kernel panics happen frequently, they can disrupt user workflows, result in data loss, and even affect the health of the Mac system.

The most common reasons for kernel panic in a macOS are:

  • low RAM storage space resulting in system freezes and slowdowns;
  • outdated drivers or plugins;
  • corrupted hardware or software;
  • incompatible peripheral devices; and
  • system viruses.

How to troubleshoot kernel panic in macOS

There are many reasons and causes for kernel panic errors. Here are several ways to troubleshoot and resolve the problem:

Update software and drivers

Out-of-date or corrupt software versions can cause problems for Mac systems, including kernel panic. To avoid the error, update all software and drivers. The process is straightforward:

  • Navigate to the App Store
  • Check for updates available for the system by clicking on ‘Updates’
  • Install updates

Check crash reports

Mac crash reports can provide useful insights about kernel panic issues. To access these reports, navigate to Applications > Utilities and access the log viewer named Console. Crash reports are displayed in the console. They contain information about kernel panics, including causes. This information helps technicians start the troubleshooting process.

Remove third-party kernel extensions

Kernel extensions that facilitate communication between hardware and the Mac can also cause kernel panic. To remove suspicious external kexts, users should:

  • Open Terminal and type kextunload.
  • Identify the suspicious kexts to be removed.
  • Run the command: sudo kextunload /System/Library/Extensions/xxx, replacing xxx with the kext to be removed.
  • Press Enter, type authentication password, and press Enter again.

Free up disk space

Freeing up disk space can help ensure the smooth processing of multiple apps and operations. Users can free up space by manually inspecting files and software and removing the assets that are not being used. Removing unused processes can also free up space in the memory and minimize the possibility of kernel panics.

Replace the RAM

Kernel panic is essentially an indication of the system’s inability to execute some functions. This implies a lack of enough RAM or the presence of a malfunctioning RAM. Replacing the malfunctioned RAM can restore proper functioning and mitigate the risk of kernel panic.

Kernel panic in Windows

In Windows, kernel panic is typically characterized by the appearance of a BSOD error message stating that the system needs a restart. The error is usually caused by malfunctioning hardware or poorly optimized device drivers.

blue screen of death, BSOD

Windows blue screen of death

The steps to troubleshoot kernel panics in Windows are similar to the steps undertaken to troubleshoot kernel panics in Mac systems.

Kernel panic in Android

Although kernel panics are less probable in newer Android OS versions due to Android security updates and kernel optimizations, they can occur. Similar to other OSes, kernel panics in Android are usually hardware- or software-related. Other probable causes include faulty RAM, malfunctioning peripherals, plugins or programs. Updating to the latest Android version can help minimize the occurrence of kernel panics.

See also: Troubleshoot Linux kernel panic with the kdump crash tool, basic Linux commands for new Linux server administrators and how to troubleshoot when Windows 10 won’t update.

Понравилась статья? Поделить с друзьями:
  • Error jusched exe
  • Error juris транскрипция
  • Error juris перевод
  • Error junk at end of line first unrecognized character is
  • Error jump to case label fpermissive