Kernel panic (probably) goes on even after update to 4.4.0-112-generic (ubuntu 16.04.3 LTS)!

For my home non-production 16.04 LTS machines I made the following decision:
I'll stay on 4.4.0-104 (and 4.4.0-103 as fallback) and 20170707 intel-microcode for complete and safe Meltdown and Spectre fixes which do not have side-effects (I do not mean speed here).

So I removed new kernels, reinstalled 103 and 104 and pinned corresponding packages.

Warning: do not follow steps below if you are using Ubuntu on production server or enterprise desktop.

Here are my steps to achieve this:

  1. Remove new kernels

    sudo apt-get purge linux-tools-generic linux-headers-generic linux-image-generic \
    linux-headers-4.4.0-109 linux-headers-4.4.0-109-generic linux-image-4.4.0-109-generic linux-image-extra-4.4.0-109-generic linux-tools-4.4.0-109 linux-tools-4.4.0-109-generic \
    linux-headers-4.4.0-110 linux-headers-4.4.0-110-generic linux-image-4.4.0-110-generic linux-image-extra-4.4.0-110-generic linux-tools-4.4.0-110 linux-tools-4.4.0-110-generic \
    linux-headers-4.4.0-111 linux-headers-4.4.0-111-generic linux-image-4.4.0-111-generic linux-image-extra-4.4.0-111-generic linux-tools-4.4.0-111 linux-tools-4.4.0-111-generic \
    linux-headers-4.4.0-112 linux-headers-4.4.0-112-generic linux-image-4.4.0-112-generic linux-image-extra-4.4.0-112-generic linux-tools-4.4.0-112 linux-tools-4.4.0-112-generic 
    
  2. Install 4.4.0-104 and 4.4.0-103 (as fallback)

    sudo apt-get install linux-headers-4.4.0-104 linux-headers-4.4.0-104-generic \
    linux-image-4.4.0-104-generic linux-image-extra-4.4.0-104-generic \
    linux-tools-4.4.0-104 linux-tools-4.4.0-104-generic linux-headers-4.4.0-103 linux-headers-4.4.0-103-generic \
    linux-image-4.4.0-103-generic linux-image-extra-4.4.0-103-generic \
    linux-tools-4.4.0-103 linux-tools-4.4.0-103-generic
    
  3. Install all 4.4.0-104 packages from cache for sure

    sudo dpkg -i /var/cache/apt/archives/*4.4.0-104*.deb
    
  4. Pin kernel-related package versions

    cat <<EOF | sudo tee /etc/apt/preferences.d/pin-kernels
    Package: linux-headers-4.4.0-104
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-headers-4.4.0-104-generic
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-headers-generic
    Pin: version 4.4.0.104.109
    Pin-Priority: 1337
    
    Package: linux-image-4.4.0-104-generic
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-image-extra-4.4.0-104-generic
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-image-generic
    Pin: version 4.4.0.104.109
    Pin-Priority: 1337
    
    Package: linux-tools-4.4.0-104
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-tools-4.4.0-104-generic
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-libc-dev:i386
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-libc-dev
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-tools-common
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-source
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: linux-source-4.4.0
    Pin: version 4.4.0-104.127
    Pin-Priority: 1337
    
    Package: intel-microcode
    Pin: version 3.20170707.1~ubuntu16.04.0
    Pin-Priority: 1337
    
    EOF
    

When normal patches will be released you can simply remove pin and install corresponding packages with the following commands:

sudo rm /etc/apt/preferences.d/pin-kernels
sudo apt-get update
sudo apt-get install linux-tools-generic linux-headers-generic linux-image-generic
sudo apt-get upgrade
sudo apt-get dist-upgrade