Linux is a very reliable system that rules the server universe worldwide. It is fast, secure, and the way it is built makes it ideal for many environments in many parts of the world. However, it is not perfect and can be flawed in many ways, causing more than one headache for professionals in the field. Today, in this post, we will talk about a kernel panic that can ruin your day. We will talk about How to solve kernel panic not syncing error. Let’s go for it.
What is a kernel panic?
For an operating system to work efficiently, it must be synchronized with the various system units. If this does not happen, then there could be system crashes, which could lead to data loss and more severe damage. Kernel Panic is one such crash that occurs at the kernel level.
In short, a kernel panic is a serious boot-level error that is then displayed by the system. An indispensable aspect of this type of error is that the system cannot fix it by itself, preventing the system from booting. Although it provides a message explaining what it is, the reality is that these often work only for a kernel developer.
The kernel panic was introduced in an early version of Unix and hence Linux, and the basic premise is that hardware and software must work correctly. When the software or hardware fails, it results in an error that interrupts the startup of the system.
To be a bit more specific, the truth is that many error conditions can cause a kernel panic, including kernel code that attempts to access invalid memory.
Microsoft Windows users are typically familiar with the BSoD (blue screen of death) and a Kernel Panic is the Unix equivalent of this. Whereas in Windows or Unix, the system cannot continue its normal boot.
Although they are very common, the reality is that there is no specific reason for them. This means that it is not always easy to find a solution to this problem. However, the community support and the experiences gained to make it possible to find solutions.
What can cause a kernel panic?
Although it is not always easy to know the reasons why a kernel panic happens, it is possible to determine some causes.
- They can occur when the initramfs image is corrupted. This file is used during boot, so it is vital for the system, and if something happens to it, it will cause a kernel panic.
- An improper attempt by the operating system to read or write memory.
- Improper installation of RAM chips.
- A hardware issue could also cause a kernel panic. One of the possible causes of this is the missing driver needed in the kernel.
- Malware or software bugs
- Data corruption
- Damage to the hard disk or motherboard.
- When trying to read an invalid or disallowed memory address.
It is even possible to get a kernel panic due to faulty updates or corrupted packages.
Another common cause of a kernel panic is when the kernel has incompatibility flaws or has not been properly installed. This can happen when the compilation of the kernel has not been done properly. This happens when we want to compile the kernel source code ourselves.
What does not syncing mean in kernel panic?
As we have been explaining, a Kernel Panic can happen for many reasons. Specifically, the “not syncing” error happens when, at boot time, a serious error is encountered. That is, it happens as soon as the operating system is loaded from the grub. When this happens, there is not much we can do from the system as such.
The origin of this specific error may be due to hardware configuration problems. We have to remember that the kernel is the part of the system that takes care of the hardware management by the drivers that the rest of the system will take advantage of.
A frequent cause is when there is a power failure and the computer has been incorrectly disconnected, causing damage to either hardware or a boot file.
Another less common cause is that some hardware driver has been updated, and the new instructions are not properly supported by the kernel.
But in short, we are talking about a boot-time error. This makes it impossible to mount the system volumes, and therefore we have to resort to third-party solutions.
How can kernel panic issues be resolved?
The solution to a kernel panic is very varied because it will depend on some of the factors that have caused it.
In most of these cases, it is necessary to have a rescue image of the system. The LIVE image of the system will allow us to have the same system but from a live session.
For cases where the error is a kernel panic not syncing, a possible solution is as follows.
When booting the system, instead of choosing the usual option to boot the system, you have to choose the *Advanced option for* to enter the recovery mode of the system.
Once the system has booted into recovery mode, open a terminal and edit the /etc/selinux/config file with a text editor. For example, using nano
nano /etc/selinux/config
And then add this to the end of the file
SELINUX=enforcing
Save the changes by pressing CTRL + O and close the editor by pressing CTRL + X.
After this, reboot the operating system.
reboot
Another possible solution to the Kernel panic not syncing fatal exception error
In this case, it is likely that the error is caused by initramfs. This could be because the file is either missing or corrupted.
The causes of missing or corrupted files are very varied, but in this case, what we have to do is to replace it with another one that is correct.
To achieve this, access as in the previous step to the system recovery mode. Once the system has loaded, you can use the dracut utility to generate a new one. But first, back up the old one.
cp -p /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
And now if you generate a new initramfs with the command
dracut –f
Finally, reboot the system.
How to Fix kernel panic not syncing vfs: Unable to mount root Error
This type of kernel panic occurs when the system fails to mount the root file system. A possible workaround is as follows
Restart your computer in recovery mode or safe mode and when you get access to it, run the following command
sudo update-initramfs -u -k <kernel-version>
You have to replace <kernel-version> with the exact version of your kernel.
Then you have to run
sudo update-grub
This last command updates the entire bootloader. Finally, reboot the system.
Kernel panic not syncing no init found
In this case, we are talking about a bad installation because of the ISO image. Because the kernel is unable to mount the file system, it is because the image has been created incorrectly, and therefore the installation has been faulty.
In this case, there is nothing to do but reinstall the system and make sure that the image is well recorded. In addition to this, once the image has been downloaded, it is advisable to check its integrity.
How do you stop kernel panic?
Although we are not 100% free from suffering a kernel panic at some point, there are a few things we can do to minimize the risks:
- Do not touch any key system files, not even out of curiosity. Also, avoid installing applications that require special permissions.
- Take care of the hardware by avoiding violent, unforced shutdowns.
- Update the kernel frequently through software distribution channels.
- Avoid using kernels compiled by third parties. Since the configurations they may use will not always be compatible with ours.
- Along with the kernel, it is also a good idea to update GRUB frequently but always from the official repositories.
In addition to these recommendations, always keep an eye on your hardware and its performance to avoid any bad surprises.
How to resolve Kernel Panic Not Syncing on Mac?
macOS is a very reliable system, and this is one of the main reasons for its success. However, a kernel panic can occur from time to time. So, you are likely to see a message with the following, “You need to restart your computer. Press and hold the power button for several seconds, or press the Restart button”.
If you see it, and the system lets you reboot, you may never see the error again as stated in Apple’s documentation.
If it happens repeatedly, the device may be faulty, and you need to send it to technical support.
Lastly, there are third-party applications that can help you perform software maintenance to prevent this from happening again.
Conclusion
Linux is an incredibly stable system and that is why it dominates the server environment and more and more people use it as a working operating system. However, this does not make it bug-free. And one of the well-known ones is the kernel panic.
Throughout this post, we have developed the topic enough so that you have a clear idea about its causes, how to remedy it, and even take precautions so that you don’t have to deal with it.