I'm a new Linux user, so I have a question regarding kernel updates. Do they happen automatically? On some sites, I read that kernel updates are automatic. However, in regards to the new 4.6 and 4.7 kernels, I read that you need to manually update them.
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-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.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.
You can find your kernel version by starting your terminal and entering:
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)
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:
For example, if you want to install the latest 4.7.2 kernel:
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).
As another answer suggests, new Kernels are automatically installed, but if you find that you have issues on a new kernel, you can always start your computer using an older version. To do this, you enter the GRUB menu. You'd hold shift as you computer starts up and displays the "boot options" (usually where the computer brand is displayed during startup). It should bring you to the grub menu, where you can go to advanced options, and select a previous (non recovery mode) kernel to boot with. Purely optional, but it is available in the event you might prefer an old kernel (for any given reason, such as better system stability for your hardware).
I mention this as I've had to use previous kernels after automatic updates, where the new kernel caused some instability in my system. Hopefully this information is of use to you at some point.