OVH Community, your new community space.

Compiling a new kernel - How? Is it difficult?


guardhost
13-05-2009, 22:04
Hi,

would this be possible with an openvz kernal?

Thanks

Kitty
05-05-2009, 12: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 Kernel.org
I'll bear that in mind next time - But the kernel.org 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/2.6.27.10-xxxx-std-ipv4-32/kernel/drivers/scsi/scsi_wait_scan.ko) so I'm hopeful

Palad1n
05-05-2009, 10:16
Hi Kitty,

Download the sources from OVH FTP Site, not from Kernel.org.

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.

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

Kitty
04-05-2009, 22:43
OK - So what I've done is -
Code:
cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.27.10.tar.bz2
tar xf linux-2.6.27.10.tar.bz2
cd linux-2.6.27.10
make mrproper
wget ftp://ftp.ovh.net/made-in-ovh/bzImage/2.6-config-xxxx-std-ipv4-32
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 -
Code:
make
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:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
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(.cpuinit.data+0x0): 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 -
Code:
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
Code:
cp arch/i386/boot/bzImage /boot/bzImage-2.6.27.10-kitty-grs-ipv4-32
vi /etc/lilo.conf
The new file looks like this - All I did was change the name of the bzImage file
prompt
timeout=50
default=linux
boot=/dev/sda
map=/boot/map
install=/boot/boot.b
lba32
append=""
#serial=0,9600n8

image=/boot/bzImage-2.6.27.10-kitty-grs-ipv4-32
label=linux
read-only
root=/dev/sda2
Then
Code:
/sbin/lilo
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 'System.map-2.6.27.10' 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 - http://forum.ovh.co.uk/showpost.php?p=2985&postcount=2
- I chose the linux-2.6.27.10.tar.bz2 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

marks
04-05-2009, 13: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!

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

Kitty
04-05-2009, 11:17
Hello

I currently have a box running CentOS 5.2 and the OVH 2.6.27.10-grsec-xxxx-grs-ipv4-32 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 http://evcz.tk/blog/2008/10/21/remote-centos-install/ 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