LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   the linux can't boot after compile a new kernel (https://www.linuxquestions.org/questions/linux-newbie-8/the-linux-cant-boot-after-compile-a-new-kernel-855745/)

aaaaatoz 01-12-2011 12:17 AM

the linux can't boot after compile a new kernel
 
Hi,all:
I am a newbie and studying the kernel. I installed a fedora with kernel 2.6.15-1 (quite old, isn't it ?) on my vmware workstation and try to compile a new kernel with 2.6.15.2 just for testing.
I download the kernel and compile with that:
make menuconfig
make modules-install install

then I reboot the server
but if i choose the new kernel. the system poped up the error msg like :
Unable to find device-mapper major/Minor
No volume groups found
unable to find volume group "VolGroup00"
Unable to access resume devices (/dev/VolGroup00/Logvol01)
mount: could not find filesystem '/dev/root'

=======
yes. I am using LVM to setup the fedora.

i search online and find some possible causes:
1) the .config does not contain support for LVM.
then i choose to enclude the support for LVM

2) need to re-create initrd
i use commond initrd --force-lvm-probe to generate the .img file

But both the method do not work.

and i notices that the new '2.6.15.2.img' is about 1.5M which is smaller than the current 2.6.15.1 img (1.7M)

how can i check the problem ?

thanks

markush 01-12-2011 03:48 AM

Hi aaaaatoz, welcome to LQ,

this cannot work (in most cases) and this has nothing to do with LVM.

If you download the kernelsources, there is a default .config file which is not adapted to your computer. You need a .config file for your computer in order to build a kernel which supports your hardware.

One way to achieve this is to copy the .config file from the kernel sources of your 2.6.15.1 kernel to the sources of the new kernel. Then run
Code:

make oldconfig
this command builds a new .config with all the configurations from the old kernel and asks you for features which differ between the old/new kernel.

I'd recommend to build this kernel and try it out (if you need an initrd you'll have to create a new one).

If the new kernel works, you may change the configuration, for example add the LVM.

Markus

sevs 01-12-2011 07:04 AM

Hey, how about intial ram disk? As i see you did it but have choosed a version of your new kernel when creating initrd?

aaaaatoz 01-12-2011 04:18 PM

Quote:

Originally Posted by sevs (Post 4221593)
Hey, how about intial ram disk? As i see you did it but have choosed a version of your new kernel when creating initrd?


I did it by initrd --force-lvm-probe newversion.img newversion

aaaaatoz 01-12-2011 04:23 PM

Quote:

Originally Posted by markush (Post 4221443)
Hi aaaaatoz, welcome to LQ,

this cannot work (in most cases) and this has nothing to do with LVM.

If you download the kernelsources, there is a default .config file which is not adapted to your computer. You need a .config file for your computer in order to build a kernel which supports your hardware.

One way to achieve this is to copy the .config file from the kernel sources of your 2.6.15.1 kernel to the sources of the new kernel. Then run
Code:

make oldconfig
this command builds a new .config with all the configurations from the old kernel and asks you for features which differ between the old/new kernel.

I'd recommend to build this kernel and try it out (if you need an initrd you'll have to create a new one).

If the new kernel works, you may change the configuration, for example add the LVM.

Markus


thanks, i will do it soon

aaaaatoz 01-12-2011 04:49 PM

Quote:

Originally Posted by markush (Post 4221443)
Hi aaaaatoz, welcome to LQ,

this cannot work (in most cases) and this has nothing to do with LVM.

If you download the kernelsources, there is a default .config file which is not adapted to your computer. You need a .config file for your computer in order to build a kernel which supports your hardware.

One way to achieve this is to copy the .config file from the kernel sources of your 2.6.15.1 kernel to the sources of the new kernel. Then run
Code:

make oldconfig
this command builds a new .config with all the configurations from the old kernel and asks you for features which differ between the old/new kernel.

I'd recommend to build this kernel and try it out (if you need an initrd you'll have to create a new one).

If the new kernel works, you may change the configuration, for example add the LVM.

