# Upgrading Kernel without Reboot

## madcat87

Is there any way to Upgrade and Load the new kernel without Reboot?

----------

## das_leid

Hi madcat87,

http://user-mode-linux.sourceforge.net/ maybe is your friend.  It is used by Kernel developers. 

But you have to install it BEFORE you want to test out new kernels. 

AFAIK there is NO way to change to change a kernel without rebooting. What are you trying ?

Cheers,

Das_Leid

----------

## dsd

kexec does a 'quick reboot' into a new kernel (i.e. bypasses bios stage, loads one kernel from another)

----------

## ajnabi

Hi, I just came across the CONFIG_EXEC setting in  the kernel .config while recompiling the kernel.  This looks pretty slick.  I did a search and came across this post in the forum.  

Does any body have experience with this feature?

Is it reliable?

Is it secure? For instance, if I have a small firewall/router/portal checking itself every so often to verify integrity of the system in memory and it senses a malicious compromise, can exec reboot the system, faster, reloading a fresh system safely..., or are there some security risks here? 

FYI - I found a good description of kexec here:

http://www-128.ibm.com/developerworks/linux/library/l-kexec.html?ca=dgr-lnxw10RebootFast

----------

## nmbrthry

I just got it working tonight. You need to emerge kexec-tools in addition to setting CONFIG_EXEC=Y in your kernel config. Then do the following:

```
kexec -l /boot/vmlinuz --append="root=/dev/hde1"
```

where /boot/vmlinuz is the kernel image you want to use and the append string is your normal kernel command-line string. Then in /etc/init.d/reboot.sh, add

```
kexec -e
```

above the calls to /sbin/reboot. Don't remove the /sbin/reboot lines, so it will fallback to full reboot if you forget to run kexec -l. I tested this with gentoo-sources-2.6.13-r5 and gentoo-sources-2.6.14-r1 and it worked with both. I can't say anything about security.

----------

## dsd

use kexec-tools (in portage) which provides an init script to help out

you still need to modify reboot.sh yourself

perhaps the major pitfall with kexec is that it does not work with vesafb

----------

## nmbrthry

 *dsd wrote:*   

> use kexec-tools (in portage) which provides an init script to help out
> 
> you still need to modify reboot.sh yourself
> 
> perhaps the major pitfall with kexec is that it does not work with vesafb

 

The init scripts look nice. Is there (or will there ever be) an easy way to switch which kernel gets loaded? Something like "eselect kexec"?

----------

## Iron_DragonLord

Will this reset the system's uptime?

----------

