---
# System prepended metadata

title: Configure Kernel version

---

# Configure Kernel version

## Update
1. sudo apt-get update

2. sudo apt-get install -y linux-image-X.Y.Z-W-generic linux-headers-X.Y.Z-W-generic

3. sudo update-initramfs -u -k all

4. sudo update-grub
* List bootable kernel version
* `sudo grub-mkconfig | grep -iE "menuentry 'Ubuntu, with Linux" | awk '{print i++ " : "$1, $2, $3, $4, $5, $6, $7}'`
```
# Output example:
# 0 : menuentry 'Ubuntu, with Linux 5.4.0-124-generic' --class ubuntu
# 1 : menuentry 'Ubuntu, with Linux 5.4.0-124-generic (recovery mode)'
# 2 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic' --class ubuntu
# 3 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic (recovery mode)'
# 4 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic' --class ubuntu
# 5 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic (recovery mode)'
```

5. sudo vim /etc/default/grub
```
# Modify GRUB_DEFAULT to "1>[option index]"
# Ex: GRUB_DEFAULT="1>0" to boot from kernel version 5.4.0-124-generic
```

6. sudo update-grub

7. sudo reboot


## Stop pulling new kernel packages

1. goto `/etc/apt/apt.conf.d/50unattended-upgrades`
2. add blacklist items
```
// List of packages to not update (regexp are supported)
Unattended-Upgrade::Package-Blacklist {
        "linux-generic";
        "linux-image-generic";
        "linux-headers-generic";
//      "vim";
//      "libc6";
//      "libc6-dev";
//      "libc6-i686";
};
```