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 be‐
18 tween a standard system boot and a kexec boot is that the hardware ini‐
19 tialization 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 /boot/vm‐
56 linux, the contents of /proc/cmdline is root=/dev/hda1, and the path to
57 the initrd is /boot/initrd, then you would use the following command to
58 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 1 if the type (by default crash) is loaded, 0 if not. Can
75 be used in conjuction with -l or -p to toggle the type. Note
76 this option supersedes other options and it will not load or un‐
77 load the kernel.
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 -i (--no-checks)
92 Fast reboot, no memory integrity checks.
93
94 -l (--load) kernel
95 Load the specified kernel into the current kernel.
96
97 -p (--load-panic)
98 Load the new kernel for use on panic.
99
100 -t (--type=type)
101 Specify that the new kernel is of this type.
102
103 -s (--kexec-file-syscall)
104 Specify that the new KEXEC_FILE_LOAD syscall should be used ex‐
105 clusively.
106
107 -c (--kexec-syscall)
108 Specify that the old KEXEC_LOAD syscall should be used exclu‐
109 sively.
110
111 -a (--kexec-syscall-auto)
112 Try the new KEXEC_FILE_LOAD syscall first and when it is not
113 supported or the kernel does not understand the supplied image
114 fall back to the old KEXEC_LOAD interface.
115
116 There is no one single interface that always works, so this is
117 the default.
118
119 KEXEC_FILE_LOAD is required on systems that use locked-down se‐
120 cure boot to verify the kernel signature. KEXEC_LOAD may be
121 also disabled in the kernel configuration.
122
123 KEXEC_LOAD is required for some kernel image formats and on ar‐
124 chitectures that do not implement KEXEC_FILE_LOAD.
125
126 -u (--unload)
127 Unload the current kexec target kernel. If a capture kernel is
128 being unloaded then specify -p with -u.
129
130 -v (--version)
131 Return the version number of the installed utility.
132
133 -x (--no-ifdown)
134 Shut down the running kernel, but restore the interface on
135 reload.
136
137 -y (--no-sync)
138 Shut down the running kernel, but skip syncing the filesystems.
139
140 --mem-min=addr
141 Specify the lowest memory address addr to load code into.
142
143 --mem-max=addr
144 Specify the highest memory address addr to load code into.
145
146 --entry=addr
147 Specify the jump back address. (0 means it's not jump back or
148 preserve context)
149
150 --load-preserve-context
151 Load the new kernel and preserve context of current kernel dur‐
152 ing kexec.
153
154 --load-jump-back-helper
155 Load a helper image to jump back to original kernel.
156
157 --reuseinitrd
158 Reuse initrd from first boot.
159
160 --print-ckr-size
161 Print crash kernel region size, if available.
162
163
164
166 Beoboot-x86
167
168 --args-elf
169 Pass ELF boot notes.
170
171 --args-linux
172 Pass Linux kernel style options.
173
174 --real-mode
175 Use the kernel's real mode entry point.
176
177 elf-x86
178
179 --append=string
180 Append string to the kernel command line.
181
182 --command-line=string
183 Set the kernel command line to string.
184
185 --reuse-cmdline
186 Use the command line from the running system. When a
187 panic kernel is loaded, it strips the crashkernel parame‐
188 ter automatically. The BOOT_IMAGE parameter is also
189 stripped.
190
191 --initrd=file
192 Use file as the kernel's initial ramdisk.
193
194 --ramdisk=file
195 Use file as the kernel's initial ramdisk.
196
197 bzImage-x86
198
199 --append=string
200 Append string to the kernel command line.
201
202 --command-line=string
203 Set the kernel command line to string.
204
205 --reuse-cmdline
206 Use the command line from the running system. When a
207 panic kernel is loaded, it strips the crashkernel parame‐
208 ter automatically. The BOOT_IMAGE parameter is also
209 stripped.
210
211 --initrd=file
212 Use file as the kernel's initial ramdisk.
213
214 --ramdisk=file
215 Use file as the kernel's initial ramdisk.
216
217 --real-mode
218 Use real-mode entry point.
219
220 multiboot-x86
221
222 --command-line=string
223 Set the kernel command line to string.
224
225 --reuse-cmdline
226 Use the command line from the running system. When a
227 panic kernel is loaded, it strips the crashkernel parame‐
228 ter automatically. The BOOT_IMAGE parameter is also
229 stripped.
230
231 --module=mod arg1 arg2 ...
232 Load module mod with command-line arguments arg1 arg2 ...
233 This parameter can be specified multiple times.
234
235 multiboot2-x86
236
237 --command-line=string
238 Set the kernel command line to string.
239
240 --reuse-cmdline
241 Use the command line from the running system. When a
242 panic kernel is loaded, it strips the crashkernel parame‐
243 ter automatically. The BOOT_IMAGE parameter is also
244 stripped.
245
246 --module=mod arg1 arg2 ...
247 Load module mod with command-line arguments arg1 arg2 ...
248 This parameter can be specified multiple times.
249
250 elf-ppc64
251
252 --reuse-cmdline
253 Use the kernel command line from the running system.
254
255 --command-line=string
256 Set the kernel command line to string.
257
258 --append=string
259 Set the kernel command line to string.
260
261 --ramdisk=file
262 Use file as the initial RAM disk.
263
264 --initrd=file
265 Use file as the initial RAM disk.
266
267 --devicetreeblob=file
268 Specify device tree blob file. Not applicable while using
269 --kexec-file-syscall.
270
271 --dtb=file
272 Specify device tree blob file. Not applicable while using
273 --kexec-file-syscall.
274
275
277 --console-serial
278 Enable the serial console.
279
280 --console-vga
281 Enable the VGA console.
282
283 --elf32-core-headers
284 Prepare core headers in ELF32 format.
285
286 --elf64-core-headers
287 Prepare core headers in ELF64 format.
288
289 --reset-vga
290 Attempt to reset a standard VGA device.
291
292 --serial=port
293 Specify the serial port for debug output.
294
295 --serial-baud=baud_rate
296 Specify the baud rate of the serial port.
297
298 --dt-no-old-root
299 Do not reuse old kernel root=<device> param while creating flat‐
300 ten device tree.
301
302
303
304Linux April 2006 kexec(8)