Home > Archive > Linux/Unix > January 2004 > Upgrading Kernel?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Upgrading Kernel?
mindmesh

2003-12-17, 1:42 pm

How do you upgrade the kernel. I show a security hole on my version and want to upgrade. It appears to be an RPM so I would just have to remove the old one and then install the new one? Thanks..
Papiya

2003-12-17, 2:02 pm

Download the new kernel source into /usr/src, then use the following commands:

# make mrproper (only need this if you have rebuilt the kernel before -- it restes the kernel to the default build)

# make menuconfig (this allows you to choose all of the options and modules that you need/don't need)

# make dep && make bzImage && make modules && make modules_install

Your new kernel will be stores in /usr/src/arch/i386/boot/bzImage

copy bzImage to /boot and rename it something like: vmlinuz-2.4.20-8custom

add a *new* stanza to your grub.conf file with the new kernel line pointing to your new kernel. do *not* delete the first stanza or your old kernel. if this doesnt work, you will have a harder time at recovery.

reboot system and choose the new kernel. you *may* need to create a new initrd image, but probably not.

note any error messages that occur. if bootup occurs ok, then do

# uname -a to make sure you have the correct kernel version.

thats it.

kind of disappointing, isnt it?
mindmesh

2003-12-17, 2:30 pm

quote:
Originally posted by Papiya

kind of disappointing, isnt it?



I'll let you know after I get it working.
Papiya

2003-12-17, 2:37 pm

quote:
Originally posted by mindmesh
I'll let you know after I get it working.


if it doesnt work, you are either missing some components that you need (libraries, etc.) or something like that. the biggest hurdle i usually face is getting the kernel named right (i usually get my dashes and dots mixed up).

if you do need to create a new initrd image you do so with the initrd command. but try with the old initrd first.

also, if you get any errors, you might want to execute the commands one after the other as in:

make dep
make bzImage
make modules
make modules_install

this will let you see what's going on a little easier than using the && in the command line will. you can direct stderr to a file by adding

2>error.file

at the end of the command line if you want to for later reference. this also might be a good time to deselect the modules that you know you will not use to make your kernel smaller and conserve memory.

compiling the kernel can take a few hours so dont be impatient. depends on your processor power.

btw, above i said that your new kernel would be under the i386 dir tree...this only applies if you have an intel processor...otherwise look under the appropriate arch sudbir.

good luck...
Boulware5

2003-12-17, 3:09 pm

I've done it plenty of times, don't let recompiling your kernel scare you. You can always go back to your old kernel if something goes wrong (as long as you keep the old). And besides, it's fun.
mindmesh

2003-12-17, 3:10 pm

quote:
Originally posted by Papiya
compiling the kernel can take a few hours so dont be impatient. depends on your processor power.

btw, above i said that your new kernel would be under the i386 dir tree...this only applies if you have an intel processor...otherwise look under the appropriate arch sudbir.

good luck...



I hope not. I'm running dual AMD 1Ghz with 512MB.. I'm hoping for about an hour.

Thanks again for the help.
Papiya

2003-12-17, 3:16 pm

An hour sounds abour right. My processor is much slower so it takes a good bit longer.
Papiya

2003-12-17, 3:25 pm

quote:
Originally posted by Boulware5
I've done it plenty of times, don't let recompiling your kernel scare you. You can always go back to your old kernel if something goes wrong (as long as you keep the old). And besides, it's fun.


I know. after i did it the first time, I was kind of disappointed that it wasnt more complicated, lol! but you should know how to do it to apply patches and add devices and you need to know how to compile the kernel to do that. sounds scarier than it really is.
mindmesh

2003-12-17, 3:47 pm

quote:
Originally posted by Boulware5
I've done it plenty of times, don't let recompiling your kernel scare you. You can always go back to your old kernel if something goes wrong (as long as you keep the old). And besides, it's fun.


Not too worried about it.. I've been messing with this system a bit.. install qmail once and wiped it out because I was having issues.. So did it a gain and it worked. Now I need apache running to get to my Web admin page. Screwed that up so if I screw up the kernel I'm gonna wipe it out anyway. Just downloaded the kernel.. The only problem is I have to update my firewall and that's running on a 350 Mhz.. That's gonna take awhile.


Question.. Do I have to download all of these files?

