Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
KC13: I just installed a new kernel and it won't boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Frequently Asked Questions
View previous topic :: View next topic  
Author Message
wynn
Advocate
Advocate


Joined: 01 Apr 2005
Posts: 2421
Location: UK

PostPosted: Wed Sep 13, 2006 3:28 pm    Post subject: KC13: I just installed a new kernel and it won't boot Reply with quote

Navigation [Kernel Compilation] [Table of contents]

Changes:
25 Apr 2007: swapped SATA for >=2.6.19 and SATA for <=2.6.18 around so SATA for current kernels is found first; added table of contents; changed headings to color to make them easier to find.
10 Mar 2007: Noted (2.6.18 and earlier) that SCSI CD-ROM support is needed for optical drives.
22 Feb 2007: Noted that devices using the new PATA disk drivers are called /dev/sdX and that SATA and new PATA optical drives are called /dev/sr0, /dev/sr1 &c. and need SCSI CD-ROM support.
13 Feb 2007: A temporary note added about using genkernel with gentoo-sources-2.6.19-r5
10 Feb 2007: The 2.6.19 SATA section has been expanded to contain all the necessary settings
11 Jan 2007: Disk drivers must be compiled in for genkernel too. Added a third section to (1)SATA (2)PATA (3)>=kernel 2.6.19. Added back "Shell Game", genkernel now has a --disklabel" argument.
26 Oct 2006: replaced e2label by tune2fs; added reiserfs and jfs partition labelling; added fstab and grub.conf/lilo.conf to config and lspci in "Still not booting?"; removed "Shell Game", finding the root partition by a label needs initrd and special code.
25 Oct 2006: Changed second "Kernel panic" error message to filesystem message; changed "Kernel Panic" subheadings to include actual error message; added Installing Gentoo on VMWare; added the BIOS/kernel Shell Game with partition labelling.

Table of contents
  1. The boot loader fails to load the kernel
    1. Booting with GRUB
      • Error 15: File not found
      • Error 17: Cannot mount selected partition

    2. Booting with LILO

  2. Kernel panic — VFS error:
    1. Using genkernel from the LiveCD with the latest stable gentoo-sources
    2. SATA and new, experimental, PATA in kernels 2.6.19 and later
    3. Parallel ATA or plain old IDE
    4. SATA for kernels 2.6.18 and earlier

  3. The BIOS/kernel Shell Game
  4. Still not booting?

Symptoms
1) The boot loader fails to load the kernel
2) The kernel is loaded but stops with a message similar to
Code:
VFS Cannot open root device "sda3" or unknown-block(0,0)
or
Code:
No filesystem could mount root, tried: reiserfs squashfs vfat iso9660 jfs


1) The boot loader fails to load the kernel

Booting with GRUB

Some of the frequent ones (for more detail, see the "Grub Error Collection"):

Error 15: File not found

There are three things which have to be aligned for GRUB to find the kernel:
    (1) root (hdX,Y)
    (2) the path to the kernel and
    (3) the kernel filename

If you do not have a boot partition then, in your grub.conf, you have something like
Code:
title=Gentoo Linux 2.6.17-r4
root (hd0,0)
kernel /boot/kernel-2.6.17-gentoo-r4 root=/dev/sda1

and (1) is hd0,0 (2) is /boot/ and (3) kernel-2.6.17-gentoo-r4 and your root partition is on /dev/sda1 which should be the same as (hd0,0).

If you do have a boot partition then, in your grub.conf, you will have something like
Code:
title=Gentoo Linux 2.6.17-r4
root (hd0,0)
kernel /kernel-2.6.17-gentoo-r4 root=/dev/sda3

and (1) is hd0,0 (2) is / and (3) kernel-2.6.17-gentoo-r4; your boot partition is on (hd0,0) (whatever that is) and your root partition is on /dev/sda3

The main difference between having a boot partition and not is: with a boot partition the path is simply "/", without a boot partition it is "/boot/".

However, the usual GRUB installation has a symlink
Code:
 lrwxrwxrwx  1 root root       1 Sep  9 11:56 boot -> ./
in /boot so, if you have a boot partition but you put "/boot/kernel-2.6.17-gentoo-r4" in your grub.conf, it will still work because "/boot/kernel..." will be turned into "/./kernel..." which is OK.

