27

I want to freeze the kernel-version of Kubuntu 14.04.1 LTS Trusty. Is it enough to comment line 5 and 6 of the /etc/apt/source.list (see below)?

4 ...  
5 deb http://de.archive.ubuntu.com/ubuntu/ trusty main restricted  
6 deb-src http://de.archive.ubuntu.com/ubuntu/ trusty main restricted  
7 ...

Here is the check which kernel is in use (the one with an “i” in front):

root:~# aptitude search linux-image-generic linux-headers-generic  
i A linux-headers-generic                               - Generische Linux-Kernel-Header  
p   linux-headers-generic-lts-quantal                   - Generische Linux-Kernel-Header  
p   linux-headers-generic-lts-raring                    - Generische Linux-Kernel-Header  
p   linux-headers-generic-lts-saucy                     - Generische Linux-Kernel-Header  
p   linux-headers-generic-lts-trusty                    - Generische Linux-Kernel-Header  
p   linux-headers-generic-lts-utopic                    - Generic Linux kernel headers  
p   linux-headers-generic-lts-vivid                     - Generic Linux kernel headers  
p   linux-headers-generic-pae                           - Übergangspaket  
i A linux-image-generic                                 - Generisches Linux-Kernel-Abbild  
p   linux-image-generic-lts-quantal                     - Generisches Linux-Kernel-Abbild  
p   linux-image-generic-lts-raring                      - Generisches Linux-Kernel-Abbild  
p   linux-image-generic-lts-saucy                       - Generisches Linux-Kernel-Abbild  
p   linux-image-generic-lts-trusty                      - Generisches Linux-Kernel-Abbild  
p   linux-image-generic-lts-utopic                      - Generic Linux kernel image  
p   linux-image-generic-lts-vivid                       - Generic Linux kernel image  
p   linux-image-generic-pae                             - Übergangspaket
musbach
  • 1,445
  • 1
    I'm new to Ubuntu. Can you explain why you would want to do this? – ashes999 Sep 26 '15 at 13:54
  • 2
    @ashes999 Bugs which only show up on certain hardware configurations are more likely to happen for the kernel than for any other package. And such bugs are more likely to slip through QA than other bugs. Additionally if you are stuck with a kernel which doesn't work on your hardware configuration, it can be difficult to downgrade. But for all of the above reasons the kernel is one of the few packages build for keeping multiple versions installed, so I don't see a reason for staying on a particular version either. – kasperd Sep 26 '15 at 15:05
  • 2
    @ashes999 I'd like to have a say to hat as well (if I may). Ubuntu kernels to me seem like birthday gifts: sometimes they've got a quality you can only wish for; but sometimes they were lacklusterly concocted and you'd rather chuck them into your home's darkest corner.---I've got well-trained sensors for both good and fast kernels, and I would normally keep them for a quarter of a year (e. g. 3.16, 3.18). So I can clearly understand one would not always want to upgrade to a newer kernel just because. If (and only if) a new kernel will reportedly perform more stably, update is due. – syntaxerror Feb 12 '16 at 10:40
  • @syntaxerror maybe I'm just a lightweight user -- I update rigorously, and I've never noticed any issues (I use Ubuntu in a VM). That's why this question seems strange to me. – ashes999 Feb 12 '16 at 16:24
  • Another way that works for me, is to set grub to boot with the last known working kernel version: http://askubuntu.com/questions/747801/how-to-configure-a-desired-kernel-version-on-grub This allows the new kernels to be installed with less surprise, since you have to manually choose them on reboot before they are actually used. – prusswan Sep 22 '16 at 08:41
  • @ashes999 as an example, for the Intel Compute Stick, if you upgrade the kernel from 14.04 to a more recent version, it will actually break some of the driver modules, so that they no longer work, such as the hdmi audio driver. https://communities.intel.com/thread/121157 – Gino Mar 04 '18 at 19:25

2 Answers2

33

These lines are irrelevant to kernel upgrades. And also that is not good to comment them. You will not be able to install some packages if you do it.

You can freeze any package including kernel packages by

sudo apt-mark hold <package_name>

for example

sudo apt-mark hold linux-image-generic linux-headers-generic

But you need to check which kernel meta-package is installed for LTS versions. It may be linux-generic-lts-utopic, etc.

Pilot6
  • 90,100
  • 91
  • 213
  • 324
  • 1
    Thanks! The command aptitude search linux-image-generic linux-headers-generic gave that only i A linux-image-generic and i A linux-image-generic are insatlled. It is the normal kernel! – musbach Sep 26 '15 at 13:15
  • 1
    Yes, this means that you have installed these meta-packages. Freeze them, and the kernel will not get updates. – Pilot6 Sep 26 '15 at 13:23
  • 1
    I want to keep the 3.13 kernel versions that are LTS with Trusty 14.04.2. Updates to that kernel are OK, but I don't want to upgrade to the 3.19 kernel as the HWE stack is no longer supported. I don't want to upgrade to any of the 4.x kernels, as they bork my server from merely disabling Samba to not allowing it to boot at all. Will this solution allow the 3.13 updates and not allow the upgrades if I do this?
    sudo apt-mark hold linux-image-generic-lts-trusty linux-headers-generic-lts-trusty
    
    – marcerickson Oct 11 '16 at 20:43
  • 1
    You can ask another question for that, solution is different and you are not correct with versions. – Pilot6 Oct 11 '16 at 20:44
  • dpkg -l | grep linux- can give you a few hints. – MGP Dec 17 '16 at 16:46
  • 2
    @MGP you can search directly with dpkg, no need to pipe to grep: dpkg -l 'linux-*' – Thomas Guyot-Sionnest May 01 '20 at 15:43
-6

If you always update using apt-get upgrade you will not get kernel updates since they will be "kept back". You would need to run apt-get dist-upgrade to get kernel upgrades, as well as other system essential upgrades.

The real good answer would probably be to hold those packages so that you can get other system-essential upgrades, but this upgrade vs dist-upgrade information can be useful sometimes.

Calabacin
  • 355
  • This is not what dist-upgrade does. Check the answer to this https://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade – jplandrain Sep 05 '17 at 09:08