How to update kernel to the latest mainline version without any Distro-upgrade?

Currently I'm running Linux-3.0 and I want to update it to Linux-3.3.1 the latest stable kernel release as mentioned at http://www.kernel.org. Can I update to 3.3.1 in Ubuntu without any risk of crashes? I'm updating my kernel regularly as provided by the Update Manager..Currently I have Linux-3.0.0.17..Can I update?

NOTE:

The latest kernel version any user is supposed to use in Ubuntu is updated automatically via the Update Manager, so no action is normally required by user regarding kernel upgrades. What the question author is referring to is mainline kernel, see: Should I upgrade to the "mainline" kernels?


Solution 1:

The simplest set of instructions I always used for kernel upgrade / downgrade are by ubuntuforums.org user by the name of lykwydchykyn (url modified by me for this post):

  1. Go here: http://kernel.ubuntu.com/~kernel-ppa/mainline/
  2. Download 3 (maybe 4) debs to a folder somewhere:

    linux-headers-VERSION-NUMBER_all.deb
    linux-headers-VERSION-NUMBER_amd64.deb
    linux-image-VERSION-NUMBER_amd64.deb
    linux-image-extra-VERSION-NUMBER_amd64.deb   # if available
    
  3. Install the debs with whatever package manager front-end you use (is gdebi still around?), or use these commands:

    cd /path/to/folder/where/you/put/the/debs
    sudo dpkg -i *.deb
    

Sources:

  • https://wiki.ubuntu.com/Kernel/MainlineBuilds
  • http://ubuntuforums.org/showthread.php?p=11391743#post11391743

Solution 2:

You could always do the following:

apt-cache search linux-image

Pick the one you want and then do:

sudo apt-get install linux-image-your_version_choice linux-headers-your_version_choice linux-image-extra-your_version_choice

Solution 3:

My answer is, YES you can. The stable release was 3.4, but in this tutorial i use 3.3.1.

Ubuntu (32-bit) Generic PAE:

Run the following commands:

mkdir kernel\ v3.3.1-precise && cd kernel\ v3.3.1-precise
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.1-precise/linux-headers-3.3.1-030301-generic-pae_3.3.1-030301.201204021435_i386.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.1-precise/linux-headers-3.3.1-030301_3.3.1-030301.201204021435_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.1-precise/linux-image-3.3.1-030301-generic-pae_3.3.1-030301.201204021435_i386.deb
sudo dpkg -i linux-*.deb 
sudo update-grub
sudo reboot now

Ubuntu (64-bit):

Run the following commands:

mkdir kernel\ v3.3.1-precise && cd kernel\ v3.3.1-precise
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.1-precise/linux-headers-3.3.1-030301-generic_3.3.1-030301.201204021435_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.1-precise/linux-headers-3.3.1-030301_3.3.1-030301.201204021435_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.3.1-precise/linux-image-3.3.1-030301-generic_3.3.1-030301.201204021435_amd64.deb
sudo dpkg -i linux-*.deb 
sudo update-grub
sudo reboot now

Enjoy!

Solution 4:

Contrary to some answers here Ubuntu releases the new kernel within a day or two of the main kernel team. I used to upgrade the hard way like some of the answers here suggest but I found this is an easier way.

Implications of manually installing Kernels

Manually installing kernels requires extra work.

There are reasons why you want to install the latest mainline kernel:

  • A bug in the last Ubuntu LTS kernel update and you can't downgrade
  • You have new hardware not supported in the current Ubuntu LTS kernel update stream or HWE updates
  • You want a security upgrade or new feature only available in the latest mainline kernel version.

As of January 15, 2018 the latest stable mainline kernel is 4.14.13. At the time of writing many are interested to install it for protection against Meltdown security hole. If you choose to manually install it you should know:

  • Older LTS kernels will not get updated until they are greater than the main menu first option titled Ubuntu.
  • Manually installed kernels are not removed with the usual sudo apt auto-remove command. You need to follow this: How do I remove old kernel versions to clean up the boot menu?
  • Monitor developments in the older kernels for when you want to get back on the regular LTS kernel update method. Then delete the manually installed mainline kernel as described in the previous bullet point link.
  • After manually removing the newest mainline kernel run sudo update-grub and then Ubuntu's latest LTS kernel will be the first option called Ubuntu on Grub's main menu.

Finding the latest kernel

Go to (kernel.ubuntu.com - Kernel PPA Mainline) and press the End key:

Mainline kernel 1

Now click on the link 4.9.8 (or a newer one if available when you read this) and the following appears:

mainline kernel 2

Note the links with the black airbrush marks. These are the three we will download for Ubuntu 16.04 64-Bit using Intel or AMD processors.

Installing using Terminal

Open a terminal session with Ctrl+Alt+T and use:

cd ~/Downloads # Change to your downloads directory
ll linux*.deb  # Check if any previous downloads still exist
rm linux*.deb  # Use this command if any previous downloads found

Now switch back to the download screen above and single-click on all three of the .deb kernel downloads. After downloads complete (you'll see status in your browser) switch back to terminal session and use:

sudo dpkg -i linux*.deb
rm linux*.deb
sudo reboot

Voila! - you are running the latest kernel when the first option in grub boot menu is selected. Your older kernel versions are still available under grub's Advanced Options menu.

After installing the newest kernel a dozen times you will ask the question "How do I remove older kernel versions?" and you will find those answers here in Ask Ubuntu.