Markus

just wondering where is the location of the 'old' .config. how does linux remember the oldconfig ? is it referred to the current config. eg.if i downloaded and configured several kernels, how linux know which is the so-called old one ?

thanks in advance!

markush 01-12-2011 04:58 PM

As I wrote, you'll have to copy the .config file of the old kernel into the sourcedirectory of the new one. Then the command "make oldconfig" creates a new .config with the additional kernelfeatures, i.e. the features wich have been added to the kernel since the release of the old one.

Markus

aaaaatoz 01-12-2011 05:05 PM

Quote:

Originally Posted by markush (Post 4222245)
As I wrote, you'll have to copy the .config file of the old kernel into the sourcedirectory of the new one. Then the command "make oldconfig" creates a new .config with the additional kernelfeatures, i.e. the features wich have been added to the kernel since the release of the old one.

Markus

thanks Markus.

as a newbie, still confused about where is the location of the current kernel's .config file.
I am using fedora and even try to use find / -name ".config" command, i can't find the .config files of current linux.
is it kept after installation ?

markush 01-12-2011 05:17 PM

I use to store a copy of .config in my /boot directory. Normaly you should find a config file there.
Otherwise the kernel sources are in /usr/src/linux-2.6.??.? and you'll find the .config file there. Be sure to use the ls command with the -a option in order to list also the files with a dot "." as their first character, dot-files are hidden normaly. As an example here the output of ls -a from my kernelsources:
Code:

..
..tmp_kallsyms1.o.cmd
..tmp_kallsyms2.o.cmd
..tmp_kallsyms3.o.cmd
..tmp_vmlinux1.cmd
..tmp_vmlinux2.cmd
..tmp_vmlinux3.cmd
.config
.config.old
.gitignore
.mailmap
.missing-syscalls.d
.tmp_System.map
.tmp_kallsyms1.S
.tmp_kallsyms1.o
.tmp_kallsyms2.S
.tmp_kallsyms2.o
.tmp_kallsyms3.S
.tmp_kallsyms3.o
.tmp_versions
.tmp_vmlinux1
.tmp_vmlinux2
.tmp_vmlinux3
.version
.vmlinux.cmd
.vmlinux.o.cmd
COPYING
CREDITS
Documentation
Kbuild
MAINTAINERS
Makefile
Module.symvers
README
REPORTING-BUGS
System.map
arch
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
modules.builtin
modules.order
net
samples
scripts
security
sound
tools
usr
virt
vmlinux
vmlinux.o

Markus

aaaaatoz 01-12-2011 05:43 PM

Quote:

Originally Posted by markush (Post 4222265)
I use to store a copy of .config in my /boot directory. Normaly you should find a config file there.
Otherwise the kernel sources are in /usr/src/linux-2.6.??.? and you'll find the .config file there. Be sure to use the ls command with the -a option in order to list also the files with a dot "." as their first character, dot-files are hidden normaly. As an example here the output of ls -a from my kernelsources:
Code:

..
..tmp_kallsyms1.o.cmd
..tmp_kallsyms2.o.cmd
..tmp_kallsyms3.o.cmd
..tmp_vmlinux1.cmd
..tmp_vmlinux2.cmd
..tmp_vmlinux3.cmd
.config
.config.old
.gitignore
.mailmap
.missing-syscalls.d
.tmp_System.map
.tmp_kallsyms1.S
.tmp_kallsyms1.o
.tmp_kallsyms2.S
.tmp_kallsyms2.o
.tmp_kallsyms3.S
.tmp_kallsyms3.o
.tmp_versions
.tmp_vmlinux1
.tmp_vmlinux2
.tmp_vmlinux3
.version
.vmlinux.cmd
.vmlinux.o.cmd
COPYING
CREDITS
Documentation
Kbuild
MAINTAINERS
Makefile
Module.symvers
README
REPORTING-BUGS
System.map
arch
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
modules.builtin
modules.order
net
samples
scripts
security
sound
tools
usr
virt
vmlinux
vmlinux.o

