5

In my spare time, I help administer a hosted Debian Linux server that serves a variety of websites and hosts email for a few people. It doesn't see huge volumes of traffic, but of course we want to do things properly. However, when we first got this server, someone rolled a custom kernel for us which allowed us to do various things that we wanted to do (like LVM, RAID etc). That's now a few years ago and of course there's various security bugs been fixed etc and we'd rather just be operating from a stock kernel that is kept up-to-date.

The problem is that we don't have a list of the features we enabled when we rolled the custom kernel and a couple of attempts to use a new one have resulted in a kernal that won't boot. So the question is - how do we go about using the stock Debian kernels whilst still being able to have all the functionality we depend on? What information do I need to gather first, and then what are the steps to make it happen?

4 Answers 4

5

First, you need to assess what exactly you require your kernel to do. This means building a list of:

  • Every piece of hardware in your system
  • Hardware-related functions, like LVM and RAID
  • Networking functions, like routing, VPNs, wireless support, etc.
  • Filesystems, especially your root filesystem
  • Other special kernel-level needs

Next, you should try to figure out how your current kernel is handling them, and then try translating that to a newer kernel. For this, you can look at:

  • The outputs of lspci and dmesg - this will help you catalog hardware and what the current kernel does on boot
  • What modules are loaded - look at lsmod
  • The kernel configuration, if available - sometimes this exists at /proc/config.gz or in /boot

Once you know your hardware, and how the current kernel is dealing with it, you can roll a new kernel from the Debian sources. Focus on getting a kernel that boots first. Once you can get into a shell with your new kernel, you can take an incremental approach to the rest of your features. Recompile, adding features or drivers as necessary (perhaps as modules to speed up this process), then test each new kernel.

One last word about RAID. You should be careful about your current RAID setup, if it's software RAID - newer kernels and systems will use mdadm for managing that kind of thing, whereas older systems tend to use the raidtab approach. Your approach will change how you deal with RAID in-kernel, especially the autodetection bits. Take a look at the excellent Software RAID Howto for more info.

1

If the person that built your custom kernel did it the debian way they there may be a file in the directory /boot named config-2.?.? that will tell you what options where used when building the kernel.

Since you aren't sure, I guess I would start by just grabbing a Debian livecd and see if a stock kernel on a livecd allows you to boot access all your hardware, and disks. If you can get everything working from a livecd, then you just need to get that kernel installed.

You mention you tried a stock kernel and it won't boot. What exactly is the error, perhaps if you post the messages we may be able to provide more help.

2
  • Unfortunately, as I said in the question, it's a remote server, so I can't just pop a LiveCD in it and play around. Also various people run websites on it that they wouldn't like being taken down for chunks of time whilst I figure out how to sort it out... As for post messages - same thing, don't want to reboot unless I'm pretty confident I can make it come back up with a new kernel...
    – x3ja
    May 18, 2009 at 18:17
  • See if you can build a test VM that is identical to your running system and then try upgrading?
    – Zoredache
    May 18, 2009 at 18:35
1

Do you have /proc/config.gz or /boot/config-X.X.X for your current kernel?

If you do, just diff your config and the Debian one.

For what it's worth, the Debian configs enable pretty much everything - definitely RAID, LVM etc. Just make sure the initrd gets built when you install the Debian kernel as most things are modular in their kernel.

I haven't come across anything where I've had to build a custom kernel for a Debian server in a long time, except when I wanted to add kernel patches for whatever reason.

0

Setup your grub to boot your custom kernel as a Fallback System to ensure that the server comes back up again even if the new kernel fails to boot.

Using that, you can safely apt-get install the linux-image for your hardware architecture, wich is most likely either linux-image-686 or linux-image-amd64 and try to reboot into that kernel.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .