# OVH Kernel

Instructions on how to change the kernel on an OVH server from the OVH supplied kernel to the official distribution kernel.


# Ubuntu

Instructions here are written for 16.04, but should be similar for 18.04.

# Check the Current Kernel Version

An OVH kernel has the xxxx-std-ipv6-64 suffix as seen below.

root@nsxxxxxx:~# uname -a
Linux nsxxxxxx 4.9.103-xxxx-std-ipv6-64 #222672 SMP Mon Jun 4 15:16:03 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

# Remove Execute Permission

Removing the execute permission stops grub from using this file to generate its configuration.

root@nsxxxxxx:~# chmod -x /etc/grub.d/06_OVHkernel
root@nsxxxxxx:~# ls -lah /etc/grub.d/
total 88K
drwxr-xr-x  2 root root 4.0K Jul 18 18:16 .
drwxr-xr-x 95 root root 4.0K Jul 27 10:27 ..
-rwxr-xr-x  1 root root 9.6K Feb  8  2018 00_header
-rwxr-xr-x  1 root root 6.2K Jan 24  2018 05_debian_theme
-rw-r--r--  1 1000 1000  372 Jul 18 18:12 06_OVHkernel
-rwxr-xr-x  1 root root  13K Feb  8  2018 10_linux
-rwxr-xr-x  1 root root  11K Feb  8  2018 20_linux_xen
-rwxr-xr-x  1 root root  12K Feb  8  2018 30_os-prober
-rwxr-xr-x  1 root root 1.4K Feb  8  2018 30_uefi-firmware
-rwxr-xr-x  1 root root  214 Feb  8  2018 40_custom
-rwxr-xr-x  1 root root  216 Feb  8  2018 41_custom
-rw-r--r--  1 root root  483 Feb  8  2018 README

# Install Distribution Kernel

The name of the distribution kernel starts with linux-generic so we'll run:

apt-get update && apt-get install -y linux-generic

We installed 4.4.0-135-generic with the above command.

Check the contents of /boot

root@nsxxxxxx:~# ls -lah /boot
total 69M
drwxr-xr-x  3 root root 1.0K Sep 12 20:24 .
drwxr-xr-x 21 root root 4.0K Sep 12 20:23 ..
-rw-r--r--  1 root root 1.2M Aug 27 14:51 abi-4.4.0-135-generic
-rw-r--r--  1 root root 187K Aug 27 14:51 config-4.4.0-135-generic
-rw-r--r--  1 root root 102K Jun  4 17:16 config-4.9.103-xxxx-std-ipv6-64
drwxr-xr-x  5 root root 1.0K Sep 12 20:24 grub
-rw-r--r--  1 root root  37M Sep 12 20:24 initrd.img-4.4.0-135-generic
-rw-r--r--  1 root root 8.2M Sep 12 20:24 initrd.img-4.9.103-xxxx-std-ipv6-64
-rw-r--r--  1 root root  255 Aug 27 14:51 retpoline-4.4.0-135-generic
-rw-------  1 root root 3.8M Aug 27 14:51 System.map-4.4.0-135-generic
-rw-r--r--  1 root root 3.1M Jun  4 17:16 System.map-4.9.103-xxxx-std-ipv6-64
-rw-------  1 root root 6.9M Aug 27 14:51 vmlinuz-4.4.0-135-generic
-rw-r--r--  1 root root 9.1M Jun  4 17:16 vmlinuz-4.9.103-xxxx-std-ipv6-64

# Delete the OVH Kernel

root@nsxxxxxx:~# rm /boot/*xxxx-std-ipv6-64
root@nsxxxxxx:~# ls -lah /boot
total 49M
drwxr-xr-x  3 root root 1.0K Sep 12 20:31 .
drwxr-xr-x 21 root root 4.0K Sep 12 20:23 ..
-rw-r--r--  1 root root 1.2M Aug 27 14:51 abi-4.4.0-135-generic
-rw-r--r--  1 root root 187K Aug 27 14:51 config-4.4.0-135-generic
drwxr-xr-x  5 root root 1.0K Sep 12 20:26 grub
-rw-r--r--  1 root root  37M Sep 12 20:24 initrd.img-4.4.0-135-generic
-rw-r--r--  1 root root  255 Aug 27 14:51 retpoline-4.4.0-135-generic
-rw-------  1 root root 3.8M Aug 27 14:51 System.map-4.4.0-135-generic
-rw-------  1 root root 6.9M Aug 27 14:51 vmlinuz-4.4.0-135-generic

# Update Grub

On Ubuntu, we can just run update-grub to generate the grub config.

root@nsxxxxxx:~# update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.4.0-135-generic
Found initrd image: /boot/initrd.img-4.4.0-135-generic
done

# Reboot

Reboot your server now and then check the kernel again with uname -a