Markus

hi Markus,

a little dissapointed with my installation.

there is no .config in /usr/src/lin*** . even there is no linux** directory.there is only a directory named redhat. but still no file there. maybe my fedora is too old and i did not install the src when i installed the kernel.

also there is no .config in my /boot. i have not backup anything there.

EDDY1 01-12-2011 05:50 PM

When you compiled new kernel it took out entry for old kernel?
When I compiled new kernel I had option of booting into old as well.

markush 01-12-2011 05:51 PM

Well, with some of the distributions you'll have to install the kernelsources if you need them. I'm using Slackware and Gentoo and have the sources installed by default.

If you really want to learn Linux, I'd recommend to install Slackware, it is a great distribution for learning-purposes. Very stable, and they have a very helpful and knowledgeable community here in the forum: http://www.linuxquestions.org/questions/slackware-14/
Slackware is very easy to install. But be aware that you'll need the commandline in order to configure the system.
Slackware comes with a "vanilla"-kernel, this means they don't patch the kernel, it is installed as it is.

Note that the Slackware-forum here in LQ is the official Slackware-forum.

Markus

aaaaatoz 01-12-2011 06:17 PM

Quote:

Originally Posted by markush (Post 4222298)
Well, with some of the distributions you'll have to install the kernelsources if you need them. I'm using Slackware and Gentoo and have the sources installed by default.

If you really want to learn Linux, I'd recommend to install Slackware, it is a great distribution for learning-purposes. Very stable, and they have a very helpful and knowledgeable community here in the forum: http://www.linuxquestions.org/questions/slackware-14/
Slackware is very easy to install. But be aware that you'll need the commandline in order to configure the system.
Slackware comes with a "vanilla"-kernel, this means they don't patch the kernel, it is installed as it is.

Note that the Slackware-forum here in LQ is the official Slackware-forum.

Markus

thank. I had thought Redhat(CenOS,fedora) is the largest but i really found it is ugly sometimes.
i will try other distribution like slackware instead.

aaaaatoz 01-13-2011 05:23 PM

Quote:

Originally Posted by markush (Post 4222265)
I use to store a copy of .config in my /boot directory. Normaly you should find a config file there.
Otherwise the kernel sources are in /usr/src/linux-2.6.??.? and you'll find the .config file there. Be sure to use the ls command with the -a option in order to list also the files with a dot "." as their first character, dot-files are hidden normaly. As an example here the output of ls -a from my kernelsources:
Code:

..
..tmp_kallsyms1.o.cmd
..tmp_kallsyms2.o.cmd
..tmp_kallsyms3.o.cmd
..tmp_vmlinux1.cmd
..tmp_vmlinux2.cmd
..tmp_vmlinux3.cmd
.config
.config.old
.gitignore
.mailmap
.missing-syscalls.d
.tmp_System.map
.tmp_kallsyms1.S
.tmp_kallsyms1.o
.tmp_kallsyms2.S
.tmp_kallsyms2.o
.tmp_kallsyms3.S
.tmp_kallsyms3.o
.tmp_versions
.tmp_vmlinux1
.tmp_vmlinux2
.tmp_vmlinux3
.version
.vmlinux.cmd
.vmlinux.o.cmd
COPYING
CREDITS
Documentation
Kbuild
MAINTAINERS
Makefile
Module.symvers
README
REPORTING-BUGS
System.map
arch
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
modules.builtin
modules.order
net
samples
scripts
security
sound
tools
usr
virt
vmlinux
vmlinux.o

Markus

Markus,
you are right. if i use the current system's .config file. i can compile the new kernel version.
and the current config file is located in /boot/ but not with the name of .config but as config-2.6.15-1.2504-FC5 in my case.

thanks.

markush 01-13-2011 05:37 PM

Yes, since you can have more than one kernel in the /boot directory, it makes sense to give the .config files in this directory a name which refers to it's kernel.

Markus


All times are GMT -5. The time now is 10:23 AM.