OVH Community, your new community space.

Compiling a new kernel - How? Is it difficult?

13-05-2009, 23:04

would this be possible with an openvz kernal?


05-05-2009, 13:24
Quote Originally Posted by monkey56657
Did you reboot for test?
I hadn't at the time as it was getting late and I didn't want to have to mess around with recovery/rescue if it failed - But I have now and it worked first time

Quote Originally Posted by Palad1n
Download the sources from OVH FTP Site, not from
I'll bear that in mind next time - But the sources seem to have worked ok

Reboot took less than two minutes - It was a bit of a tense two minutes I'll admit but everything came back up beautifully

I haven't tried dynamically loading any modules as yet and won't get a chance to until the weekend now but 'modprobe -l' shows that there's one already loaded (/lib/modules/ so I'm hopeful

05-05-2009, 11:16
Hi Kitty,

Download the sources from OVH FTP Site, not from

The OVH Sources have all the drivers for their servers, and use the OVH config that matches the version correctly, 32/64, grs/no grs etc.

That should get rid of the error you are getting.

05-05-2009, 02:48
Seems fine to me. Did you reboot for test ?

04-05-2009, 23:43
OK - So what I've done is -
cd /usr/src
tar xf linux-
cd linux-
make mrproper
cp 2.6-config-xxxx-std-ipv4-32 .config
make menuconfig
During the menuconfig I set 'Enable loadable module support' to 'include'
[*] Enable loadable module support --->
and then saved the .config

I then did -
Which threw up two warnings -
drivers/acpi/scan.c:1165: warning: 'acpi_is_child_device' defined but not used

WARNING: modpost: Found 2 section mismatch(es).
To see full details build your kernel with:
So I did that and got this -
drivers/acpi/scan.c:1165: warning: 'acpi_is_child_device' defined but not used

MODPOST vmlinux.o
WARNING: vmlinux.o(.text+0x1c4ae): Section mismatch in reference from the function cpu_exit_clear() to the function .cpuinit.text:cpu_uninit()
The function cpu_exit_clear() references
the function __cpuinit cpu_uninit().
This is often because cpu_exit_clear lacks a __cpuinit
annotation or the annotation of cpu_uninit is wrong.

WARNING: vmlinux.o( Section mismatch in reference from the variable initial_code to the function .init.text:i386_start_kernel()
The variable __cpuinitdata initial_code references
a function __init i386_start_kernel().
If i386_start_kernel is only used by initial_code then
annotate i386_start_kernel with a matching annotation.
I'm kind of thinking that doesn't matter too much as it's a warning and not an error and because it also said
Kernel: arch/x86/boot/bzImage is ready
Or do the warnings matter?

Anyway - I then went on to -
make modules
make modules_install
Which didn't throw any errors or warnings

I then copied the new kernel to /boot and edited /etc/lilo.conf
cp arch/i386/boot/bzImage /boot/bzImage-
vi /etc/lilo.conf
The new file looks like this - All I did was change the name of the bzImage file

So I guess I'm good to go!

I'm wondering whether I should have done the full 'make install' thing which a lot of places say to do - It might have copied a new '' file into /boot but I'm hoping the original will be usable - I also didn't do any 'mkinitrd -o' stuff

But before I reboot I want to make sure that I understand the Rescue Mode thing correctly - If it all does go wrong then given that I still have the original kernel would I be able to boot to Rescue and then simply SSH in and update the lilo.conf to point back to that and reboot?

Notes -
- IanK's post here was invaluable -
- I chose the linux- kernel because that's what's already installed and I thought it perhaps best to go with the same one in case there was anything somewhere on the system that might not otherwise match
- I chose the 2.6-config-xxxx-std-ipv4-32 because that seemed the closest match
- If this works then hopefully anyone else who's contemplating a kernel compile for the first time and who worries as much as I do will be reassured that it's not quite so scary

04-05-2009, 14:12
Generally speaking, compiling the kernel is not big stuff. You can do that while the server is running other applications, but at a certain point, you'll have to reboot the server from the new kernel, and means that you'll have to be ready for a downtime, and also be ready for problems in the booting process.

If a new kernel doesn't boot, and therefore the server doesn't ping, our engineers will go to the server and reboot it, in the worst of the cases in rescue mode so you can fix the problem.

Use of boot loaders such as lilo and grub is good as it allows you to switch booting from one kernel to another easily.

But in any case, compiling the kernel doesn't do anything with the applications installed. You can boot from any kernel using the same machine. The OVH tools as the manager or the MRTG graphs don't depend on the server itself.

Well, I hope that more or less I've answered most of your doubts. Still, read some sites on the step-by-step process as we won't be able to support you on that.

Cheers, guys!

04-05-2009, 12:55
I can answer #7... Yes, they'll still be available. The data is gathered from the switch, not your server.

04-05-2009, 12:17

I currently have a box running CentOS 5.2 and the OVH kernel - I'm looking to compile a new modular kernel so that I can use TC/qdiscs and a few other things which seem to be difficult if not impossible using the stock OVH static version

The server has no control panel - I started with a basic install and have setup all the apps and config bits manually

The box is currently up and running live services and I don't want to have to reinstall everything or re-setup all my HTTP/PHP/Postfix and other configurations

I've read everything that comes up in a search here for 'kernel' or 'recompile' including IanK's advice (in a thread which I can't currently find!) and the guide to installing CentOS 5 via VNC at but I've never done anything like this before so before I mess things up completely I have a few questions

  1. Is it very difficult to do? I'm not a total Linux n00b and I'm competent enough with the CLI to have manually installed and configured what I need so far and I'm not too scared of trying stuff
  2. Is recompiling the kernel in any way the same as reinstalling the OS? I think what I mean is will I end up with a different/original 'stock' OS? I'm not clear where the boundary between the kernel and the distro actually is - I'm guessing that the 'Install CentOS 5' guide isn't what I actually need but I'd like to be sure - Or maybe it is? Would that be a better plan?
  3. Can I do this on a currently-active machine?
  4. Will I lose any of my currently installed apps/config/data?
  5. Will I need to know lots of obscure switches/options or is there an easy way to use some pre-existing ones?
  6. If it all goes horribly wrong and the machine fails to boot or something else happens is there a way to recover the original kernel without a full format/reinstall?
  7. Will the OVH MRTG and other things sill be available? If not can I reinstall them?
  8. Will the extra IP addresses on the box still be available or will they need to be setup again?

Lots of questions! And I'm sure there's lots of other things I should be addressing before I attempt this (or are there? Am I imagining that this will be more difficult and complicated than it actually is?) but those are the ones that come to mind at the moment

Any help or advice (or HowTo/guides!) would most appreciated