Do Ubuntu kernel updates happen automatically?

Solution 1:

New Ubuntu kernels do get installed as part of normal update and upgrade procedures. For example, this week my 16.04 kernel version went from 4.4.0-34-generic to 4.4.0-36-generic when I ran my daily sudo apt update && sudo apt full-upgrade

If you don't run those commands very often, you will get prompted by a pop up to update software when important updates like a new kernel are available. You have to authenticate these updates, they won't happen otherwise, as @AndroidDev points out.

The system will always boot the newest kernel by default. After a kernel update, it's a good idea to run sudo apt autoremove to remove older kernels (it leaves one extra spare older kernel)

If you want to install a newer mainline kernel (4.6*, 4.7*) for some special reason then you must do so manually, but this is rarely a good idea, as the Ubuntu kernels are patched and configured to work well with Ubuntu.

Solution 2:

You can find your kernel version by starting your terminal and entering:

uname -a

You'll see something similar to:

Linux z97 4.7.2-040702-generic #201608201334 SMP Sat Aug 20 17:37:03 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

The kernel version, in this case, is: 4.7.2

  • The first number is the kernel version (4).
  • The second number is the major revision (7).
  • The third number is the minor revision (2).

To find out more about your upgrade options, run:

man apt-get (<-- old/deprecated, kind of)

or

man apt

As mentioned above, if you run:

sudo apt update && sudo apt full-upgrade

you'll get minor revision kernel updates, and packages that are incompatible with the updated kernel will be removed. This is why you won't get automatic major revision updates automatically, because there is a good possibility that some packages you have installed (use) will not be compatible, hence your system can break.

If you're a little more adventurous and want to try a bleeding edge kernel, you can find pre-built Linux kernels for Ubuntu here:

http://kernel.ubuntu.com/~kernel-ppa/mainline/

For example, if you want to install the latest 4.7.2 kernel:

http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.7.2/

On that page you'll see:

Build for amd64 succeeded (see BUILD.log.amd64):
  linux-headers-4.7.2-040702_4.7.2-040702.201608201334_all.deb
  linux-headers-4.7.2-040702-generic_4.7.2-040702.201608201334_amd64.deb
  linux-headers-4.7.2-040702-lowlatency_4.7.2-040702.201608201334_amd64.deb
  linux-image-4.7.2-040702-generic_4.7.2-040702.201608201334_amd64.deb
  linux-image-4.7.2-040702-lowlatency_4.7.2-040702.201608201334_amd64.deb

I normally ignore the "lowlatency" stuff (I'm still not entirely sure what they are). If you right-click on the links from that page to get the link location, you can download the "headers all", "headers generic" and "image generic" deb files:

mkdir /tmp/kernels && cd /tmp/kernels

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.7.2/linux-headers-4.7.2-040702_4.7.2-040702.201608201334_all.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.7.2/linux-headers-4.7.2-040702-generic_4.7.2-040702.201608201334_amd64.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.7.2/linux-image-4.7.2-040702-generic_4.7.2-040702.201608201334_amd64.deb

Then install with:

sudo dpkg -i *.deb

If your system breaks and you want to uninstall the kernel you've just installed, get to a terminal prompt (you may have to ALT+CTRL+F1 if the desktop doesn't start):

sudo apt-get remove 'linux-headers-4.7.2*' 'linux-image-4.7.2*'

I'm running 4.7.2 at the moment and haven't had any serious problems so far (a couple of times I had a crash report appear on start-up, but the system still started just fine).