Kernel Upgrade

The kernal is an layer between the application itself and the hardware of the server. It handles the input and output of task which is passed through from applications to the CPU and RAM.

Depending on your VPS, you may have different kernels, the VPS has an fix kernel where by its not upgradeable. However the VPS cloud has an customisable kernel. To find the kernel version for VPS cloud, you would type in uname -a, you will get the following output:

Linux 3.10.23-xxxx-std-ipv6-64-vps #1 SMP Tue Mar 18 14:51:03 CET 2014 x86_64 x86_64 x86_64 GNU/Linux

Whilst this kernel is sufficient for most task, some task may require an even higher version or even the latest version. This can be done via the SSH connection to your VPS. Our current kernel version is 3.10.23-xxxx-std-ipv6-64-vps.

The first thing which we need to do is check if there is any pending updates for the OS itself, we can do this by:

sudo apt-get update
sudo apt-get upgrade

To upgrade the kernel we will type the following command:

sudo apt-get install linux-image-generic

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  crda iw linux-firmware linux-image-3.13.0-48-generic
  linux-image-extra-3.13.0-48-generic wireless-regdb
Suggested packages:
  fdutils linux-doc-3.13.0 linux-source-3.13.0 linux-tools
  linux-headers-3.13.0-48-generic
The following NEW packages will be installed
  crda iw linux-firmware linux-image-3.13.0-48-generic
  linux-image-extra-3.13.0-48-generic linux-image-generic wireless-regdb