root@nsxxxxxx:~# uname -a
Linux nsxxxxxx 4.4.0-135-generic #161-Ubuntu SMP Mon Aug 27 10:45:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Confirm that you are now on the official kernel, all done.

# Centos 7

# Check the Current Kernel Version

An OVH kernel has the xxxx-std-ipv6-64 suffix as seen below.

[root@nsxxxxxx ~]# uname -a
Linux nsxxxxxx 4.9.126-xxxx-std-ipv6-64 #363650 SMP Mon Sep 10 12:52:22 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

# Remove Execute Permission

Removing the execute permission stops grub from using this file to generate its configuration.

[root@nsxxxxxx ~]# chmod -x /etc/grub.d/06_OVHkernel
[root@nsxxxxxx ~]# ls -lah /etc/grub.d/
total 84K
drwx------  2 root root 4.0K Sep 12 19:48 .
drwxr-xr-x 85 root root 4.0K Sep 12 19:54 ..
-rwxr-xr-x  1 root root 8.5K Oct 21  2017 00_header
-rwxr-xr-x  1 root root 1.1K Oct 29  2017 00_tuned
-rwxr-xr-x  1 root root  232 Oct 21  2017 01_users
-rw-r--r--  1 1000 1000  372 Sep 12 19:49 06_OVHkernel
-rwxr-xr-x  1 root root  11K Oct 21  2017 10_linux
-rwxr-xr-x  1 root root  11K Oct 21  2017 20_linux_xen
-rwxr-xr-x  1 root root 2.5K Oct 21  2017 20_ppc_terminfo
-rwxr-xr-x  1 root root  11K Oct 21  2017 30_os-prober
-rwxr-xr-x  1 root root  214 Oct 21  2017 40_custom
-rwxr-xr-x  1 root root  216 Oct 21  2017 41_custom
-rw-r--r--  1 root root  483 Oct 21  2017 README

# Install Distribution Kernel

yum install -y kernel

We installed 3.10.0-862.11.6.el7 with the above command.

Check the contents of /boot

[root@nsxxxxxx ~]# ls -lah /boot
total 72M
dr-xr-xr-x  5 root root 4.0K Sep 12 20:08 .
dr-xr-xr-x 17 root root 4.0K Sep 12 19:53 ..
-rw-r--r--  1 root root 145K Aug 14 23:02 config-3.10.0-862.11.6.el7.x86_64
-rw-r--r--  1 root root 103K Sep 10 13:52 config-4.9.126-xxxx-std-ipv6-64
drwxr-xr-x  3 root root 4.0K Aug  1 01:01 efi
drwxr-xr-x  2 root root 4.0K Aug  1 01:03 grub
drwx------  5 root root 4.0K Sep 12 20:08 grub2
-rw-------  1 root root  20M Sep 12 20:08 initramfs-3.10.0-862.11.6.el7.x86_64.img
-rw-------  1 root root  17M Sep 12 19:49 initramfs-4.9.126-xxxx-std-ipv6-64.img
-rw-r--r--  1 root root 299K Aug 14 23:05 symvers-3.10.0-862.11.6.el7.x86_64.gz
-rw-------  1 root root 3.3M Aug 14 23:02 System.map-3.10.0-862.11.6.el7.x86_64
-rw-r--r--  1 root root 3.1M Sep 10 13:52 System.map-4.9.126-xxxx-std-ipv6-64
-rwxr-xr-x  1 root root  14M Sep 10 13:52 vmlinux-4.9.126-xxxx-std-ipv6-64.bz2
-rwxr-xr-x  1 root root 6.0M Aug 14 23:02 vmlinuz-3.10.0-862.11.6.el7.x86_64
-rw-r--r--  1 root root  171 Aug 14 23:02 .vmlinuz-3.10.0-862.11.6.el7.x86_64.hmac
-rw-r--r--  1 root root 9.7M Sep 10 13:52 vmlinuz-4.9.126-xxxx-std-ipv6-64

# Update Grub

First confirm that your grub2.cfg file is at /etc/grub2.cfg.

[root@nsxxxxxx ~]# ls -lah /etc/grub2.cfg
lrwxrwxrwx 1 root root 22 Aug  1 01:04 /etc/grub2.cfg -> ../boot/grub2/grub.cfg

Run the command to generate the new configuration

[root@nsxxxxxx ~]# grub2-mkconfig -o "$(readlink -e /etc/grub2.cfg)"
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.9.126-xxxx-std-ipv6-64
Found initrd image: /boot/initramfs-4.9.126-xxxx-std-ipv6-64.img
Found linux image: /boot/vmlinuz-3.10.0-862.11.6.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.11.6.el7.x86_64.img
done

# Reboot

Reboot your server and then check it afterwards:

[root@nsxxxxxx ~]# uname -a
Linux nsxxxxxx 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

You should now be on the correct kernel.

Last Updated: 2021/03/31 12:28+00:00