======Project: Updating the Linux Kernel====== This is a project for Matt Haas' HPC II class in the Spring 2012 Semester. This project will explore the many ways that a user can update the kernel of a Linux system. The solutions for this task range from simply checking the repository that the system has added, to manually downloading and installing the kernel. As is such, this will serve as a guide to completing this task. =====Basic Methods to Try===== Before you go about updating your kernel, you should check what version your kernel is at, and whether or not an update is necessary. Following these basic steps could also save a lot of time by making a manual install unnecessary. First, check what version your kernel is at. This is done with the following command: tyler@aleron ~ $ uname -r 3.0.0-1-amd64 tyler@aleron ~ $ Now, check to see whether or not you are at the latest version for your kernel using the command used below. Note that being at the latest revision for your added repositories does not mean that you have the latest stable kernel, and it does not mean that you can't install an earlier version. tyler@aleron ~ $ apt-cache search linux-image alsa-base - ALSA driver configuration files linux-headers-3.0.0-1-amd64 - Header files for Linux 3.0.0-1-amd64 linux-headers-3.0.0-1-rt-amd64 - Header files for Linux 3.0.0-1-rt-amd64 linux-image-3.0.0-1-amd64 - Linux 3.0.0 for 64-bit PCs linux-image-3.0.0-1-amd64-dbg - Debugging infos for Linux 3.0.0-1-amd64 linux-image-3.0.0-1-rt-amd64 - Linux 3.0.0 for 64-bit PCs, PREEMPT_RT linux-image-3.0.0-1-rt-amd64-dbg - Debugging infos for Linux 3.0.0-1-rt-amd64 linux-image-2.6-amd64 - Linux for 64-bit PCs (dummy package) linux-image-2.6-rt-amd64 - Linux for 64-bit PCs (dummy package) linux-image-amd64 - Linux for 64-bit PCs (meta-package) linux-image-rt-amd64 - Linux for 64-bit PCs (meta-package), PREEMPT_RT linux-headers-2.6.32-5-amd64 - Header files for Linux 2.6.32-5-amd64 linux-headers-2.6.32-5-openvz-amd64 - Header files for Linux 2.6.32-5-openvz-amd64 linux-headers-2.6.32-5-vserver-amd64 - Header files for Linux 2.6.32-5-vserver-amd64 linux-headers-2.6.32-5-xen-amd64 - Header files for Linux 2.6.32-5-xen-amd64 linux-image-2.6.32-5-amd64-dbg - Debugging infos for Linux 2.6.32-5-amd64 linux-image-2.6.32-5-amd64 - Linux 2.6.32 for 64-bit PCs linux-image-2.6.32-5-openvz-amd64-dbg - Debugging infos for Linux 2.6.32-5-openvz-amd64 linux-image-2.6.32-5-openvz-amd64 - Linux 2.6.32 for 64-bit PCs, OpenVZ support linux-image-2.6.32-5-vserver-amd64-dbg - Debugging infos for Linux 2.6.32-5-vserver-amd64 linux-image-2.6.32-5-vserver-amd64 - Linux 2.6.32 for 64-bit PCs, Linux-VServer support linux-image-2.6.32-5-xen-amd64-dbg - Debugging infos for Linux 2.6.32-5-xen-amd64 linux-image-2.6.32-5-xen-amd64 - Linux 2.6.32 for 64-bit PCs, Xen dom0 support linux-image-2.6-openvz-amd64 - Linux 2.6 for 64-bit PCs (meta-package), OpenVZ support linux-image-2.6-vserver-amd64 - Linux 2.6 for 64-bit PCs (meta-package), Linux-VServer support linux-image-2.6-xen-amd64 - Linux 2.6 for 64-bit PCs (meta-package), Xen dom0 support linux-image-openvz-amd64 - Linux for 64-bit PCs (meta-package), OpenVZ support linux-image-vserver-amd64 - Linux for 64-bit PCs (meta-package), Linux-VServer support linux-image-xen-amd64 - Linux for 64-bit PCs (meta-package), Xen dom0 support nvidia-kernel-2.6.32-5-amd64 - NVIDIA binary kernel module for Linux 2.6.32-5-amd64 nvidia-kernel-2.6.32-5-vserver-amd64 - NVIDIA binary kernel module for Linux 2.6.32-5-vserver-amd64 linux-headers-2.6.39-2-amd64 - Header files for Linux 2.6.39-2-amd64 linux-image-2.6.39-2-amd64 - Linux 2.6.39 for 64-bit PCs From the above command line output, we see that I am at the latest version for my repositories. Unfortunately, it is not the latest version possible overall, and that is the one that I want. How do we know what the latest version kernel is? Check the following website: * [[http://www.kernel.org|The Linux Kernel Archives]] Here, you can check for stable versions and unstable release candidates. You can also download the various kernels if you wish to install them manually. However, at this point in the guide, we are working to see if we can avoid that for your system. That being said, if the kernel you wish to install is listed after using the previous command, install it by using the following command: tyler@aleron ~ $ sudo apt-get install [name of kernel image] For example, the kernel I want to install is linux-image-3.2.0-1-amd64. Hypothetically, if it were listed in my repository, I'd be able to install it like so: tyler@aleron ~ $ sudo apt-get install linux-image-3.2.0-1-amd64 Now, as I've mentioned, what do we do if updating the kernel isn't as easy as this? What if our repository does not include the kernel we want, and we are sadistic so we do not add a new repository want the challenge and experience that comes from manually updating the kernel? If you are asking these questions, the rest of this guide is for you. =====Manual Kernel Installation===== Here's where the fun begins! We're going to get our hands dirty in our terminals. ====Downloading==== First, we need the kernel itself. You can download it from [[http://kernel.org|kernel.org]], or you can do it from the command line like so: tyler@aleron ~ $ wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.9.tar.bz2 This command downloads the latest kernel as of this writing. Check to see which is the latest kernel. Now, extract the files from the tarball. This can be done with a graphical archive manager, or you can use the following command: tyler@aleron ~ $ tar zxvf linux-3.2.9.tar.bz2 Either way, this will make a directory with the name of the kernel to be installed (linux-3.2.9 in this case). Change to this directory. tyler@aleron ~ $ cd linux-3.2.9 tyler@aleron ~/linux-3.2.9 $ ====Configuring with make==== We must configure the options we want for the kernel, which will determine its functionality. This is done like so-- tyler@aleron ~/linux-3.2.9 $ make menuconfig This will take you to a menu in which you can manage your .config file for the kernel. Aftwards, build the dependencies for this configuration (if necessary) and build the kernel, as shown below. tyler@aleron ~/linux-3.2.9 $ make dep tyler@aleron ~/linux-3.2.9 $ make bzImage The output for these two commands are not listed. Note that these two will take some time to complete. Next, make the modules, then install them. tyler@aleron ~/linux-3.2.9 $ make modules tyler@aleron ~/linux-3.2.9 $ make modules_install Now, we move the kernel to /boot. We just need to give it a unique name. Also copy System.map to /boot. Now just edit /etc/lilo.conf as needed. Below is a good guideline. image = /boot/[name of kernel you gave when copying] label = "[Place kernel version here]" Finally, run "lilo -v" and reboot. =====Conclusion and Reflection===== Unfortunately, updating my kernel through this experimentation proved to be pointless, as my system received a major update package from its repositories before I finished, but that did lead to a new project, so it's all good! Either way, I finished my thought on the project. =====References===== * Readme text file from kernel archive from kernel.org * [[http://www.sysdesign.ca/guides/linux_kernel.html|Jem's Guide: How to compile and install a new Linux kernel]] * [[http://www.linuxquestions.org/questions/linux-newbie-8/how-to-update-linux-kernel-931724/|Linux Questions forums: "How to update Linux Kernel?"]]