0 to upgrade, 7 to newly install, 0 to remove and 0 not to upgrade.
Need to get 71.9 MB of archives.
After this operation, 261 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main linux-image-3.13.0-48-generic amd64 3.13.0-48.80 [15.1 MB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/main wireless-regdb all 2013.02.13-1ubuntu1 [6,456 B]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/main crda amd64 1.1.2-1ubuntu2 [15.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty/main iw amd64 3.4-1 [51.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ trusty-updates/main linux-firmware all 1.127.11 [19.9 MB]
Get:6 http://archive.ubuntu.com/ubuntu/ trusty-updates/main linux-image-extra-3.13.0-48-generic amd64 3.13.0-48.80 [36.8 MB]
Get:7 http://archive.ubuntu.com/ubuntu/ trusty-updates/main linux-image-generic amd64 3.13.0.48.55 [2,802 B]
Fetched 71.9 MB in 2s (25.5 MB/s)          
Selecting previously unselected package linux-image-3.13.0-48-generic.
(Reading database ... 31321 files and directories currently installed.)
Preparing to unpack .../linux-image-3.13.0-48-generic_3.13.0-48.80_amd64.deb ...
Done.
Unpacking linux-image-3.13.0-48-generic (3.13.0-48.80) ...
Selecting previously unselected package wireless-regdb.
Preparing to unpack .../wireless-regdb_2013.02.13-1ubuntu1_all.deb ...
Unpacking wireless-regdb (2013.02.13-1ubuntu1) ...
Selecting previously unselected package crda.
Preparing to unpack .../crda_1.1.2-1ubuntu2_amd64.deb ...
Unpacking crda (1.1.2-1ubuntu2) ...
Selecting previously unselected package iw.
Preparing to unpack .../archives/iw_3.4-1_amd64.deb ...
Unpacking iw (3.4-1) ...
Selecting previously unselected package linux-firmware.
Preparing to unpack .../linux-firmware_1.127.11_all.deb ...
Unpacking linux-firmware (1.127.11) ...
Selecting previously unselected package linux-image-extra-3.13.0-48-generic.
Preparing to unpack .../linux-image-extra-3.13.0-48-generic_3.13.0-48.80_amd64.deb ...
Unpacking linux-image-extra-3.13.0-48-generic (3.13.0-48.80) ...
Selecting previously unselected package linux-image-generic.
Preparing to unpack .../linux-image-generic_3.13.0.48.55_amd64.deb ...
Unpacking linux-image-generic (3.13.0.48.55) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up linux-image-3.13.0-48-generic (3.13.0-48.80) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-48-generic /boot/vmlinuz-3.13.0-48-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-48-generic /boot/vmlinuz-3.13.0-48-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-48-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.13.0-48-generic /boot/vmlinuz-3.13.0-48-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-48-generic /boot/vmlinuz-3.13.0-48-generic
Generating grub configuration file ...
Found linux image: /boot/bzImage-3.10.23-xxxx-std-ipv6-64-vps
Found linux image: /boot/vmlinuz-3.13.0-48-generic
Found initrd image: /boot/initrd.img-3.13.0-48-generic
  No volume groups found
done
Setting up wireless-regdb (2013.02.13-1ubuntu1) ...
Setting up crda (1.1.2-1ubuntu2) ...
Setting up iw (3.4-1) ...
Setting up linux-firmware (1.127.11) ...
Setting up linux-image-extra-3.13.0-48-generic (3.13.0-48.80) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-48-generic /boot/vmlinuz-3.13.0-48-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-48-generic /boot/vmlinuz-3.13.0-48-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-48-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.13.0-48-generic /boot/vmlinuz-3.13.0-48-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-48-generic /boot/vmlinuz-3.13.0-48-generic
Generating grub configuration file ...
Found linux image: /boot/bzImage-3.10.23-xxxx-std-ipv6-64-vps
Found linux image: /boot/vmlinuz-3.13.0-48-generic
Found initrd image: /boot/initrd.img-3.13.0-48-generic
  No volume groups found
done
Setting up linux-image-generic (3.13.0.48.55) ...

Now we must get the VPS server to use the new kernel by editing GRUB file, the entry which we will be interested with is GRUB_DEFAULT=0, we will look to change this to GRUB_DEFAULT=1, afterwards we will run the command of update-grub as highlighted below.

/etc/default/grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=1
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=2
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

Here is the output of update-grub:

sudo apt-get update-grub
Generating grub configuration file ...
Found linux image: /boot/bzImage-3.10.23-xxxx-std-ipv6-64-vps
Found linux image: /boot/vmlinuz-3.13.0-48-generic
Found initrd image: /boot/initrd.img-3.13.0-48-generic
  No volume groups found
done

Now we will reboot our VPS so the kernal can be updated and afterwards we will check our kernel version again with uname -a. We should of successfully upgraded our kernel version from: 3.10 to 3.13

Linux 3.10.23-xxxx-std-ipv6-64-vps #1 SMP Tue Mar 18 14:51:03 CET 2014 x86_64 x86_64 x86_64 GNU/Linux
Linux 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Manually specifying kernel version

If you have an specific requirement for an particular version of the kernal you can manually specify it. First we will need to see what kernel versions is available. For this we will run the following command:

apt-cache search linux-image
linux-image-3.13.0-24-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-24-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-24-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-virtual - Transitional package.
linux-image-generic - Generic Linux kernel image
linux-image-generic-lts-quantal - Generic Linux kernel image
linux-image-generic-lts-raring - Generic Linux kernel image
linux-image-generic-lts-saucy - Generic Linux kernel image
linux-image-generic-lts-trusty - Generic Linux kernel image
linux-image-lowlatency - lowlatency Linux kernel image
linux-image-server - Transitional package.
linux-image-virtual - This package will always depend on the latest minimal generic kernel image.
linux-virtual - Minimal Generic Linux kernel and headers
linux-image-generic-pae - Transitional package
linux-image-lowlatency-pae - Transitional package
linux-image-3.4.0-3-goldfish - Linux kernel image for version 3.4.0 on Android touch emulation
linux-image-goldfish - Linux kernel image for the goldfish kernel.
linux-image-3.13.0-27-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-27-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-29-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-29-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-30-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-30-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-32-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-32-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-33-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-33-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-34-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-34-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-35-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-35-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-36-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-36-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-37-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-37-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-39-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-39-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-40-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-40-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-41-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-41-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-43-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-43-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-44-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-44-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-45-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-45-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-46-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-46-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-48-generic - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.13.0-48-lowlatency - Linux kernel image for version 3.13.0 on 64 bit x86 SMP
linux-image-3.16.0-25-generic - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-25-lowlatency - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-26-generic - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-26-lowlatency - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-28-generic - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-28-lowlatency - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-29-generic - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-29-lowlatency - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-30-generic - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-30-lowlatency - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-31-generic - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-31-lowlatency - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-33-generic - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-3.16.0-33-lowlatency - Linux kernel image for version 3.16.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-27-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-29-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-30-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-32-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-33-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-34-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-35-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-36-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-37-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-39-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-40-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-41-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-43-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-44-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-45-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-46-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.13.0-48-generic - Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
linux-image-extra-3.16.0-25-generic - Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
linux-image-extra-3.16.0-26-generic - Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
linux-image-extra-3.16.0-28-generic - Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
linux-image-extra-3.16.0-29-generic - Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
linux-image-extra-3.16.0-30-generic - Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
linux-image-extra-3.16.0-31-generic - Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
linux-image-extra-3.16.0-33-generic - Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
linux-image-extra-virtual-lts-utopic - Transitional package.
linux-image-generic-lts-utopic - Generic Linux kernel image
linux-image-hwe-generic-trusty - Depends on the generic hardware enablement kernel image.
linux-image-hwe-virtual-trusty - Depends on the virtual hardware enablement kernel image.
linux-image-lowlatency-lts-utopic - lowlatency Linux kernel image
linux-image-virtual-lts-utopic - This package will always depend on the latest minimal generic kernel image.
linux-virtual-lts-utopic - Minimal Generic Linux kernel and headers

In our VPS, I have chosen to use the kernel version of linux-image-3.16.0-33-generic – Linux kernel image for version 3.16.0 on 64 bit x86 SMP. To install my chosen kernel I will use the following command:

apt-get install linux-image-3.16.0-33-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  fdutils linux-lts-utopic-tools linux-headers-3.16.0-33-generic
The following NEW packages will be installed
  linux-image-3.16.0-33-generic
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 16.0 MB of archives.
After this operation, 44.8 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main linux-image-3.16.0-33-generic amd64 3.16.0-33.44~14.04.1 [16.0 MB]
Fetched 16.0 MB in 0s (24.5 MB/s)                      
Selecting previously unselected package linux-image-3.16.0-33-generic.
(Reading database ... 37060 files and directories currently installed.)
Preparing to unpack .../linux-image-3.16.0-33-generic_3.16.0-33.44~14.04.1_amd64.deb ...
Done.
Unpacking linux-image-3.16.0-33-generic (3.16.0-33.44~14.04.1) ...
Setting up linux-image-3.16.0-33-generic (3.16.0-33.44~14.04.1) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.16.0-33-generic /boot/vmlinuz-3.16.0-33-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.16.0-33-generic /boot/vmlinuz-3.16.0-33-generic
update-initramfs: Generating /boot/initrd.img-3.16.0-33-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.16.0-33-generic /boot/vmlinuz-3.16.0-33-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.16.0-33-generic /boot/vmlinuz-3.16.0-33-generic
Generating grub configuration file ...
Found linux image: /boot/bzImage-3.10.23-xxxx-std-ipv6-64-vps
Found linux image: /boot/vmlinuz-3.16.0-33-generic
Found initrd image: /boot/initrd.img-3.16.0-33-generic
Found linux image: /boot/vmlinuz-3.13.0-48-generic
Found initrd image: /boot/initrd.img-3.13.0-48-generic
  No volume groups found
done

As always we will be looking to reboot our VPS again for the changes to take place and then to check the kernal version with uname -a.

Linux 3.16.0-33-generic #44~14.04.1-Ubuntu SMP Fri Mar 13 10:33:29 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux