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
6
  • 1
    I'm new to Ubuntu. Can you explain why you would want to do this?
    – ashes999
    Sep 26, 2015 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, 2015 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. Feb 12, 2016 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, 2016 at 16:24
  • Another way that works for me, is to set grub to boot with the last known working kernel version: askubuntu.com/questions/747801/… 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, 2016 at 8:41

2 Answers 2

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.

6
  • 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, 2015 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, 2015 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? <pre>sudo apt-mark hold linux-image-generic-lts-trusty linux-headers-generic-lts-trusty<code> Oct 11, 2016 at 20:43
  • 1
    You can ask another question for that, solution is different and you are not correct with versions.
    – Pilot6
    Oct 11, 2016 at 20:44
  • 2
    @MGP you can search directly with dpkg, no need to pipe to grep: dpkg -l 'linux-*' May 1, 2020 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.

1

You must log in to answer this question.

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