Fli
09-11-2013, 09:03 AM
This tutorial should help you with changing OVH default kernel of CentOS to a default CentOS kernel and help you to install ip_gre module (or other one of your choice)
Warning: this process of changing kernel is risky, and it may lead into state you cant boot your server. Follow this tutorial on your own risk.
Installing Kernel
Installing default kernel:
yum install kernel
If Kernel installation failed
may return: No package kernel available.
So it means you need to add default repositories from which linux will download data. For my Centos 5.x i used following process to backup yum configuration file, empty default one and edit it:
cp /etc/yum.conf /etc/yum.conf_bckp;> /etc/yum.conf;vi /etc/yum.conf
hit "a" key and add this content into empty default yum.conf file (i use right mouse button to paste in putty):
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
enabled=1
#released updates
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
enabled=1
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
enabled=1
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
enabled=1
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
[kbs-CentOS-Extras]
name=CentOS.Karan.Org-EL$releasever - Stable
gpgcheck=1
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
enabled=1
baseurl=http://centos.karan.org/el$releasever/extras/stable/$basearch/RPMS/
[kbs-CentOS-Misc]
name=CentOS.Karan.Org-EL$releasever - Stable
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
gpgcheck=1
enabled=1
baseurl=http://centos.karan.org/el$releasever/misc/stable/$basearch/RPMS/
[kbs-CentOS-Misc-Testing]
name=CentOS.Karan.Org-EL$releasever - Testing
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
gpgcheck=1
enabled=1
baseurl=http://centos.karan.org/el$releasever/misc/testing/i386/RPMS/
Do Ctrl + C keyboard shortcut and then type and execute: :wq (to save changes and quit vi editor)
then:
yum clean all;yum install kernel
y
[B][U]Kernel is installed now
It installed this in my case: Downloading Packages:kernel-2.6.18-348.16.1.el5.centos.plus.x86_64.rpm | 24 MB
then:
ls -al /boot
you should see some vmlinuz-x.x.x... and initramfs-... / initrd-..... entry there, if so, it is OK. I seen only vmzlinuz.... and initrd....., no initramfs
copy/write down vmzlinuz... and initramfs.../initrd filenames, in my case:
vmlinuz-2.6.18-348.16.1.el5.centos.plus
initrd-2.6.18-348.16.1.el5.centos.plus.img
then do:
df
copy/write down name of the "/" partition.
in my case it returned to me:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md2 10157944 1309424 8336576 14% /
/dev/md3 1927440852 200236 1830103316 1% /home
tmpfs 16456396 0 16456396 0% /dev/shm
so i coppied /dev/md2
Making sure proper kernel is loaded on boot
Then backup grub files (ones that tells the system which kernel to load?) and remove rm /etc/grub.conf + open /boot/grub/grub.conf:
cp /etc/grub.conf /etc/grub.conf_bckp; cp /boot/grub/grub.conf /boot/grub/grub.conf_bckp;rm -rf /etc/grub.conf;vi /boot/grub/grub.conf
now make sure that kernel and initrd files as writen bellow really exist in your /boot folder, we did ls -la /boot and you have been told to write down the initramfs.../initrd filenames.. so check if it match with following:)
default=0
timeout=5
title CentOS (2.6.18-348.16.1.el5.centos.plus)
kernel /boot/vmlinuz-2.6.18-348.16.1.el5.centos.plus root=/dev/md2 ro
root (hd0,1)
initrd /boot/initrd-2.6.18-348.16.1.el5.centos.plus.img
title linux centos5_64
kernel /boot/bzImage-3.10.9-xxxx-grs-ipv6-64 root=/dev/md2 ro
root (hd0,1)
If you are 100% sure, that initrd and kernel filenames exist in your /boot (you checked before) you can reboot your server. If there is any mistake, bug in the above grub file (it should not be), your linux may not start again (need of recovery mode boot, not everyone support it, possible all server data lost if cant boot in recovery mode)
reboot
a) if your server DOES NOT boot after X minutes, you may go to OVH manager, set your netboot to rescue-pro and reboot server. Then replace /boot/grub/grub.conf by your backup /boot/grub/grub.conf_bckp and restart.
b) if your server booted OK after kernel change (you loged back via SSH), do:
uname -a
i see: "Linux myhostname 2.6.18-348.16.1.el5.centos.plus #1 SMP Wed Aug 21 04:04:49 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux"
PROCESS SHOULD BE COMPLETE NOW. :rolleyes:
Installing kernel module which did not worked
Then i install the module ip_gre which i wanted in kernel, but it did not worked on OVH kernel:
modprobe ip_gre
It was executed and returned NO error now..
modprobe -l | grep gre
("gre" is the part of the module name i want to check if exist)
/lib/modules/2.6.18-348.16.1.el5.centos.plus/kernel/net/ipv4/ip_gre.ko
/lib/modules/2.6.18-348.16.1.el5.centos.plus/kernel/net/sched/sch_gred.ko
/lib/modules/2.6.18-348.16.1.el5.centos.plus/kernel/net/sched/sch_ingress.ko
lsmod | grep gre
ip_gre 47457 0
It appears ip_gre is installed?
modinfo ip_gre
filename: /lib/modules/2.6.18-348.16.1.el5.centos.plus/kernel/net/ipv4/ip_gre.kolicense: GPL
srcversion: EFBBE75F6B5528DC131B383
depends:
vermagic: 2.6.18-348.16.1.el5.centos.plus SMP mod_unload gcc-4.1
module_sig: .................
Warning: this process of changing kernel is risky, and it may lead into state you cant boot your server. Follow this tutorial on your own risk.
Installing Kernel
Installing default kernel:
yum install kernel
If Kernel installation failed
may return: No package kernel available.
So it means you need to add default repositories from which linux will download data. For my Centos 5.x i used following process to backup yum configuration file, empty default one and edit it:
cp /etc/yum.conf /etc/yum.conf_bckp;> /etc/yum.conf;vi /etc/yum.conf
hit "a" key and add this content into empty default yum.conf file (i use right mouse button to paste in putty):
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
enabled=1
#released updates
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
enabled=1
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
enabled=1
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
enabled=1
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
[kbs-CentOS-Extras]
name=CentOS.Karan.Org-EL$releasever - Stable
gpgcheck=1
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
enabled=1
baseurl=http://centos.karan.org/el$releasever/extras/stable/$basearch/RPMS/
[kbs-CentOS-Misc]
name=CentOS.Karan.Org-EL$releasever - Stable
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
gpgcheck=1
enabled=1
baseurl=http://centos.karan.org/el$releasever/misc/stable/$basearch/RPMS/
[kbs-CentOS-Misc-Testing]
name=CentOS.Karan.Org-EL$releasever - Testing
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
gpgcheck=1
enabled=1
baseurl=http://centos.karan.org/el$releasever/misc/testing/i386/RPMS/
Do Ctrl + C keyboard shortcut and then type and execute: :wq (to save changes and quit vi editor)
then:
yum clean all;yum install kernel
y
[B][U]Kernel is installed now
It installed this in my case: Downloading Packages:kernel-2.6.18-348.16.1.el5.centos.plus.x86_64.rpm | 24 MB
then:
ls -al /boot
you should see some vmlinuz-x.x.x... and initramfs-... / initrd-..... entry there, if so, it is OK. I seen only vmzlinuz.... and initrd....., no initramfs
copy/write down vmzlinuz... and initramfs.../initrd filenames, in my case:
vmlinuz-2.6.18-348.16.1.el5.centos.plus
initrd-2.6.18-348.16.1.el5.centos.plus.img
then do:
df
copy/write down name of the "/" partition.
in my case it returned to me:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md2 10157944 1309424 8336576 14% /
/dev/md3 1927440852 200236 1830103316 1% /home
tmpfs 16456396 0 16456396 0% /dev/shm
so i coppied /dev/md2
Making sure proper kernel is loaded on boot
Then backup grub files (ones that tells the system which kernel to load?) and remove rm /etc/grub.conf + open /boot/grub/grub.conf:
cp /etc/grub.conf /etc/grub.conf_bckp; cp /boot/grub/grub.conf /boot/grub/grub.conf_bckp;rm -rf /etc/grub.conf;vi /boot/grub/grub.conf
now make sure that kernel and initrd files as writen bellow really exist in your /boot folder, we did ls -la /boot and you have been told to write down the initramfs.../initrd filenames.. so check if it match with following:)
default=0
timeout=5
title CentOS (2.6.18-348.16.1.el5.centos.plus)
kernel /boot/vmlinuz-2.6.18-348.16.1.el5.centos.plus root=/dev/md2 ro
root (hd0,1)
initrd /boot/initrd-2.6.18-348.16.1.el5.centos.plus.img
title linux centos5_64
kernel /boot/bzImage-3.10.9-xxxx-grs-ipv6-64 root=/dev/md2 ro
root (hd0,1)
If you are 100% sure, that initrd and kernel filenames exist in your /boot (you checked before) you can reboot your server. If there is any mistake, bug in the above grub file (it should not be), your linux may not start again (need of recovery mode boot, not everyone support it, possible all server data lost if cant boot in recovery mode)
reboot
a) if your server DOES NOT boot after X minutes, you may go to OVH manager, set your netboot to rescue-pro and reboot server. Then replace /boot/grub/grub.conf by your backup /boot/grub/grub.conf_bckp and restart.
b) if your server booted OK after kernel change (you loged back via SSH), do:
uname -a
i see: "Linux myhostname 2.6.18-348.16.1.el5.centos.plus #1 SMP Wed Aug 21 04:04:49 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux"
PROCESS SHOULD BE COMPLETE NOW. :rolleyes:
Installing kernel module which did not worked
Then i install the module ip_gre which i wanted in kernel, but it did not worked on OVH kernel:
modprobe ip_gre
It was executed and returned NO error now..
modprobe -l | grep gre
("gre" is the part of the module name i want to check if exist)
/lib/modules/2.6.18-348.16.1.el5.centos.plus/kernel/net/ipv4/ip_gre.ko
/lib/modules/2.6.18-348.16.1.el5.centos.plus/kernel/net/sched/sch_gred.ko
/lib/modules/2.6.18-348.16.1.el5.centos.plus/kernel/net/sched/sch_ingress.ko
lsmod | grep gre
ip_gre 47457 0
It appears ip_gre is installed?
modinfo ip_gre
filename: /lib/modules/2.6.18-348.16.1.el5.centos.plus/kernel/net/ipv4/ip_gre.kolicense: GPL
srcversion: EFBBE75F6B5528DC131B383
depends:
vermagic: 2.6.18-348.16.1.el5.centos.plus SMP mod_unload gcc-4.1
module_sig: .................