PDA

View Full Version : The Kernel



carlwill
19th August 2004, 05:42 AM
I am wondering why I should upgrade the kernel?

I just installed a fresh version of Fedora Core 2 and when I type


YUM UPDATE

I see al ist of stuff to update and the kernel being one of them - if I select to update everything (the kernel included) is that ok? I hear many people compiling their own kernels and that sounds freaking crazy seeing I can hardly install a basic application / driver.

imdeemvp
19th August 2004, 07:47 AM
well it's recommended to keep your system updated...you can do all your updates and have two kernels in the boot loader which is always a good thing to have just in case you encounter problems with the new kernel.....satisfied.....eat a snickers bar :D

skoona
19th August 2004, 02:58 PM
carlwill,

yum --exclude=kernel... update, will install everything except the excluded package, and you can have multiple excludes before the update command.

Allowing the new kernel to be installed does not mean you have to use it. The new kernel has to be selected on the GRUB screen by you in order to be executed. So you could boot once and try the new BETTER MORE SECURE kernel or reboot and return to the older LESS SECURE kernel.

Also, get ready sooner or later you will have to compile your own kernel to get some stray feaure you need; like firewire support, or a particular USB camera, etc... Compiling a new kernel is very easy and only requires about 4 commands now, after the first compile.

First Time Ever:
1. cd /usr/src/linux-2.6.x....
2. make mrproper
3. ls configs
4. cp configs/kernel...i686|athlon|smp .config
5. make gconfig -- then select additive feature, or just press save then quit
6. make all modules_install install
7. Your Done - and ready for a reboot!

2nd Time:
1. cd /usr/src/linux-2.6.x...
2. make clean
3. make gconfig -- then save, then quit
4. make all modules_install install
5. Done...

The 'make all modules_install install' step could take 15min to 3+ hours depending on your machine. I recompile the kernel on each new release to support "SMP" and pre-emptive scheduling and to remove un-needed feature like SCSI, ISDN, etc... But for most people there may never be a real need to make their own kernels - if you one of the lucky ones who don't need to congrats and enjoy.

saBrEwolf
19th August 2004, 08:40 PM
Maybe I should've put this someplace else, o well, here goes...

If I know a kernel I'm upgrading to is mostly bug-free, is it possible to replace the kernel you're upgrading from and not have an extra GRUB entry? I want this so I can keep my system surviving the granny test (lol yes, you heard me correctly, FC2 has survived the granny-test!)

Craig

virusdoc
19th August 2004, 09:31 PM
You can delete the other kernel from the grub.conf file, or you can change the default kernel in the same file.

as root:


gedit /etc/grub.conf

You'll see a listing of all the kernels installed (and pointers to other OS's if you have them. You can comment out the ones you don't want and reset the default number to a different choice. You can also adjust the timeout number.

For future access to your system should you encounter a kernel problem, it's probably best to leave the old kernel intact but change the default kernel and shorten the timeout to 5 seconds so you can just ignore the grub screen.

falling
20th August 2004, 12:21 AM
Also, get ready sooner or later you will have to compile your own kernel to get some stray feaure you need; like firewire support, or a particular USB camera, etc... Compiling a new kernel is very easy and only requires about 4 commands now, after the first compile.

First Time Ever:
1. cd /usr/src/linux-2.6.x....
2. make mrproper
3. ls configs
4. cp configs/kernel...i686|athlon|smp .config
5. make gconfig -- then select additive feature, or just press save then quit
6. make all modules_install install
7. Your Done - and ready for a reboot!

2nd Time:
1. cd /usr/src/linux-2.6.x...
2. make clean
3. make gconfig -- then save, then quit
4. make all modules_install install
5. Done...


I'm a Slackware / Gentoo user and am used to compiling my kernels manually this way. But I've got Fedora on another machine here, and want to upgrade the kernel "the Fedora way" if there is such a thing. I'm new to Fedora, but from what I've read there seems to be Fedora-customized versions of the kernel? If so, can I get them using the yum command, or do I need to manually download an SRPM or something? I do need to tweak some of the config options though, so I definitely need to do an actual compile... but I'd like to start from the "Fedora kernel source" if possible / if that exists.

Thanks,
Anthony DiSante
http://nodivisions.com/