kernel-2.4.20-24.9.i386.rpm 01-Dec-2003 12:38 12.7M
kernel-BOOT-2.4.20-24.9.i386.rpm 01-Dec-2003 12:38 6.2M
kernel-doc-2.4.20-24.9.i386.rpm 01-Dec-2003 12:38 1.7M
kernel-source-2.4.20-24.9.i386.rpm 01-Dec-2003 12:38 37.2M


I'm thinking about changing the firewall to Gentoo or Slackware.. Eventually a BSD variant but I want to get the hang of Linux first.
Papiya

2003-12-17, 4:00 pm

To recompile the kernel you need the kernel sources.

You don't need apache for webmin or swat i dont think . . . they have their own "mini" web servers.

If you screw up the kernel, boot up using your old kernel and go to /usr/src

and do

# make oldconfig -- this sets your kernerl to build the previous kernel

or

# make mrproper -- this resets your kernel build to the default.

This is why I told you not to delete the first stanza in your grub.conf file or delete your old kernel. so that if this fails, you can boot up using your old one and try again.
Papiya

2003-12-17, 4:05 pm

quote:
Originally posted by mindmesh

Question.. Do I have to download all of these files?

kernel-2.4.20-24.9.i386.rpm 01-Dec-2003 12:38 12.7M
kernel-BOOT-2.4.20-24.9.i386.rpm 01-Dec-2003 12:38 6.2M
kernel-doc-2.4.20-24.9.i386.rpm 01-Dec-2003 12:38 1.7M
kernel-source-2.4.20-24.9.i386.rpm 01-Dec-2003 12:38 37.2M




Also for the above files . . . look at the respective sizes and names and you may get an idea . . . the first looks like a precompiled binary . . . the second is probably for a boot disk, third just documentation (rarely needed unless you are a programmer), fourth is the source . . . install the last one.
mindmesh

2003-12-17, 4:30 pm

quote:
Originally posted by Papiya
Also for the above files . . . look at the respective sizes and names and you may get an idea . . . the first looks like a precompiled binary . . . the second is probably for a boot disk, third just documentation (rarely needed unless you are a programmer), fourth is the source . . . install the last one.


Thought so.. That's the one I downloaded.. Thanks.
Papiya

2003-12-18, 12:54 pm

The new kernel version (2.6.0) has just been released today.

Kernel compilation has also been considerably simplified.
tembpoib

2003-12-19, 7:51 am

Couldn't get the new kernel to work. Also, how do you use the patch command so I can patch a system against my existing kernel?
mindmesh

2003-12-19, 11:11 am

May want to wait for someone else to answer but I think it works like this:

patch < (location of patch)
tembpoib

2003-12-19, 11:44 am

quote:
Originally posted by mindmesh
May want to wait for someone else to answer but I think it works like this:

patch < (location of patch)



I found out at another borad. You can use the patch but it is striclty for incremental upgrades. meaning that you can use the patch but only if you have all the previously installed patches installed in order before you do. It looks like downloading the entire source tree works better for me. Although I still cant get the damned thing to compile. Well, I can, but am getting a lot of weird errors.
Boulware5

2003-12-19, 11:57 am

quote:
Originally posted by tembpoib
I found out at another borad. You can use the patch but it is striclty for incremental upgrades. meaning that you can use the patch but only if you have all the previously installed patches installed in order before you do. It looks like downloading the entire source tree works better for me. Although I still cant get the damned thing to compile. Well, I can, but am getting a lot of weird errors.


can you paste exactly what you are doing and some of the errors..?
tembpoib

2003-12-19, 12:26 pm

ok. Here goes. I have compiled kernels many times before, so that isn't my problem. But when I tried to install 2.6 here is what happened:

first I get a weird error saying that I have a "clock skew", whatever the hell that is. Someone at another board suggest I touch all of the files to make sure the makefile recompiles the proper files when called. I did that. No dice.

So I decided to start over from scratch. I untarred the new kernel and tried to compile. It worked this time, but I got some weird errors about "inresolved symbols". I think this means I am missing some system libraries or something that I need to put the modules together.

When I tried to boot using the new kernel, it said something like this:

Kernel panic: VFS: Unable to mount root fs on hda7


So I rebooted using 2.4.x.

