Linux: Freeze kernel upgrade

Sometimes, after a kernel upgrade Linux may not work right. If you are happy with your kernel and want to keep it as it is, then here are three ways to do it:
  • Freeze the kernel version:
    sudo apt-mark hold $(uname -r)
  • Tell apt package manager not to to do unattended upgrades:
    cat << EOF | sudo tee -a /etc/apt/apt.conf.d/50unattended-upgrades
    APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "0";
    EOF
  • Tell apt package manager not to upgrade linux, linux-headers, and linux-image-generic:
    sudo apt-mark hold linux-generic linux-headers-generic linux-image-generic

References:

  • https://askubuntu.com/questions/938494/how-to-i-prevent-ubuntu-from-kernel-version-upgrade-and-notification
12 / 2024