Ned
20th August 2004, 01:41 AM
I'm a Slackware / Gentoo user and am used to compiling my kernels manually this way. But I've got Fedora on another machine here, and want to upgrade the kernel "the Fedora way" if there is such a thing. I'm new to Fedora, but from what I've read there seems to be Fedora-customized versions of the kernel? If so, can I get them using the yum command, or do I need to manually download an SRPM or something? I do need to tweak some of the config options though, so I definitely need to do an actual compile... but I'd like to start from the "Fedora kernel source" if possible / if that exists.

Thanks,
Anthony DiSante
http://nodivisions.com/

Just download and install the kernel-sourcecode-<version number>.noarch.rpm package and install it. This is the fedora source code and you can then compile it just as you would any other kernel source.

Get the latest version from the updates tree of the fedora download site :)

Ned

crackers
20th August 2004, 03:38 AM
get ready sooner or later you will have to compile your own kernel to get some stray feaure you need
The last time I "needed" to compile a kernel was 1.2.something. If you have "normal" system requirements and peripherals, compiling a kernel is not a "have to."

Regarding the original question, note that once you've installed and booted to a new kernel, you can safely remove the older version (via rpm/yum/apt-get) and that will also remove the GRUB entry. This is the recommended approach. If you just edit the "grub.conf" file to remove the previous kernel entry, you may forget it's installed and it just sits there in the corner, gathering dust and eating up disk-space.

skoona
20th August 2004, 11:25 PM
Knowledge is Power and Independance:

If you are fortunate enough to have a fully supported hardware profile, then its true you may never need to compile a kernel. However, if you find yourself NEEDING to compile one - its really no big deal to do it.

Example NEED firewire support for my Panasonic Digital CamCorder.
Solution: Recompile FC2 Kernel and/or modules to enable that feature.
Why: FC2 does not have FireWire support compiled in as a part the the Standard distribution of FC2. So to get that feature turned on, you the use must re-compile the kernel modules to enable that feature.

To install new kernels and source ,and remove out of date kernels, yum is a great tool - use it. Regarding custom kernels - create them only when you need to! If you need to it will be very clear that you do, and you will likely also have the specific instructions you need to get it done; so don't worry about until the time comes. Meanwhile, let YUM keep your Fedora system up to date.

Salute...

carlwill
20th August 2004, 11:44 PM
yes, for some reason "compile" just freaks me out -

skoona
21st August 2004, 12:13 AM
So Carlwill,

Consider this.
1. Use yum to update your system, including any new kernels, once a month - or when you feel like it.
2. If you see that a new kernel was added via yum, eddit grub.conf to make it you default kernel - and use yum to remove your oldest kernel. Be sure to keep at least two version of the kernel in grub at all time.
3. Never compile a custom kernel , and enjoy your up to date system as is!

But, rest assured that if you every do need to, there are a lot of people who can help you verify that compiling is the right thing to do, and step you through.

Enjoy,

carlwill
21st August 2004, 12:33 AM
So Carlwill,

Consider this.
1. Use yum to update your system, including any new kernels, once a month - or when you feel like it.
2. If you see that a new kernel was added via yum, eddit grub.conf to make it you default kernel - and use yum to remove your oldest kernel. Be sure to keep at least two version of the kernel in grub at all time.
3. Never compile a custom kernel , and enjoy your up to date system as is!

But, rest assured that if you every do need to, there are a lot of people who can help you verify that compiling is the right thing to do, and step you through.

Enjoy,

awsome info - thank you so much!

crackers
21st August 2004, 05:25 AM
Knowledge is Power and Independance:

If you are fortunate enough to have a fully supported hardware profile, then its true you may never need to compile a kernel. However, if you find yourself NEEDING to compile one - its really no big deal to do it.
I never debated that. I just contended your assertion of "have to." No offense, but it almost edged over into a purist attitude. Kind of a button for me... ;)

skoona
21st August 2004, 05:39 AM
I never debated that. I just contended your assertion of "have to." No offense, but it almost edged over into a purist attitude. Kind of a button for me... ;)

Crackers,
I try to always be considerate of those who have different opinions, experiences, and skills - so please continue helping me stay on the right path. There are some truths to be learned and shared regarding Linux; I'm just trying to do my part without all the BS...

over it. :cool:

Avix
21st August 2004, 06:06 PM
ALWAYS have a working fall back, I am in the fun position of having had 2 upgrades since install and only one of them (the original) will let me access the internet (for some reason the updated kernels won't deal with my NIC or Router and I don't have the knowledge (yet) to fix it...)