One more thing . . . when do you have to make a new initrd file and when not? Last few builds Imade I had to do that, which I have not had to do before.
Boulware5

2003-12-19, 12:31 pm

First of all, did you include ext3 file support in your kernel? I've forgotten to do that myself sometimes and since my root fs was ext3, it didn't know what it was and paniced.

An initrd image is needed for loading your SCSI module at boot time (if you have one) or if you are compiling the kernel with ext3 support as a module. If you don't have a scsi drive compiled as a module or compiling ext3 as a mod, don't make an initrd image.
tembpoib

2003-12-19, 12:41 pm

Yeah, I think I did. I dont remember if it was compiled straight in or as a module. I dont have scsi on my machine so didnt select it. Does this mean I could do without an initrd altogether? i notice that thiskernel by default doesnt have much preselcted.
Boulware5

2003-12-19, 12:45 pm

quote:
Originally posted by tembpoib
Yeah, I think I did. I dont remember if it was compiled straight in or as a module. I dont have scsi on my machine so didnt select it. Does this mean I could do without an initrd altogether? i notice that thiskernel by default doesnt have much preselcted.


Check your filesystem options in make xconfig or whatever you are using. If you build ext3 support in your kernel you don't need an initrd image.
Papiya

2003-12-19, 1:02 pm

quote:
Originally posted by tembpoib
ok. Here goes. I have compiled kernels many times before, so that isn't my problem. But when I tried to install 2.6 here is what happened:

first I get a weird error saying that I have a "clock skew", whatever the hell that is. Someone at another board suggest I touch all of the files to make sure the makefile recompiles the proper files when called. I did that. No dice.

So I decided to start over from scratch. I untarred the new kernel and tried to compile. It worked this time, but I got some weird errors about "inresolved symbols". I think this means I am missing some system libraries or something that I need to put the modules together.

When I tried to boot using the new kernel, it said something like this:

Kernel panic: VFS: Unable to mount root fs on hda7


So I rebooted using 2.4.x.

One more thing . . . when do you have to make a new initrd file and when not? Last few builds Imade I had to do that, which I have not had to do before.



Make sure you file system is compiled directly into the kernel and not compiled as a module. 2.6 uses a new module file format and user space module loader interface, so you need to download the new module utility programs for 2.6, module-init-tools. You can get it from ftp://ftp.kernel.org/pub/linux/kern.../rusty/modules. It is crucial that you read the README file.

The initrd is the "Initial ramdisk". Many distributions use these to boot from. It works like this: The boot loader loads it into memory at boot time, and then passes the memory address where it was loaded to the kernel, and the kernel uses it as the root filesystem when it boots. The reason distributions use it is because they build fully modular kernels (eg. compiling the root filesystem driver and root device driver as modules), and then they put the modules that are required to boot on an initrd along with a loader program that loads the modules, mounts the real root filesystem, switches root directory and then chainboots /sbin/init. If you simply compile the required drivers into the kernel instead of as modules, you won't need an initrd.

The patch file is only a differential patch between the former kernel version and the new one. It's useful in two ways. First, if you have the former version, you need only download the patch and apply it, and thus you won't need to download the entire new source. Second, if you modify your kernel rather heavily, it's most likely much easier to just patch the kernel up to the new version instead of downloading the entire source code and remake your changes. Since you didn't have the 2.6.0-test11 code, you can't use the patch. To patch a 2.4 kernel, you'd have to go through all the patches in the 2.5 series and then the 2.6.0-test kernels as well, providing it is at all possible.
jarbob69

2003-12-19, 11:08 pm

I upgraded my spare workstation to 2.6.0 today. It is an HP Vectra 450Mhz machine running RH9. I actually got it compiled without any errors and booted into it, but there are problems. Right after the boot loader, the screen went all hayware and only displayed a distorted version of the HP Vectra POST splash screen that is in the CMOS memory, and after loading everything it displayed the GUI fine. None of the text consoles would display anything other than fuzz, but the GUI looked fine. At least on the desktop it seemed to perform a lot better than before. I need to figure out what went wrong with the other stuff before I decide to use it further though.
Boulware5

2004-01-01, 4:33 pm

I found this. Very good read on what you need and how to upgrade your kernel to 2.6.
Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2009 examnotes.net