If, having checked this, you are really, really sure you have got it right and GRUB is wrong you can:
    1) Reboot
    2) If you have "hiddenmenu" in your grub.conf, press any key when the splash screen appears and then
    3) press "c" to get a grub command line
    4) type in "find" followed by the path and kernel name: using the first example above
    Code:
    find /boot/kernel-2.6.17-gentoo-r4

if it finds it, grub will then show you the partition(s) where it occurs and you can check that your (hdX,Y) is correct.

If grub doesn't find it, you have got either the path or the kernel name wrong and grub has won.

You can also use tab-completion: if you have forgotten the kernel image filename and you do have a boot partition you can do this:
Code:
grub> root (hd0,0)
grub> kernel /<press tab>
or, if you do not have a boot partition
Code:
grub> root (hd0,0)
grub> kernel /boot/<press tab>


Time to check:
  • if you do have a boot partition
    • Does it contain a kernel?
    • Does that kernel have the name you have put in grub.conf?
    • Have you forgotten to mount the boot partition before saving the kernel? If so, it will be in the root partition at /boot/<kernel name>

  • If you do not have a boot partition
    • Does the /boot directory on your root partition contain a kernel?
    • Does that kernel have the name you have put in grub.conf?

There is further advice in the "Grub Error Collection".

Error 17 : Cannot mount selected partition

grub can't recognize the type of the partition you have selected with root (hdX,Y). This usually means that you have got (hdX,Y) wrong but if you have a Reiser4 filesystem on the partition containing the kernel then (standard, unpatched 0.96) grub doesn't grok Reiser4.

Resources:
For an exhaustive list see the Grub Error Collection
GRUB stage 1.5, HighPoint workaround https://forums.gentoo.org/viewtopic-p-3217132.html#3217132

Booting with LILO

Common Errors

L followed by 9A 9A 9A 9A ...: can't find second stage: make sure you have the correct boot device, for instance, /dev/hda is the MBR but lilo.conf has the line "boot=/dev/hda2". Check the "boot=" line in lilo.conf.

L followed by 99: invalid second stage: bad map file or a very old BIOS — read LiloNotes (URL in Resources) for guidance.

Invalid compressed format: probably caused by installing a new version of the kernel and not running the map installer (/sbin/lilo) before rebooting. LILO's map (/boot/map usually) has the blocks where the kernel images are stored. If the image is changed, the blocks used by the old image are marked unused and one or more have been used for another file. Thus the old image (which LILO is trying to load) is corrupt. Solution: rerun /sbin/lilo.

CRC error: see "Invalid compressed format".

Resources
LiloErrorCodes
LiloNotes
/usr/share/doc/lilo-22.7/README.common.problems.gz

2) Kernel panic — VFS error:

For the kernel, after it has been booted, to mount the root filesystem, it must have the correct IDE/SATA drivers and support for the root filesystem — both the drivers and filesystem support must be builtin, not modules: if they are not there or not builtin it cannot continue.

One unusual reason for this error is not having support for MSDOS partition tables compiled in. So, check the kernel configuration using "make menuconfig"
Code:
   File systems  --->
   Partition Types  --->
[*] Advanced partition selection
[*]   PC BIOS (MSDOS partition tables) support
change it if necessary and recompile (see "Resources" below for kernel compiling)

If the error message is No filesystem could mount root, : check that the kernel has built in support for the root filesystem

To configure the kernel for the root filesystem (these settings are all under "File systems" in the kernel configuration)
Code:
For this       configure
root fs        this
ext2       <*> Second extended fs support
ext3       <*> Ext3 journalling file system support
reiserfs   <*> Reiserfs support
jfs        <*> JFS filesystem support
xfs        <*> XFS filesystem support
For reiserfs you will also need to emerge sys-fs/reiserfsprogs, for jfs you will need to emerge sys-fs/jfsutils and for xfs you will need sys-fs/xfsprogs.

If the error message is VFS: Cannot open root device "nnn" or unknown-block(maj,min) check that the kernel has built in support for the hard disk type (parallel ATA or SATA)

Note: you must have the high level and low level chipset drivers for your motherboard compiled in to the kernel for the kernel to be able to access the drive or drives, read the partition table, set DMA &c.

This goes for kernels compiled using genkernel too.

Temporary Note
  • Using genkernel from the LiveCD with the latest stable gentoo-sources
    The x86 handbook recommends copying over the LiveCD kernel configuration for genkernel to use.

    When compiling gentoo-sources-2.6.19-r5 using this method, the .config file that genkernel ends up using has no support for SATA.

    If you have a SATA hard drive or optical drive, you will have to run
    Code:
    genkernel --menuconfig all
    instead and use the information below [ 3) SATA in kernels 2.6.19] to add SATA support.

    This is only temporary — when 2007.1 comes out, the LiveCD configuration will be compatible with 2.6.19.