mugs
21st December 2004, 01:24 PM
Very informative thread. I have never done anything with a kernel, except for update it through yum. I would like to learn how, and I think I need to to get some hardware working. I have an old HP 5100c scanner I want to get to work (I cant get my Canon USB working). It is parallel port. I know it is very well supported. I seem to need to load epst and ppscsi modules, but I am not sure how to. Is this something that would require recompiling and customizing the kernel? I am using FC2 with the 2.6.5-1.358 kernel, as that one still allows me to use K3b normally. I dont know if this means anything, but when I go into the KDE control center and click on the Linux Kernel under System Administration, I get "Sorry" the kernel config could not be read due to the following error: No hardware architecture was specified, perhaps the kernel source code is not installed (it is!) or the path to the kernel sources is entered incorrectly. The box at the top shows: /usr/src/linux-2.4, which I assume is wrong. Anyway, I would greatly appreciate any advice on how to fix this and how to get those modules I need in. Sorry if this is long. Thanks!

james_in_denver
21st December 2004, 08:34 PM
Well reading this thread, I have to agree with the points that I have seen brought up. On both sides. Yes for a typical end-user whose hardware is supported, there is no real need to compile a kernel. On the other hand, if you DO have hardware that doesn't have support in the distributed Fedora Core 3 kernel (or any other distributed kernel for that matter), then your best bet is to compile one yourself.

If anybody else is reading this thread, I recommend getting the kernel from http://www.kernel.org/ , and yes, that is the exact same place that the Fedora team (and every other Linux distribution) get's their kernel from.

Compiling a kernel is not difficult, it's just a program, okay, it's a BIG program, but still it's really pretty easy to build and install one.

1) make sure you have the "gcc" compiler installed with "rpm -qa | grep gcc", you should see something like "gcc-3.4.2-6.fc3", if not then just "yum install gcc".

2) get the kernel from kernel.org, save it to "/usr/src" folder.

3) "tar -xvzf whateverversionhere"

4) "cd whateverdirectorywasjustcreated"

5) "make xconfig" and select the options you want for your kernel (and read the "help"/"tips" section on the bottom right of the screen for each option!!!!), then save your work.

6) "make ; make modules ; make install; make modules_install" , this will "make" and "install" a new kernel, pretty self explanatory. The first time you compile a new kernel, you may get an error message about missing a directory in "/lib/modules", if you do, just type in "mkdir /lib/modules/whateverversionkernelyouareusringhere" then do the "make modules_install" part of that again.

7) reboot and try things out.

8) go back to step 4 as often as you like and repeat the process.

9) pat yourself on the back, you just installed a new kernel.

It is really not that difficult, and if something get COMPLETEY and TOTALLY screwed up, so what? you still have the original installed kernel you can boot from. So no harm done at all.

Another side effect this process has is "seeing for yourself" that Linux is truly free and open. There is something about getting the kernel, and doing a build, that really drives home that fact. I'ld like to see a Windows user try that!!!!!

skoona
22nd December 2004, 01:14 AM
mugs,

If you know the names of the modules you need, look for them in your current system and if they are found load them and give them a try.

Find them: (from a command-line enter)
> locate modulenamehere

The above step verifies that that modules are already compiled and available to be loaded. If found, path to the modules should include the path element "/lib/modules/" .

Load them:
> /sbin/modprobe modulenamehere

The above step may require root ability, or "> su -"

Otherwise, your request is a little off topic and may get serviced/answered quicker via a new post.

mugs
22nd December 2004, 03:01 AM
Ok, thanks. I need the ppscsi module, but it is not on my system. I have downloaded the kernel patch, but dont know how to install the patch. I will search the forum.

