7 years ago
New kernel always comes with new features and more driver support. So updating a kernel is probably a good choice sometimes, or may even become essential if the present kernel has some serious bugs or lacks some useful driver support. Driver support is a frequent problem for the laptop users, sometimes the drivers are not included in the kernel, sometimes the proprietary dirvers are not installable in the current version of kernel ( this criteria may even need to downgrade the kernel). So it is frequently required to deal with the kernel version by either downgrading or upgrading. I am going to discuss about mainly two methods of installing a kernel. The first method is for LM/ubuntu specifically, and the secod method is a generic method (compiling & building from source).
#1. Installing kernel specifically built for LM/ubuntu:
1. First the kernel packages need to be downloaded. Go to mainline ppa for ubuntu kernel:
and select the right version from there.
now you will see some .deb packages.
download the following packages(according to your architecture i.e i386 or amd64):
4. linux-image-extra-*generic*.deb (if available)
2. Now you can install them with Gdebi package manager one by one (sequentially), or open a terminal in the download folder and run:
sudo dpkg -i linux-*.deb
3. If you install them with Gdebi then you need to run
after installing all of them. If you install them with the terminal command then that will automatically update the grub for you.
#2. Installing kernel from source code:
W: This method is for the installation of the original linux kernel from kernel.org. If you don't know about the complete specification of your hardware then don't use this method. And this source build will lack some additional drivers and feautures which is added by ubuntu later. This may be avoided by compiling the ubuntu specific kernel source (https://wiki.ubuntu.com/Kernel/SourceCode) but that's not my intention here because the method #1 is the best approach to do that. This second method is only for learning purpose, don't expect it to give you a full featured desktop.
1. First download the source package from here:
2. Extract it in a folder where you have permissions, best if it is the home partition.
3. Open a terminal there or go to the extracted folder in terminal by cd command (cd path_to_the_directory)
4. Run code:
menuconfig may be replaced by defconfig to do default configuration. read the readme file in the extracted folder for more options.
5. Menuconfig will run a confinguration menu, where you will be able to configure everything about your kernel, which driver to install, which firmware to install etc. You can make your kernel light/small sized by making intelligent selections. To select or deselect press "spacebar". You can run make allyesconfig instead of make menuconfig to select all things at once without going for the trouble to make individual selection, but that will considerably increase the size of your kernel.
6. Exit the menu, and run:
this can take about 5 minutes upto hours depending on your hardware strength and number of selections you made in the configuration process.
7. Now run:
sudo make modules_install install
8. Reboot your pc and enjoy new kernel environment.
9. If you insist on compiling and building the ubuntu specifice kernels from source then go here:
#1. For uninstalling the kernel installed by the first (#1) process:
sudo apt-get remove linux-image-version_number*
sudo apt-get remove linux-headers-version_number*
sudo apt-get remove linux-image-extra-version_number* (if applicable)
or simply uninstall them from synaptic/software center.
#2. For uninstalling the kernel installed from source, run:
sudo rm -rf /lib/modules/kernel_version
sudo rm -f /boot/vmlinuz-kernel_version*
sudo rm -f /boot/initrd.img-kernel_version*
sudo rm -f /boot/config-kernel_version*
sudo rm -f /boot/System.map-kernel_version*
Finally, after uninstalling the kernel by either one of the processes above, run:
to clean the grub menu.
Hey you need to install Linux modules before Linux image. Otherwise it was not installing due to dependency error.
I prefer Update Manager in Rebecca.