linux logoMany Linux newbies think that kernel recompilation is inherent and almost necessary thing to do after OS is just installed or some time later. By the following advices I would try to show these fellows in which situations this really makes sense and what to do if one persists :)

1. If you don’t know why you should patch/recompile kernel – DO NOT DO THIS.
2. If your running kernel is smart and supports all necessary hardware, technologies and doesn’t contain critical vulnerabilities – DO NOT REBUILD IT.
3. If you don’t know what are kernel patches and why they are used – DO NOT REBUILD KERNEL.
4. If kernel with needed functionality is available as binary package for your distribution (especially in official repositories) – DO NOT BUILD KERNEL.
5. If you insist, certainly read Kernel HOWTO and notes about kernel recompilation in regards to your distribution.
6. Do change kernel config values only if you know what they mean.
7. Don’t forget to build initrd before rebooting your system.
8. Do not remove workable kernel and make it default in boot loader menu (like grub).
9. Don’t panic if something goes wrong – most probably the same situation happened to thousands people earlier. But sometimes shit happens.
10. Rebuilding procedure usually takes hours depending on hardware you use. BE PATIENT! :)
11 (thanks to Erek Dyskant). Use your distro’s package management system to build kernels whenever possible (like make-kpkg in Debian or rpmbuild in Fedora/RedHat/CentOS)

I really hope this helps and pretty sure you’ll build your “perfect” kernel once ;)

Any further advices are WELCOME!

P.S. Thanks to Stas Kogut for encouraging me to write this post.

 

21 Comments

 

  1. March 5, 2008  1:31 am by Josh Beck Reply

    Seems a bit pessimistic. Succesfully compiling a module or something in

    can be one heck of a learning experience. I remember the first time I pulled it off on Slack with a copy of O'Reilly's 'Running Linux' in tow many moons ago. Necessary? No. Fun and worth a try? You bet!

  2. March 5, 2008  2:16 am by Erek Dyskant Reply

    Add: Use your distro's package management system to build kernels whenever possible.

  3. March 5, 2008  6:04 am by Neezar Reply

    I'm happy you updated your blog again, keep up posting.

  4. March 5, 2008  10:05 am by artiomix Reply

    Hi Josh!



    Agreed with you completely: if one know why and for what to rebuild kernel and looks for learning experience he/she will do it without any advises :)



    Hi Erek!



    Thank you for great advice! Added.



    Hi Neezar!



    Actually, shame on me that I didn't post here for one month. Thank you!

  5. March 5, 2008  10:15 am by confiq Reply

    good points...

  6. March 5, 2008  11:25 am by Rip_Van_Winkle Reply

    RE: #10



    my kernels build in about 10 minutes, of course i have saved my .config from the previous build and just load it with menuconfig but i still look through it for any changes, and if i don't build support & features for hardware i don't have, and filesystem support (ext3) is built in to the kernel itself making an initrd unnecessary most of the rest is built as modules...

  7. March 6, 2008  1:07 pm by StasikOS Reply

    Erek, it is a part of 5th advice - read notes about kernel rebuild in your distribution ) Because this is more than just make-kpkg or rpmbuild, it may be distribution-specific patches (restricted modules in ubuntu, etc).

  8. March 6, 2008  4:26 pm by Erek Reply

    @staticOS. Sure enough. It is mentioned there.



    I was assuming that if you're rebuilding with the package management tool you're starting with the distro's kernel source package, so you pick up all the distro-specific stuff and go from there rather than starting at vanilla...

  9. March 6, 2008  7:48 pm by StasikOS Reply

    No, this is not logic of newbies. They are download latest vanilla kernel source and build it with "make", than install it with "make install" =). This is because advanced newbies using Slackware with it vanilla software and give advices to newbies use Slackware too. But if newbie don't use Slackware, and using distros with package-managers, they are prefer to slackware-way to build software from vanilla sources, and then "make install" them...

  10. March 6, 2008  7:51 pm by Erek Dyskant Reply

    @StaticOS



    It'd help if applications shipped with READMEs that say "use your distro's package management, or use the included spec file" rather than "Type su root, make, make install"



    Oh well. If someone wants to make their system unmaintainable there are lots of fun and creative ways to do it.

  11. March 7, 2008  7:56 am by StasikOS Reply

    Erek, yes, i agree this. ) But it is old windows logic - software must be searched via google, downloaded and then installed, without any package managers =(

  12. March 7, 2008  11:23 am by Mel Reply

    http://www.oreilly.com/catalog/9780596100797/


    This is actually a great book if you somewhat understand linux this is a good read very explaintory i think ive read it about 5 times over and learn a new trick here and there...



    Kernel building I would say is almost a fundamental part of Linux... you should do atleast 1 or 2 rebuilds with in a year or so... Granite depending on your distro, as a long time Gentoo/Fedora person and have been between the both I actually have a ritual of rebuilding my Kernels alot esp because i like to work with alternative Arch's.



    >.> so... I actually disagree with your "dont do this" attitude because the only way you do Learn is by so to speak "Screwing the Pooch" a few times.. God knows ive done it more then a dozen times... Plus who likes vanilla/Generic Kernels?



    Pfft thats why were not microsoft...

  13. March 7, 2008  7:45 pm by StasikOS Reply

    Mel, i can't say nothing if it is (kernel build) interesting to you. But if you want just "all in my computer just works", you can't rebuild kernel if you haven't anymore to do instead of just enjoy working system. )

  14. March 25, 2008  6:06 pm by LinuxCrayon Reply

    I disagree with #2. I rebuild my kernels even though all of my hardware is supported. I do it for the speed gains.

  15. Pingback : fluffigt.com » Blog Archive » FAQ: How to set up atomatic Linux reboot if kernel panic occurs?

  16. December 22, 2009  5:08 am by ??????? ????? Reply

    ????????????? ? ?????????? ?????? ? ???. ? ??????? ?? ??????????? ????????? ??????? ????? ??? ????! :)

  17. January 15, 2010  10:25 am by ????? ?????? Reply

    ??????? ?? ??? ???? ????? ??????????, ??????? ?????? ???? ????????????? ??????. ???????!

  18. January 24, 2011  4:35 pm by ledlights nucash.nl fantastico Reply

    Hey There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I will definitely comeback.

  19. January 27, 2011  6:02 pm by Lucilla Healy Reply

    useful I appreciate you taking time to share such valuable information. I really like the point you are making with your last paragraph.

  20. April 20, 2011  3:00 am by Jeramy Solonar Reply

    The next time I read a article, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought youd have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention.

  21. March 24, 2012  6:26 am by free St Patricks patterns Reply

    Thanks for the sensible critique. Me and my neighbor were just preparing to do some research about this. We got a grab a book from our area library but I think I learned more from this post. I am very glad to see such great info being shared freely out there.

Leave a reply

 

Your email address will not be published.