Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I configured a gentoo kernel (kernel-2.6.36-gentoo-r5), but when I boot it can't mount /dev/sda1:

ALERT! /dev/sda1 does not exist . Dropping to a shell .

I use the shell to go to the /dev directory, and I find that it have no sda* or hd* files. However, when I boot into my Debian kernel (vmlinuz-2.6.32-5-686), it can find and mount the /dev/sda1 partition.

What's the problem? How can I fix it? I didn't add any module names to /etc/modules.autoload.d/kernel-2.6 file to let them auto-load during boot -- is that the cause of the problem?

share|improve this question

migrated from stackoverflow.com Mar 1 '11 at 16:13

This question came from our site for professional and enthusiast programmers.

    
Could you please clarify - did you receive these errors when attempting to boot the new kernel or when attempting to compile the kernel? If the latter, was the compilation performed from within a running system or from an alternate environment such as a live cd? –  Tok Dec 7 '10 at 14:05
    
@Tok: obvious enough he got that when booting the new kernel. –  alex Dec 7 '10 at 14:24
1  
@pusp: Does your system normally uses initrd when booting the kernel? If so, you probably need to rebuild that too. –  alex Dec 7 '10 at 14:25
2  
What do you have set for root=UUID=? I don't know if the UUID is being truncated or if it's set to /. –  jonescb Feb 18 '11 at 14:10
    
Did you build your kernel with SCSI and libata support or as a module? Do you use an initrd? Does that initrd load the modules? –  jsbillings Mar 1 '11 at 16:46

5 Answers 5

For first-time Gentoo users, I strongly suggest using genkernel instead of plain make menuconfig. By default, genkernel will include all drivers it thinks is required.

If you have the time, re-run genkernel and gradually reduce the drivers you don't need, edit grub.conf, and reboot. Keep reducing. Note the settings (get the .config file).

In my case, I chose to do a re-installation, this time use the .config file and go straight to make. Not necessary, but I just dislike having many half-baked kernels lying around, plus some (possibly irrational) dislike of having to boot initrd.

(Well, at least that's how * I * did it. Takes time, but ultimately satisfying :-) )

share|improve this answer
    
yep, but reinstallation is not required. Also, you might like --menuconfig switch. –  rvs Mar 10 '11 at 14:48
    
yeah, I know it's not strictly required. But for some reasons I just dislike having to go through initrd when one can directly boot the kernel. Personal preference, I guess. I'll edit my answer. –  pepoluan Mar 10 '11 at 16:39

You need to make sure that you select the correct SATA drivers while configuring your kernel. I don't know what your hardware is, so you'll need to find out for yourself which drivers will work for you.

I always build the SATA drivers into the kernel rather than as a module, it's just easier to deal with.

share|improve this answer

You don't have some driver required to access your root device. SATA, perhaps, or one of the SCSI modules used by that. Either you didn't build the driver, or you didn't put it in your initrd.

share|improve this answer
    
Q: Are we supposed to build the driver even when we don't touch the default configurations at all (assuming the kernel is the latest from kernel.org)? –  TheIndependentAquarius Jan 19 '12 at 10:09
    
@Anisha: yes. The default config does not enable all drivers. –  mattdm Jan 19 '12 at 11:49

You don't mention precisely how you rebuilt the kernel. This is a fairly complex process, and you should follow your distribution's recommendation. In fact, you should use your distribution's kernel unless you need some feature (such as a more recent set of drivers to support your hardware) that's not available precompiled.

There are two common pitfalls, either of which could cause the symptoms you observe.

  • Maybe you forgot to compile a necessary driver. Kernel configuration is an arduous process, and it's easy to forget a crucial setting. In particular, make sure you have included the drivers necessary to reach your root filesystem: disk controller, partition scheme, filesystem, and if relevant volume management. Either these drivers must be built into the kernel (i.e. not modules), or you must have an initrd (in which case the initrd driver and the relevant filesystem must be built-in). Starting with your distribution's .config and changing only what you must is recommended.
  • If you use an initrd, maybe you forgot to regenerate it, or to install it, or to tell your bootloader about it.
share|improve this answer

Running make && make modules_install && make install should not only build the kernel but install the kernel image (bzImage) and copy it to /boot/, create an initrd, and create a grub entry for both.

If this is not the command(s) and/or syntax that you were using I recommend attempting this process. If this is the process that you followed I recommend rebuilding your initrd with mkinitrd and verifying that the root device in the grub configuration accurately represents the system configuration.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.