james_in_denver
22nd December 2004, 06:48 AM
mugs, usually to "patch" the kernel source (usually for drivers that haven't made it into the "released" linux kernel) you "cd /usr/src/yourkernelsourcedirectoryhere" then do a "patch -p0 < patch-file-name-here". (sometimes if it complains about not finding the right files you might need to do a "patch -p1 < patch-file-name-here").

Let me know how it goes.......remember, you can ALWAYS just delete the entire kernel source tree "/usr/src/yourkernelsourcehere" and start over, no harm, no foul......

Then you can just un-tar the source and start over.....

mugs
22nd December 2004, 01:14 PM
James, I ran this:

[root@dhcppc1 linux-2.6.5-1.358]# patch -p1 /home/mugs/Desktop/linux-ppscsi-2.6.x.patch

(full path was /usr/src/linux-2.6.5-1.358)

So far, it has been almost 20 minutes, and the cursor is still just flashing at the end of the command...how long should this take...id I do something wrong?


:eek:

mugs
22nd December 2004, 01:38 PM
Well, it has sat there another almost 20 minutes, I have to go to work, so I stopped it. It didnt patch, but I hope I did not harm.

james_in_denver
22nd December 2004, 08:38 PM
You missed the "redirection" command (input in this case) for the "patch" command.

"patch -p1 < /home/mugs/Desktop/linux-ppscsi-2.6.x.patch"

No you didn't hurt anything by cancelling it, the "patch" command was looking for input. That's what the "<" does. It tells a program to get it's "input" from whatever file is after that. Since you left out the "<", the "patch" program was just waiting for input, and since you didn't tell it were from, it was waiting for you to type in the contents of the " /home/mugs/Desktop/linux-ppscsi-2.6.x.patch" by hand!!!!! (probably not what you were trying to do).

PS: the ">" means "output". so a "ls -al > file.list" will execute the "ls -al" command, and will create/replace the file "file.list".

PPS: the ">>" means just "append" or add to an existing file, without destroying it's previous contents.

mugs
23rd December 2004, 12:18 AM
Thanks James! This time it worked, I saw it patch what I needed it to. But, when I try to modprobe the modules, it still says they dont exist. The instructions for this patch say to run make config or make oldconfig. That wasnt in your instructions...do I need to do that or something else? Thanks.

james_in_denver
23rd December 2004, 01:09 AM
Now you have to "configure" your kernel, that's what I mentioned in post #17 of this thread.

"make config" will give you a kind of "aesthetically challenged" menu to select your kernel options, "make xconfig" gives you a nice full blown GUI interface (but only if you are runnnig x-windows).


PS: the "patch" only patches the kernel source code,
If ya jump back up to post #17 of this thread, and follow the instructions there, you should be cool.
Also the first time you compile can take a while, 10-15 minutes (or longer).

After that though, when you are only changing one or two "features", a re-compile will typically only take a few minutes.

mugs
23rd December 2004, 02:48 AM
When I try make xconfig, the gui is filled with gibberish....I started to do make config, but there were sooooo many questoins, I really didnt know how to answer a lot, so I stopped.

GiLuX
23rd December 2004, 02:57 AM
kernel source in fc3?
there is no spoon!

james_in_denver
23rd December 2004, 03:12 AM
The kernel source can be configured with "make " and choose one "config", "xconfig" (think this one is dependant on having KDE installed, or at least the QT libraries which KDE is built on), "gconfig" (I've read that this is for Gnome only), and menuconfig.

I prefer "make xconfig", haven't ever used "make gconfig", "make config" is a real pain, make menuconfig is not pretty, but it does get the job done.

make config has about a zillion options. And yes, the first time through you probably want to look at most, if not all of them. Your choices will be saved to a file "/usr/src/yourkernelsourcehere/.config". After I configure a kernel to my liking, I copy this file to the "/root" directory and call it something like "mycustomkernel.config". So if I choose to delete and re-install the kernel source, I don't have to go through the entire config process again.

mugs
23rd December 2004, 03:48 AM
Ok, I fixed the font issue by running qtconfig. I then followed all of your steps, rebooted, but I still cannot make this work:

root@dhcppc1 mugs]# /sbin/modprobe ppscsi
FATAL: Module ppscsi not found.
[root@dhcppc1 mugs]# /sbin/modprobe epst
FATAL: Module epst not found.
[root@dhcppc1 mugs]#

I think I set these up in xconfig as modules. Was that right, or do I need to have the checkmark there instead of the dot?

garnertr
23rd January 2005, 11:29 PM
If I use YUM to upgrade my kernel; Will that take care of the gedit /etc/grub.conf file entry for me?

2.6.9-1.667 Kernel
FC3
Laptop

Thanks!

james_in_denver
23rd January 2005, 11:56 PM
Yes, if the kernel you download was packaged properly. (if not, editing grub is no big deal....unless you really get it wrong!)

Dewey
24th January 2005, 12:01 AM
Yes, yum will automatically apend grub.conf

james_in_denver
24th January 2005, 12:24 AM
Actually, yum just downloads the RPM and then calls the "rpm" command to install the package. the "rpm" command then "installs" the files, and runs the scripts associated with/contained in the package.

So the package you download must have the scripts in it to update the "grub.conf" file. This is usually the case, but I have seen some kernels "RPM" packages that only update the "/etc/lilo.conf", which does you absolutely no good at all if you are using the grub boot loader.

That is why I specifically said


Yes, if the kernel you download was packaged properly