End of Temporary Note

If you have both IDE (aka PATA) and SATA drives then the drivers for both should be compiled in to the kernel if you want them to work properly.

If you are installing Gentoo on VMWare, check the kernel configuration requirements (particularly block device support) in HOWTO Install Gentoo on VMware in Windows NT/2K/XP.

Otherwise, running lspci and looking at the lines which have "IDE", "Serial ATA" or "SATA" in them will give you the words to look for in the kernel configuration options.

SATA and new, experimental, PATA in kernels 2.6.19 and later

You need
Code:
   Device Drivers  --->
   SCSI device support  --->
<*> SCSI disk support
<*> SCSI CDROM support
but you don't need anything under
Code:
SCSI low-level drivers  --->

In the 2.6.19 kernel the SATA drivers are in a new section under "Device Drivers"
Code:
   Device Drivers  --->
   Serial ATA (prod) and Parallel ATA (experimental) drivers  --->
The SATA chipset drivers are now found under this heading together with experimental versions of some of the existing PATA chipset drivers.

You need to select "ATA device support" and one or more of the SATA drivers, here is the 2.6.19 list for reference
Code:
<*> ATA device support
< >   AHCI SATA support
< >   ServerWorks Frodo / Apple K2 SATA support
< >   Intel PIIX/ICH SATA support
< >   Marvell SATA support (HIGHLY EXPERIMENTAL)
< >   NVIDIA SATA support
< >   Pacific Digital ADMA support
< >   Pacific Digital SATA QStor support
< >   Promise SATA TX2/TX4 support
< >   Promise SATA SX4 support
< >   Silicon Image SATA support
< >   Silicon Image 3124/3132 SATA support
< >   SiS 964/180 SATA support
< >   ULi Electronics SATA support
< >   VIA SATA support
< >   VITESSE VSC-7174 / INTEL 31244 SATA support
This may change, of course, in later kernels.

You can try the experimental PATA drivers (all the driver names are prefixed with pata_ in a similar fashion to the SATA driver names which makes picking them out of a (future) LiveCD lsmod listing that much easier) but you should be prepared to go back to the old ones if they don't work — save the old .config with the old PATA driver selection(s), remove the old PATA driver selection(s) and select the corresponding new one(s), try it — :D / :cry:

Note that if the new PATA drivers are in use, PATA disks will be named in the same way as SATA disks and optical drives will be named /dev/sr0, /dev/sr1 and so on.

SATA optical drives and optical drives using the new PATA drivers need SCSI CD-ROM support.

Parallel ATA or plain old IDE

These are the high level drivers you will need
Code:
   Device Drivers  --->
    ATA/ATAPI/MFM/RLL support  --->
<*> ATA/ATAPI/MFM/RLL support
<*>   Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
<*>     Include IDE/ATA-2 DISK support
[*]     Use multi-mode by default
<*>     Include IDE/ATAPI CDROM support
<*>     generic/default IDE chipset support
[*]     CMD640 chipset bugfix/support
[*]     PCI IDE chipset support
[*]       Sharing PCI IDE interrupts support
<*>       Generic PCI IDE Chipset Support
<*>       RZ1000 chipset bugfix/support
[*]       Generic PCI bus-master DMA support
[*]         Use PCI DMA by default when available
The low level drivers are listed following the last line above, starting with
Code:
< >         AEC62XX chipset support
< >         ALI M15x3 chipset support
< >         AMD and nVidia IDE support
...
Note:
Code:
< >         Intel PIIXn chipsets support
is for both Intel PIIX and ICH chips.

You will need to select the one which matches your chipset (lspci should give you a clue), make it built in and recompile your kernel.

SATA for kernels 2.6.18 and earlier

First you do not want
Code:
   Device Drivers  --->
    ATA/ATAPI/MFM/RLL support  --->
[ ]     Support for SATA (deprecated; conflicts with libata SATA driver)
What you need is this high level support (SCSI CDROM support is needed for optical drives, if you have one)
Code:
   Device Drivers  --->
   SCSI device support  --->
<*>   SCSI disk support
<M> SCSI CDROM support
    SCSI low-level drivers  --->
