How to change OVH kernel to normal Centos kernel

I’ve just installed new OVH server on Centos 6.3. And I spotted a problem – I couldn’t install KVM services due to lack of KVM kernel modules. And I wasn’t able to load them because this fresh installation used some OVH kernel which was wiped out of those modules…

So I had two ways of solving this issue. Recompiling kernel from scratch and adding KVM modules (long way – and what for? It just consumes so much time…) or.. just revert stock Centos kernel :) And this was the way I chose.

Whole procedure is just trivial. First thing – let’s install new kernel (stock one) with yum:

[email protected] ~]# yum install kernel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
base                                                                                                                                             | 3.7 kB     00:00
extras                                                                                                                                           | 3.5 kB     00:00
updates                                                                                                                                          | 3.5 kB     00:00
Setting up Install Process
Package kernel-2.6.32-279.19.1.el6.x86_64 already installed and latest version
Nothing to do

When installed, we need to include it in the boot loader – which is Grub by default in Centos. In order to do it properly, we have to know our kernel version (so this one we’re given after yum install kernel command, so: kernel-2.6.32-279.19.1.el6.x86_64 in my case and the device, which hosts our root partition – we can check this with mount command and the contents of /etc/fstab directory:

/dev/md1       /        ext4    errors=remount-ro       0       1
/dev/md2        /home   ext4    defaults        0       2
/dev/sda3       none    swap    defaults        0       0
/dev/sdb3       none    swap    defaults        0       0

Above we see that / directory is hosted on /dev/md1 device. So now we can modify /boot/grub/grub.conf:

    title linux centos6_64
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.32-279.19.1.el6.x86_64 root=/dev/md1/strong>
    initrd /boot/initramfs-2.6.32-279.19.1.el6.x86_64.img

Now after double-check we just reboot our system and wait.. If it’s up then let’s be sure, that we got our stock centos kernel:

[[email protected] ~]# uname -r

So we’re good :) If for some reason server is not coming back after reboot then We can rescue it by booting it into rescue-mode in OVH manager. Then we need to replace /boot/grub/grub.conf with our backup /boot/grub/grub.conf.bak