5

When upgrading the kernel package on CentOS or RHEL 6, is it possible to load the new kernel without rebooting?

My gut tells me it's not, but if it were, it'd be handy - especially when compiling applications that require kernel modules (like VirtualBox, for example) that complain when the "wrong" kernel source is available (eg the running kernel is 2.6.2-100 but the upgraded one is 2.6.2-152).

6 Answers 6

5

No.

kexec will allow you to skip the firmware (BIOS/EFI) and bootloader steps of a standard restart, but this is not the same thing (though useful if you have a slow loading RAID card).

The closest you can get is loading and unloading kernel modules.

3
  • that's a shame :| .. thanks, though :)
    – warren
    Jan 18, 2012 at 23:06
  • "loading and unloading kernel modules" - can you actually load kernel-modules of a newer kernel? Sounds tricky to me.
    – Nils
    Mar 7, 2012 at 20:17
  • Didn't mean to imply the loading of modules from newer kernel, just modules that may not have been built on the same version.
    – 84104
    Mar 7, 2012 at 21:05
2

Oracle Enterprise Linux can do that with KSplice, but you have to have an oracle ULN (support) contract for it. I believe they are about $120. http://www.ksplice.com/pricing

2

Yes for RHEL. (Since Feb 22, 2012)

Oracle Offers Free Trial of Innovative Ksplice Zero-Downtime Updates to Red Hat Customers

To continue after the 30 day trial, you need to purchase the Oracle Linux Premier Support package.

Pricing starts at $1,400 for systems with two physical CPUs and $2,300 for systems with more than two physical CPUs. You can configure your systems to automatically install updates as they become available.

It had been offered for both RHEL and CentOS (as well as other operating systems) prior to July, 2011 when Oracle acquired Ksplice. Prior customers are still supported.
Oracle buys Ksplice

The Ksplice code was created and distributed under the GPL v2 and other open source licenses. After Oracle acquired Ksplice and limited availability to Oracle Linux, Ubuntu Desktop, and Fedora, there was discussion about maintaining a CentOS fork of Ksplice:
Ksplice and CentOS

It was also argued that Ksplice was violating the GPL:
Ksplice currently violates the GPL

2

Nobody pointed to kpatch. It not live kernel reload, but targeted same problem.

kpatch Red Hat technology to apply patches to live kernel.

With respect to granularity, kpatch works at the function level; put simply, old functions are replaced with new ones. It has four main components:

  • kpatch-build: a collection of tools which convert a source diff patch to a hot patch module. They work by compiling the kernel both with and without the source patch, comparing the binaries, and generating a hot patch module which includes new binary versions of the functions to be replaced.
  • hot patch module: a kernel module (.ko file) which includes the replacement functions and metadata about the original functions.
  • kpatch core module: a kernel module (.ko file) which provides an interface for the hot patch modules to register new functions for replacement. It uses the kernel ftrace subsystem to hook into the original function’s mcount call instruction, so that a call to the original function is redirected to the replacement function.
  • kpatch utility: a command-line tool which allows a user to manage a collection of hot patch modules. One or more hot patch modules may be configured to load at boot time, so that a system can remain patched even after a reboot into the same version of the kernel.

Supported from RHEL 7

4
  • 1
    But the OP is asking about loading an entire new kernel, not replacing modules or functions. Oct 3, 2015 at 20:32
  • 1
    Yes. But other question marked as duplicate (serverfault.com/questions/366974/kernel-update-without-reboot) ask about kernel update. I expect, kernel reloaded in live not just for fun, but to be updated and keep uptime.
    – mmv-ru
    Oct 3, 2015 at 22:08
  • I'm sure no one else mentioned it because the OP is from 2012 .. and this is only supported in RHEL7 :)
    – warren
    Oct 4, 2015 at 0:50
  • but in RHEL7 it is not a complete reloading of the kernel. It is only patching certain parts of it. So the answer to the original question still remains: "No". Oct 4, 2015 at 15:40
1

KExec claims that you can do exactly that.

4
  • how does kexec work, and can it be automated to fire as soon as a kernel is upgraded?
    – warren
    Jan 18, 2012 at 22:17
  • From the link @monksy gave: "Essentially, kexec is a fast reboot feature that lets you reboot to a new Linux kernel -- without having to go through a bootloader." No mention of it being automated, it seems unlikely based on this statement: "Unlike the normal reboot process, kexec does not perform a clean shutdown of the system before rebooting. It is left to you to kill all applications and unmount file systems before attempting a kexec reboot."
    – codewaggle
    May 19, 2012 at 19:50
  • 1
    kexec was mostly aimed at industrial linux systems and got prominent via carrier gracde linux project. those are specialized / hardened distros for professionals and half-ass desktop/server distros like RHEL (for years) didn't make full use of kexec. OpenSUSE started like 3 years ago to skip the reboot after installing the OS. now in RHEL7 you can actually do it, too. I hope this kind of explains why kexec might have been there for 10 years but you couldn't just "use" it to do the 'fast reboot' it was intended for. May 1, 2015 at 11:27
  • 1
    I would say this most certainly does not satisfy the OP's requirement of "not rebooting." In fact it only shifts the burden of reboot to the user instead of the init/systemd scripts ... And more importantly, it should be noted this does not replace the entire kernel, it's only for applying patches to pieces of the kernel. Oct 3, 2015 at 20:30
1

Actually, I just re-read this Oracle Blog post:

https://blogs.oracle.com/wim/entry/fast_reboots_for_oracle_linux

So, as long as you use the UEK kernel, you can do the kexec fast reboot on OEL5 and OEL6. This is not related to ksplice (which is about not rebooting in the first place!) and not needed a license or anything to use.

3
  • 1
    Fast reboot is not the same as no reboot. Oct 3, 2015 at 20:30
  • The Oracle Blog pointed to by this answer explains how to setup kexec and how it works.
    – minghua
    Oct 7, 2015 at 5:29
  • "No reboot" is a different thing and has been available i.e. with ksplice for like 5 years. I used it on desktops @ work to make sure I don't have to reboot when I don't want to. Oct 15, 2015 at 9:17

You must log in to answer this question.

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