LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Common problems explained: "kernel panic - not syncing", "unable to mount..." (http://www.linuxquestions.org/questions/linux-newbie-8/common-problems-explained-kernel-panic-not-syncing-unable-to-mount-420368/)

sundialsvcs 02-28-2006 02:49 PM

Common problems explained: "kernel panic - not syncing", "unable to mount..."
 
So you're trying to start Linux for the first time and ... wham! You get messages like:
  • Unable to mount root device.
  • Kernel panic - not syncing.
:eek: What do I do now? Oh, how I love Windows ... ;)

Here's the scoop ...

(1) The first part of the system that starts running is the "boot loader," usually grub. This is the program that loads Linux, and/or Windows if you so desire. (The "master boot record," or MBR, enables the computer to load grub.)

(2) The first thing that Grub needs to know is ... "where is the kernel?" It gets this from the /boot/grub/grub.conf file. The way that you specify the correct drive and partition in Grub is a little different from, like "(hd0,0)" what you use in ordinary Linux. The kernel will be in some file named "vmlinuz-..."

(3) Once Grub has loaded the kernel into memory, the first thing that the kernel needs to know is, "where is the root filesystem?" The root= parameter is passed to the kernel to provide this information. Notice that now you are talking "to Linux," and you identify devices "in Linux's terms," like "/dev/hda2".

(4) Given this information, Linux is going to try to mount the root filesystem ... prepare it for use. The most common mistake at this point is that you've specified the wrong device in step #3. Unfortunately, the message that results is rather nasty looking...

When Linux doesn't know how to proceed, as in this case, it says "kernel panic" and it stops. But, even then, it tries to go down gracefully. It tries to write anything to disk that hasn't been written out (an operation called "syncing", for some darn-fool reason), and if it succeeds in doing so it will say "not syncing." What's totally misleading about this message combination is that it implies, incorrectly, that the reason for the panic is "not syncing," when actually the reason for the panic will be found in the preceding few lines.

You might see the message, "tried to kill 'init'." That really means that a program called init died... which it is not allowed to ever do. init is a very special program in Linux... the first program created when the machine starts.

So, basically, when you get these messages on startup ... the situation is really a lot more dreadful looking than it actually is. You have probably just made a "tpyo" ;) when entering the information in grub.conf.

(Another common place to make a typo is in /etc/fstab, which tells Linux where all the other drives are.)

So what do you do? If you're doing a first-time install you can just start over. Otherwise, you need to boot a separate CD-ROM, which will give you a stand-alone Linux installation from which you can edit the offending files.

victorh 03-01-2006 11:25 AM

Thanks sundialsvcs, this info is really important when you have problems at booting. One comment, though:

Quote:

Originally Posted by sundialsvcs
The first thing that Grub needs to know is ... "where is the kernel?" It gets this from the /boot/grub/grub.conf file.

I think you want to refer to the file /boot/grub/menu.lst. At least this is the most common name in the distros I use.

On the other hand, the file grub.conf exists and it's located in /etc/grub.conf. The purpose of this file is to point out the filesystem and the directory where GRUB was installed and therefore where it can find the Stage2 files of GRUB. What do you think?

drakebasher 03-01-2006 01:17 PM

Quote:

Originally Posted by victorh
I think you want to refer to the file /boot/grub/menu.lst. At least this is the most common name in the distros I use.

On the other hand, the file grub.conf exists and it's located in /etc/grub.conf. The purpose of this file is to point out the filesystem and the directory where GRUB was installed and therefore where it can find the Stage2 files of GRUB. What do you think?

It does depend on distro. I think on some, menu.lst is a symlink to grub.conf, so it's the same. In Fedora,Debian and Gentoo, I've never paid attention to any menu.lst, I just go to grub.conf. The purpose of grub.conf is not to point to stage2: stage2 needs to load in order to display the menu, which of course is the bulk of grub.conf. Also, if you have a file /etc/grub.conf, it really needs to be a symlink to work at all. /etc/ is not a place that Grub looks to: I think Grub will search for stage2 in the root directory of the boot device, in /boot/, /grub/ and in /boot/grub/. grub.conf needs to be in the same directory as stage2. Keep in mind that until you make a menu selection, the directory /etc/ could be anywhere.


All times are GMT -5. The time now is 09:08 AM.