<*> Serial ATA (SATA) support
and one of more of these low level drivers
Code:
< > 3ware 9xxx SATA-RAID support
< >   AHCI SATA support
< >   ServerWorks Frodo / Apple K2 SATA support
< >   Intel PIIX/ICH SATA support
< >   Marvell SATA support (HIGHLY EXPERIMENTAL)
< >   NVIDIA SATA support
< >   Pacific Digital ADMA support
< >   Pacific Digital SATA QStor support
< >   Promise SATA TX2/TX4 support
< >   Promise SATA SX4 support
< >   Silicon Image SATA support
< >   Silicon Image 3124/3132 SATA support
< >   SiS 964/180 SATA support
< >   ULi Electronics SATA support
< >   VIA SATA support
< >   VITESSE VSC-7174 / INTEL 31244 SATA support
You will need to select the one which matches your chipset (lspci should give you a clue), make it builtin and recompile your kernel.

3) The BIOS/kernel Shell Game

If you have checked and the correct high level and chipset drivers are already built in to your kernel, it may be that the BIOS or the kernel is playing a shell game with the drive designations.

Note: You will need to compile your kernel using genkernel and give it the argument "--disklabel" on the command line for the method described below to work. Make sure that the version you have installed has it (>=3.4.5 does) by
Code:
genkernel --help
It is towards the end of the initialization section in the help output.

You can refer to your root filesystem by label or UUID rather than by device name; if the device names get changed, this a way to still be able to find it.

Suppose you have the following partitions
Code:
/dev/sda1       /boot   ext2
/dev/sda2       none    swap
/dev/sda3       /       ext3
and grub.conf is
Code:
default 0
timeout 10

title=Gentoo Linux 2.6.17-r5
root (hd0,0)
kernel /kernel-2.6.17-gentoo-r5 root=/dev/sda3
You can give sda3 a name by (ext2/ext3 — up to 16 characters)
Code:
tune2fs -L 2006.1-root /dev/sda3
(xfs — up to 12 characters)
Code:
xfs_admin -L 2006.1-root /dev/sda3
(reiserfs — 16 characters)
Code:
reiserfstune -l 2006.1-root /dev/sda3
(jfs — 16 characters)
Code:
jfs_tune -L 2006.1-root /dev/sda3

You can also give the swap partition a name using
Code:
mkswap -Lswap0 /dev/sda2
The kernel line in grub.conf would change to
Code:
kernel /kernel-2.6.17-gentoo-r5 root=LABEL=2006.1-root
It would probably be a good idea to use labels in fstab as well: if the original fstab was
Code:
/dev/sda1       /boot   ext2 defaults 1 2
/dev/sda2       none    swap sw   0 0
/dev/sda3       /       ext3 defaults 1 1
then, if boot was given the name "2006.1-boot", the new one would be
Code:
LABEL=2006.1-boot       /boot   ext2 defaults 1 2
LABEL=swap0             none    swap sw       0 0
LABEL=2006.1-root       /       ext3 defaults 1 1
The equivalent lilo.conf to the above grub.conf would be
Code:
boot=/dev/sda
prompt
timeout=50
default=Gentoo

image=/boot/kernel-2.6.17-gentoo-r5
  label=Gentoo
  read-only
  root="LABEL=2006.1-root"


Resources:
KC11: Kernel compiling for the beginner.
HARDWARE SATA

4) Still not booting?

If this still doesn't help then you will need to boot up the liveCD and then post part of your kernel configuration file
(/usr/src/linux/.config) — just

# Block devices
# ATA/ATAPI/MFM/RLL support
# IDE chipset support/bugfixes
# SCSI device support
# SCSI support type (disk, tape, CD-ROM)
# SCSI low-level drivers
# File systems
but including the settings which have been commented out as the evidence of an omitted configuration can also be a vital clue.

Also post the output of lspci, /etc/fstab and your grub.conf/lilo.conf.
_________________
The avatar is jorma, a "duck" from "Elephants Dream": the film and all the production materials have been made available under a Creative Commons Attribution 2.5 License, see orange.blender.org for details.


Last edited by wynn on Wed Apr 25, 2007 3:23 pm; edited 19 times in total
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Thu Jan 11, 2007 12:41 pm    Post subject: Reply with quote

Please post comments to [FAQ] KC13: I just installed a new kernel and it won't boot

Thanks for the great FAQ, wynn, much appreciated :)
_________________
KDE
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Frequently Asked Questions All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum