1kexec(8) User Manuals kexec(8)
2
3
4
6 kexec - directly boot into a new kernel
7
9 /sbin/kexec [-v (--version)] [-f (--force)] [-x (--no-ifdown)] [-y
10 (--no-sync)] [-l (--load)] [-p (--load-panic)] [-u (--unload)] [-e
11 (--exec)] [-t (--type)] [--mem-min=addr] [--mem-max=addr]
12
13
15 kexec is a system call that enables you to load and boot into another
16 kernel from the currently running kernel. kexec performs the function
17 of the boot loader from within the kernel. The primary difference
18 between a standard system boot and a kexec boot is that the hardware
19 initialization normally performed by the BIOS or firmware (depending on
20 architecture) is not performed during a kexec boot. This has the effect
21 of reducing the time required for a reboot.
22
23 Make sure you have selected CONFIG_KEXEC=y when configuring the kernel.
24 The CONFIG_KEXEC option enables the kexec system call.
25
27 Using kexec consists of
28
29 (1) loading the kernel to be rebooted to into memory, and
30 (2) actually rebooting to the pre-loaded kernel.
31
32 To load a kernel, the syntax is as follows:
33
34 kexec -l kernel-image --append=command-line-options --ini‐
35 trd=initrd-image
36
37 where kernel-image is the kernel file that you intend to reboot to.
38
39 Insert the command-line parameters that must be passed to the new ker‐
40 nel into command-line-options. Passing the exact contents of
41 /proc/cmdline into command-line-options is the safest way to ensure
42 that correct values are passed to the rebooting kernel.
43
44 The optional initrd-image is the initrd image to be used during boot.
45
46 It's also possible to invoke kexec without an option parameter. In that
47 case, kexec loads the specified kernel and then invokes shutdown(8).
48 If the shutdown scripts of your Linux distribution support kexec-based
49 rebooting, they then call kexec -e just before actually rebooting the
50 machine. That way, the machine does a clean shutdown including all
51 shutdown scripts.
52
53
55 For example, if the kernel image you want to reboot to is
56 /boot/vmlinux, the contents of /proc/cmdline is root=/dev/hda1, and the
57 path to the initrd is /boot/initrd, then you would use the following
58 command to load the kernel:
59
60 kexec -l /boot/vmlinux --append=root=/dev/hda1 --ini‐
61 trd=/boot/initrd
62
63 After this kernel is loaded, it can be booted to at any time using the
64 command:
65
66 kexec -e
67
68
70 -d (--debug)
71 Enable debugging messages.
72
73 -S (--status)
74 Return 0 if the type (by default crash) is loaded. Can be used
75 in conjuction with -l or -p to toggle the type. Note this option
76 supersedes other options and it will not load or unload the ker‐
77 nel.
78
79 -e (--exec)
80 Run the currently loaded kernel. Note that it will reboot into
81 the loaded kernel without calling shutdown(8).
82
83 -f (--force)
84 Force an immediate kexec call, do not call shutdown(8) (contrary
85 to the default action without any option parameter). This option
86 performs the same actions like executing -l and -e in one call.
87
88 -h (--help)
89 Open a help file for kexec.
90
91 -l (--load) kernel
92 Load the specified kernel into the current kernel.
93
94 -p (--load-panic)
95 Load the new kernel for use on panic.
96
97 -t (--type=type)
98 Specify that the new kernel is of this type.
99
100 -s (--kexec-file-syscall)
101 Specify that the new KEXEC_FILE_LOAD syscall should be used
102 exclusively.
103
104 -c (--kexec-syscall)
105 Specify that the old KEXEC_LOAD syscall should be used exclu‐
106 sively (the default).
107
108 -a (--kexec-syscall-auto)
109 Try the new KEXEC_FILE_LOAD syscall first and when it is not
110 supported or the kernel does not understand the supplied image
111 fall back to the old KEXEC_LOAD interface.
112
113 There is no one single interface that always works.
114
115 KEXEC_FILE_LOAD is required on systems that use locked-down
116 secure boot to verify the kernel signature. KEXEC_LOAD may be
117 also disabled in the kernel configuration.
118
119 KEXEC_LOAD is required for some kernel image formats and on
120 architectures that do not implement KEXEC_FILE_LOAD.
121
122 -u (--unload)
123 Unload the current kexec target kernel. If a capture kernel is
124 being unloaded then specify -p with -u.
125
126 -v (--version)
127 Return the version number of the installed utility.
128
129 -x (--no-ifdown)
130 Shut down the running kernel, but restore the interface on
131 reload.
132
133 -y (--no-sync)
134 Shut down the running kernel, but skip syncing the filesystems.
135
136 --mem-min=addr
137 Specify the lowest memory address addr to load code into.
138
139 --mem-max=addr
140 Specify the highest memory address addr to load code into.
141
142 --entry=addr
143 Specify the jump back address. (0 means it's not jump back or
144 preserve context)
145
146 --load-preserve-context
147 Load the new kernel and preserve context of current kernel dur‐
148 ing kexec.
149
150 --load-jump-back-helper
151 Load a helper image to jump back to original kernel.
152
153 --reuseinitrd
154 Reuse initrd from first boot.
155
156 --print-ckr-size
157 Print crash kernel region size, if available.
158
159
160
162 Beoboot-x86
163
164 --args-elf
165 Pass ELF boot notes.
166
167 --args-linux
168 Pass Linux kernel style options.
169
170 --real-mode
171 Use the kernel's real mode entry point.
172
173 elf-x86
174
175 --append=string
176 Append string to the kernel command line.
177
178 --command-line=string
179 Set the kernel command line to string.
180
181 --reuse-cmdline
182 Use the command line from the running system. When a
183 panic kernel is loaded, it strips the crashkernel parame‐
184 ter automatically. The BOOT_IMAGE parameter is also
185 stripped.
186
187 --initrd=file
188 Use file as the kernel's initial ramdisk.
189
190 --ramdisk=file
191 Use file as the kernel's initial ramdisk.
192
193 bzImage-x86
194
195 --append=string
196 Append string to the kernel command line.
197
198 --command-line=string
199 Set the kernel command line to string.
200
201 --reuse-cmdline
202 Use the command line from the running system. When a
203 panic kernel is loaded, it strips the crashkernel parame‐
204 ter automatically. The BOOT_IMAGE parameter is also
205 stripped.
206
207 --initrd=file
208 Use file as the kernel's initial ramdisk.
209
210 --ramdisk=file
211 Use file as the kernel's initial ramdisk.
212
213 --real-mode
214 Use real-mode entry point.
215
216 multiboot-x86
217
218 --command-line=string
219 Set the kernel command line to string.
220
221 --reuse-cmdline
222 Use the command line from the running system. When a
223 panic kernel is loaded, it strips the crashkernel parame‐
224 ter automatically. The BOOT_IMAGE parameter is also
225 stripped.
226
227 --module=mod arg1 arg2 ...
228 Load module mod with command-line arguments arg1 arg2 ...
229 This parameter can be specified multiple times.
230
231
233 --console-serial
234 Enable the serial console.
235
236 --console-vga
237 Enable the VGA console.
238
239 --elf32-core-headers
240 Prepare core headers in ELF32 format.
241
242 --elf64-core-headers
243 Prepare core headers in ELF64 format.
244
245 --reset-vga
246 Attempt to reset a standard VGA device.
247
248 --serial=port
249 Specify the serial port for debug output.
250
251 --serial-baud=baud_rate
252 Specify the baud rate of the serial port.
253
254
255
256Linux April 2006 kexec(8)