LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   TechTips: Advice for managing the kernel (https://www.linuxquestions.org/questions/linux-kernel-70/techtips-advice-for-managing-the-kernel-436401/)

sundialsvcs 04-18-2006 10:43 AM

TechTips: Advice for managing the kernel
 
:eek: "The kernel! How can I possibly manage that? :jawa: It is the abode of wizards! It is beyond mortal understanding!"

:rolleyes: Well, maybe not. But sometimes it does feel that way.

Here are a few tips for understanding the kernel, for managing changes to it, and for, well, feeling comfortable about the whole process...

The kernel is ... a program: It's a memory-resident program, loaded into your computer's memory at startup by the "boot loader" (Grub or LILO), where it (or most of it) remains for as long as the computer runs. Its purpose, basically, is device-control. Open up the computer's box and look inside. Look at everything that's attached to it by a wire, wireless or Bluetooth. Whatever you can look at or touch, the kernel either controls it outright or brokers all requests that are passing to it and from it. The kernel is actually a comparatively small beast.

The kernel is ... modular: Since the kernel has to control all of the hardware, there are endless possibilities about the hardware it might be called-upon to control. That would get very tricky, so the kernel is built with an "always memory-resident no matter what" part and a whole bunch of "modular" parts that can be loaded, and unloaded, on-demand. When you configure your Linux for your hardware, or it configures itself, it's basically choosing modules.

The kernel lives in the /boot folder: It lives in specially formatted files that the boot loader (Grub, LILO) must know how to find. When the system boots, the BIOS has to be able to find the boot-loader, and the boot-loader has to know how to find Linux and which version of the kernel you want to load. (You can have several different kernel-image files in /boot. When something goes wrong, your first fallback position is to reboot from the previous one.)

You need to always have a bootable CD-ROM (a "LiveCD"): That's your secret weapon. It's a complete copy of Linux that can be booted entirely from a CD-ROM. The "install disk #1" of your distro can probably serve this purpose. Even if the Linux you have can't get off the ground, you can boot the LiveCD and fix things. Pick a time when the system is working just fine, shut it down, boot a LiveCD, and play with it so that you'll know how to use it before you need to use it.

iPods, or portable USB disk-drives, are your best friends: Lots of capacity, and, if your computer supports FireWire or USB 2.0, almost as fast as a built-in drive. Make a folder with today's date, and in it put a copy of /boot, /etc, /lib, /bin/, /sbin/, /usr/src. Use it for ordinary backups, too. Some machines can boot from USB devices. The drives fit easily into the safe-deposit box that you can rent at the local bank .. you know, the one next to the Starbuck's store that you frequent on the way in to work, or that you pass going home.

Preparedness is the key: Be Prepared.{tm} Given that you know that from time to time the ka-ka will encounter the air-movement device ;) ... prepare for it. Experiment with these things -- they won't bite! -- before you :eek: need them.

Be willing to experiment, ahead of time: Like I said, "it won't bite." It's really not that mysterious. If you have a spare machine somewhere, so much the better, but even if you don't ... the experience is priceless.

Finally, always have an "out": If what you are trying to do now, doesn't work for whatever reason (did you know your poodle thinks that power-cords taste like chicken?), "what is your 'out?'" What is your recovery-strategy going to be, first, then next, then next? Great. Why not practice it, dry-run ahead of time? You'll need to know what (various) things you can do, first to get the system operable again, then to either complete the change or back it out. Got that freshly-made backup copy finished on the USB drive? Great! Know how to plug it in and boot from it, or how to access it with only a LiveCD? Where is that LiveCD, by the way? It's not scratched, and the CD-ROM drive is in good working order? You checked that? Great! Make a checklist, keep a journal. All of my machines have a plastic envelope taped to the side, with a little notebook inside and a pencil.

acid_kewpie 04-18-2006 12:44 PM

this sort of thing is much better suited as a linuxAnswer or somehwere in our wiki.

mimithebrain 04-18-2006 02:09 PM

Useful post for the kernel newbies. They will end up learning that anyway, but sooner the better.

I don't keep a copy of /usr (waaay too big), I keep a copy of /home tho...

sundialsvcs 04-18-2006 08:33 PM

Yeah, I thought it might be seen sooner here...

acid_kewpie 04-19-2006 01:16 AM

yeah, sooner, but not for nearly as long. good advice sadly often sinks without trace here, but the info you've provided is good, and deserves to be kept around.


All times are GMT -5. The time now is 11:19 AM.