public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] kexec
@ 2014-11-17  1:52 thegeezer
  2014-11-17  3:25 ` wraeth
  0 siblings, 1 reply; 4+ messages in thread
From: thegeezer @ 2014-11-17  1:52 UTC (permalink / raw
  To: gentoo-user

howdy folks,
i've had a bit of a hiatus of internet access and just catching up with 
mails i notice a recurring systemd related spark about boot times.  
please this message is not to recreate a flame but to suggest something 
that may benefit folks from all preferred init systems.

kexec is a great little utility.  when you run "/etc/init.d/kexec start" 
it creates references in the existing kernel for a soft reboot into a 
new kernel.  you can then at a time of your choosing run "reboot" and 
the system will appear to go through a clean shutdown cycle, but instead 
of triggering the power cycle, it will access the referenced kernel and 
initram and load them into memory as though we are just coming from the 
grub boot menu. the kernel image and initramfs must be visible at the 
time you choose to reboot.

from a forensics / debugging / kdump crash handling point of view this 
has great benefit because memory state remains the same when the system 
starts. (in fact for full access you need to use crash mode of "kexec 
-p" otherwise you overwrite bits when you boot and start services)

from a "reboot a remote computer into a new (tested?) kernel and initram 
in very little time" point of view this means you do not need to wait 
for bios / uefi / raid bios / 24 disk raid spinup cycle / 24GB memory 
test to complete.  sure if you are looking to reset faulty hardware like 
a stuck tape drive or graphics card this is not great.  however, as the 
new kernel need not be identical to the existing kernel, it does mean 
you can upgrade then reboot a lot faster.

using the tools manally is possible too -- /etc/init.d/kexec automounts 
boot and searches for the bits to use. you can do it manually by

## load a kernel and initram
kexec      -l /boot/vmlinux       --append=dolvm, root=/dev/vg/root 
--initrd=/boot/initrd

## reboot hard and fast into new kernel (warning does not go through 
shutdown so mounted fs acts as though you hit the reset button)
kexec      -e

let's say you have some remote or embedded systems that you want to 
upgrade the kernel for. if you have loadable modules you need to rsync 
/lib/modules/ otherwise you just need to scp the kernel and initram (if 
you have one) over then kexec it.  no more waiting for device reset 
scans, just reload the operating system with #/etc/init.d/kexec restart
followed by
# reboot

this is especially handy as grub2 has a few quirks regarding 'failsafe' 
menu choices, so doing things this way you can have grub2 still boot 
'actuallyworks-vmlinuz'  and then from ssh run kexec to 'testing-vmlinuz'

hope this has been interesting!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-17 19:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17  1:52 [gentoo-user] kexec thegeezer
2014-11-17  3:25 ` wraeth
2014-11-17  3:36   ` Rich Freeman
2014-11-17 19:38   ` thegeezer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox