23

My current kernel is 3.2.0-26 (my main computer) while on another of my Ubuntu computers, with which I didn't fiddle with unofficial updates, it's 3.2.0-30. Yet the Update manager on my main computer doesn't show available kernel updates. It shows other updates though.

I suspect is due to the fact that in the past I installed multiple mainline kernel versions (not recommended versions), up to 3.5* series.

What I'm after: Either: Fix automatic kernel updates. Or: Learn about a way to check for the latest official ubuntu kernel version and get it manually (I know how to install kernels from debs)

What I have already tried: Uninstalled unused kernels including "the generic one without a number" as per https://askubuntu.com/a/103875/29347 and then also https://ubuntugenius.wordpress.com/2011/01/08/ubuntu-cleanup-how-to-remove-all-unused-linux-kernel-headers-images-and-modules/

0

3 Answers 3

15

Your problem with automatic updates may be because of the mainline kernels or because you removed the "generic" package.

You can update to the latest kernel via apt-get as follows:

sudo apt-get update
sudo apt-get install linux-image-`uname -r`

If you also need the headers (to compile kernel modules such as wireless drivers):

sudo apt-get install linux-headers-`uname -r`
2
  • 7
    The return I get is 'linux-image-3.2.0-26-generic is already the newest version.' while in fact it's not (please see the original question). Are you sure you gave me the right terminal commands? I'm not an expert in the matter but to me the commands translate to "update kernel to the same version you already have installed and use".
    – Bucic
    Sep 14, 2012 at 16:48
  • 14
    Could you please explain what this is supposed to do? linux-image-`uname -r` just tries to reinstall the kernel you already have, so how is that useful in any way? May 29, 2015 at 4:10
9

In case you only want to update the default kernel you should be able to fix it with:

sudo apt-get install linux-image-generic

Since linux-image-generic always depends on the newest default kernel of your distribution, the kernel gets upgraded with the rest of the packages when you run apt-get upgrade.

When you want to update a non default kernel you can do this by running this script:

#!/usr/bin/env bash

sudo apt-get update
kernel_release="$(uname -r | cut --complement -d'.' -f3)"
kernel_release_versions="$(apt-cache search linux-image-${kernel_release})"
kernel_release_versions_generic="$(grep linux-image-"${kernel_release_version}".*-generic <<< "$kernel_release_versions")"
newest_kernel_of_release="$(echo "$kernel_release_versions_generic" | tail -n1 | cut -d' ' -f1 )"

sudo apt-get install $newest_kernel_of_release

sudo apt-get dist-upgrade

If you also need the header files, additionally run the following:

newest_kernel_of_release_headers=${newest_kernel_of_release/image/headers}

sudo apt-get install $newest_kernel_of_release_headers
4
  • 2
    I think OP is looking for latest mainline / stable kernel Jan 8, 2018 at 18:14
  • 1
    I think this should be the correct answer. The OP seems to indicate a change the kernel version, which results in Ubuntu (correctly) ceasing to track new minor kernel version updates. This answer gets everything going again if desired. Sep 28, 2020 at 21:57
  • Line 4 of the script uses a variable that is not defined, ${kernel_release_version} (no s on the end of 'version'). Should it be ${kernel_release_versions} or ${kernel_release} or something else?
    – Ken H
    May 31, 2021 at 13:29
  • @KenH I don't remember if there was a reason for adding it, but you could just remove the variable. The script works without it.
    – Tom Dörr
    May 31, 2021 at 16:21
-1

"You should be able to use any of the listed mirrors by adding a line to your /etc/apt/sources.list like this:

deb http://security.ubuntu.com/ubuntu raring-security main

"

via

http://packages.ubuntu.com/raring/all/linux-headers-3.8.0-31/download

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .