How to Install Linux Kernel 4.5 in Ubuntu

How to Install Linux Kernel 4.5 in Ubuntu

Linux kernel is an important part in Linux operating system which allocates resources, security, low-level hardware interfaces, file management, etc., The procedure to install Linux Kernel 4.5 in Ubuntu is explained in this article.


To install Linux Kernel 4.5

Before updating the kernel, check the kernel by using the uname command.

root@linuxhelp:~# uname -mrs
Linux 4.2.0-27-generic x86_64

Create a directory by using the following command.

root@linuxhelp:~# mkdir -p linux-4.5/generic
root@linuxhelp:~# cd linux-4.5/generic/
root@linuxhelp:~/linux-4.5/generic#

Download the package by executing the following command.

root@linuxhelp:~/linux-4.5/generic# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.5-wily/linux-headers-4.5.0-040500_4.5.0-040500.201603140130_all.deb
--2016-07-12 13:21:13--  http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.5-wily/linux-headers-4.5.0-040500_4.5.0-040500.201603140130_all.deb
Resolving kernel.ubuntu.com (kernel.ubuntu.com)... 91.189.94.216
Connecting to kernel.ubuntu.com (kernel.ubuntu.com)|91.189.94.216|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9772348 (9.3M) [application/x-debian-package]
Saving to: ‘ linux-headers-4.5.0-040500_4.5.0-040500.201603140130_all.deb’ 

100%[=======================================> ] 97,72,348    396KB/s   in 17s    

2016-07-12 13:21:31 (554 KB/s) - ‘ linux-headers-4.5.0-040500_4.5.0-040500.201603140130_all.deb’  saved [9772348/9772348]

root@linuxhelp:~/linux-4.5/generic#
root@linuxhelp:~/linux-4.5/generic# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.5-wily/linux-headers-4.5.0-040500-generic_4.5.0-040500.201603140130_amd64.deb
--2016-07-12 13:23:00--  http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.5-wily/linux-headers-4.5.0-040500-generic_4.5.0-040500.201603140130_amd64.deb
Resolving kernel.ubuntu.com (kernel.ubuntu.com)... 91.189.94.216
Connecting to kernel.ubuntu.com (kernel.ubuntu.com)|91.189.94.216|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 780458 (762K) [application/x-debian-package]
Saving to: ‘ linux-headers-4.5.0-040500-generic_4.5.0-040500.201603140130_amd64.deb’ 

100%[=======================================> ] 7,80,458     251KB/s   in 3.0s   

2016-07-12 13:23:03 (251 KB/s) - ‘ linux-headers-4.5.0-040500-generic_4.5.0-040500.201603140130_amd64.deb’  saved [780458/780458]

root@linuxhelp:~/linux-4.5/generic#
root@linuxhelp:~/linux-4.5/generic# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.5-wily/linux-image-4.5.0-040500-generic_4.5.0-040500.201603140130_amd64.deb
--2016-07-12 13:23:19--  http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.5-wily/linux-image-4.5.0-040500-generic_4.5.0-040500.201603140130_amd64.deb
Resolving kernel.ubuntu.com (kernel.ubuntu.com)... 91.189.94.216
Connecting to kernel.ubuntu.com (kernel.ubuntu.com)|91.189.94.216|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 56160474 (54M) [application/x-debian-package]
Saving to: ‘ linux-image-4.5.0-040500-generic_4.5.0-040500.201603140130_amd64.deb’ 

100%[=======================================> ] 5,61,60,474  472KB/s   in 1m 55s

2016-07-12 13:25:15 (478 KB/s) - ‘ linux-image-4.5.0-040500-generic_4.5.0-040500.201603140130_amd64.deb’  saved [56160474/56160474]
root@linuxhelp:~/linux-4.5/generic#

Install the packages using dpkg command.

root@linuxhelp:~/linux-4.5/generic# dpkg -i *.deb
Selecting previously unselected package linux-headers-4.5.0-040500.
(Reading database ... 165882 files and directories currently installed.)
Preparing to unpack linux-headers-4.5.0-040500_4.5.0-040500.201603140130_all.deb ...
Unpacking linux-headers-4.5.0-040500 (4.5.0-040500.201603140130) ...
Selecting previously unselected package linux-headers-4.5.0-040500-generic.
.
.
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done

Restart the system.

root@linuxhelp:~/linux-4.5/generic# reboot
Broadcast message from user1@linuxhelp
      (/dev/pts/8) at 14:34 &hellip 
The system is going down for reboot NOW!
root@linuxhelp:~/linux-4.5/generic#

Find the kernel version using the uname command and open the terminal

user1@linuxhelp:~$ sudo su
[sudo] password for user1:
root@linuxhelp:/home/user1# uname -mrs
Linux 4.5.0-040500-generic x86_64
root@linuxhelp:/home/user1#
root@linuxhelp:/home/user1# apt-get remove linux-headers-4.5.0-* linux-image-4.5.0-*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting ' linux-headers-4.5.0-040500-generic'  for regex ' linux-headers-4.5.0-*' 
Note, selecting ' linux-headers-4.5.0-040500'  for regex ' linux-headers-4.5.0-*' 
Note, selecting ' linux-image-4.5.0-040500-generic'  for regex ' linux-image-4.5.0-*' 
The following packages will be REMOVED:
  linux-headers-4.5.0-040500 linux-headers-4.5.0-040500-generic
  linux-image-4.5.0-040500-generic
.
.
Do you want to continue? [Y/n] y
(Reading database ... 197961 files and directories currently installed.)
Removing linux-headers-4.5.0-040500-generic (4.5.0-040500.201603140130)
.
.
The link /initrd.img is a damaged link
Removing symbolic link initrd.img
 you may need to re-run your boot loader[grub]
root@linuxhelp:/home/user1#

Update grub by using the following command.

root@linuxhelp:/home/user1# update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.2.0-27-generic
Found initrd image: /boot/initrd.img-4.2.0-27-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
root@linuxhelp:/home/user1#

Then reboot the system.

root@linuxhelp:~/linux-4.5/generic# reboot
Broadcast message from user1@linuxhelp
      (/dev/pts/8) at 14:34 &hellip 
The system is going down for reboot NOW!
root@linuxhelp:~/linux-4.5/generic#

Check the kernel version by using the following command.

user1@linuxhelp:~$ uname -mrs
Linux 4.2.0-27-generic x86_64

FAQ
Q
Is Linux Kernel Free Software?
A
Linux kernel is released under GNU GPL version 2 and is therefore Free Software as defined by the Free Software Foundation. You may read the entire copy of the license in the COPYING file distributed with each release of the Linux kernel.
Q
How do I create an -rc kernel? I get "Reversed patch detected"?
A
-rc kernel patches are generated from the base stable release.

For example: to create the 2.6.14-rc5 kernel, you must:

download 2.6.13 (not 2.6.13.4)
and then apply the 2.6.14-rc5 patch.
Q
What means the macros likely() and unlikely() ?
A
Please refer the link as follow "https://kernelnewbies.org/FAQ/LikelyUnlikely"
Q
My CPU says it can do hyperthreading. Why do I only see one thread?
A
This is a normal issue which people often ask about. There are a number of common reasons why a CPU that claims hyperthreading capability does not show multiple threads per core.
Q
Hyperthreading with a Dual Core CPU?
A
Intel's Core Duo CPU is based on the same architecture that supports hyperthreading technology. If you run "cpuid" on such a CPU it will report that the chip supports hyperthreading. However,