1. kexec/kdump: reboot rapid si
,
debug postmortem
Matei Conovici
mconovici@gmail.com
RLUG Meeting, Decembrie 2009
2. kexec
• apel sistem pentru ˆ arcarea ˆ memorie si lansarea ˆ executie
ınc˘ ın , ın ,
a unui nou kernel, f˘r˘ a restarta sistemul ˆ modul traditional
a a ın ,
• utilitar pentru controlul acestei facilit˘ti
a,
# kexec -l /vmlinuz --initrd=/initrd.img --reuse-cmdline
# kexec -e
kexec/kdump: reboot rapid si debug postmortem
Matei Conovici
, 1
RLUG Meeting, Decembrie 2009
3. Sumar al optiunilor:
,
scrat:~# kexec -h
Usage: kexec [OPTION]... [kernel]
Directly reboot into a new kernel
-h, --help Print this help.
-v, --version Print the version of kexec.
-f, --force Force an immediate kexec,
don’t call shutdown.
-l, --load Load the new kernel into the
current kernel.
-p, --load-panic Load the new kernel for use on panic.
-u, --unload Unload the current kexec target kernel.
-e, --exec Execute a currently loaded kernel.
1-1
4. Supported kernel file types and options:
elf-x86
--append=STRING Set the kernel command line to STRING
--reuse-cmdline Use kernel command line from running
system.
--initrd=FILE Use FILE as the kernel’s initial ramdisk.
--args-linux Pass linux kernel style options
--args-elf Pass elf boot notes
Architecture options:
--serial=<port> Specify the serial port for
debug output
--serial-baud=<baud_rate> Specify the serial port baud rate
--console-vga Enable the vga console
--console-serial Enable the serial console
1-2
5. Utilizare
• ˆ Debian GNU/Linux, pachetul kexec-tools instaleaz˘ scrip-
In a
turile de init necesare pentru reboot
• ˆ /etc/default/kexec se alege dac˘ la reboot se foloseste kexec
In a ,
# Load a kexec kernel (true/false)
LOAD KEXEC=true
kexec/kdump: reboot rapid si debug postmortem
Matei Conovici
, 2
RLUG Meeting, Decembrie 2009
6. Pro/Con
• Se evit˘ timpii morti la boot, mai ales cu unele BIOS-uri
a ,
enervante
• Nu toate driverele pot s˘ aduc˘ dispozitivele ˆ
a a ıntr-o stare sufi-
cient de consistent˘ pentru a porni “la cald”
a
kexec/kdump: reboot rapid si debug postmortem
Matei Conovici
, 3
RLUG Meeting, Decembrie 2009
7. kdump
• ˆ cazul unei erori fatale ˆ kernel, ˆ loc de halt sau reboot
In ın ın
acesta poate apela kexec pentru a lansa un nou kernel
• Noul kernel ruleaz˘ ˆ
a ıntr-un spatiu de memorie rezervat in pre-
,
alabil
• Dup˘ pornire se poate investiga continutul memoriei RAM a
a ,
kernelului anterior
kexec/kdump: reboot rapid si debug postmortem
Matei Conovici
, 4
RLUG Meeting, Decembrie 2009
8. kdump
• Kernel-ul ”standard” trebuie s˘ rezerve spatiu pentru ”dump-
a ,
capture” kernel
append="... crashkernel=64M@16M ..."
• Se ˆ
ıncarc˘ ˆ memorie kernelul ”dump-capture”
a ın
# kexec -p /vmlinuz --initrd=/initrd.img --reuse-cmdline
• Se asteapt˘ urm˘torul PANIC :-)
, a a
• Continutul memoriei RAM este expus ˆ /proc/vmcore sau
, ın
/dev/oldmem
kexec/kdump: reboot rapid si debug postmortem
Matei Conovici
, 5
RLUG Meeting, Decembrie 2009
9. kdump
• Cˆteva optiuni necesare ˆ configuratia kernel-ului:
a , ın ,
CONFIG KEXEC, CONFIG CRASH DUMP, CONFIG PROC VMCORE ...
• Vezi /usr/src/linux/Documentation/kdump/kdump.txt
kexec/kdump: reboot rapid si debug postmortem
Matei Conovici
, 6
RLUG Meeting, Decembrie 2009