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 -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
105 exclusively.
106
107 -c (--kexec-syscall)
108 Specify that the old KEXEC_LOAD syscall should be used exclu‐
109 sively (the default).
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.
117
118 KEXEC_FILE_LOAD is required on systems that use locked-down
119 secure boot to verify the kernel signature. KEXEC_LOAD may be
120 also disabled in the kernel configuration.
121
122 KEXEC_LOAD is required for some kernel image formats and on
123 architectures that do not implement KEXEC_FILE_LOAD.
124
125 -u (--unload)
126 Unload the current kexec target kernel. If a capture kernel is
127 being unloaded then specify -p with -u.
128
129 -v (--version)
130 Return the version number of the installed utility.
131
132 -x (--no-ifdown)
133 Shut down the running kernel, but restore the interface on
134 reload.
135
136 -y (--no-sync)
137 Shut down the running kernel, but skip syncing the filesystems.
138
139 --mem-min=addr
140 Specify the lowest memory address addr to load code into.
141
142 --mem-max=addr
143 Specify the highest memory address addr to load code into.
144
145 --entry=addr
146 Specify the jump back address. (0 means it's not jump back or
147 preserve context)
148
149 --load-preserve-context
150 Load the new kernel and preserve context of current kernel dur‐
151 ing kexec.
152
153 --load-jump-back-helper
154 Load a helper image to jump back to original kernel.
155
156 --reuseinitrd
157 Reuse initrd from first boot.
158
159 --print-ckr-size
160 Print crash kernel region size, if available.
161
162
163
165 Beoboot-x86
166
167 --args-elf
168 Pass ELF boot notes.
169
170 --args-linux
171 Pass Linux kernel style options.
172
173 --real-mode
174 Use the kernel's real mode entry point.
175
176 elf-x86
177
178 --append=string
179 Append string to the kernel command line.
180
181 --command-line=string
182 Set the kernel command line to string.
183
184 --reuse-cmdline
185 Use the command line from the running system. When a
186 panic kernel is loaded, it strips the crashkernel parame‐
187 ter automatically. The BOOT_IMAGE parameter is also
188 stripped.
189
190 --initrd=file
191 Use file as the kernel's initial ramdisk.
192
193 --ramdisk=file
194 Use file as the kernel's initial ramdisk.
195
196 bzImage-x86
197
198 --append=string
199 Append string to the kernel command line.
200
201 --command-line=string
202 Set the kernel command line to string.
203
204 --reuse-cmdline
205 Use the command line from the running system. When a
206 panic kernel is loaded, it strips the crashkernel parame‐
207 ter automatically. The BOOT_IMAGE parameter is also
208 stripped.
209
210 --initrd=file
211 Use file as the kernel's initial ramdisk.
212
213 --ramdisk=file
214 Use file as the kernel's initial ramdisk.
215
216 --real-mode
217 Use real-mode entry point.
218
219 multiboot-x86
220
221 --command-line=string
222 Set the kernel command line to string.
223
224 --reuse-cmdline
225 Use the command line from the running system. When a
226 panic kernel is loaded, it strips the crashkernel parame‐
227 ter automatically. The BOOT_IMAGE parameter is also
228 stripped.
229
230 --module=mod arg1 arg2 ...
231 Load module mod with command-line arguments arg1 arg2 ...
232 This parameter can be specified multiple times.
233
234
236 --console-serial
237 Enable the serial console.
238
239 --console-vga
240 Enable the VGA console.
241
242 --elf32-core-headers
243 Prepare core headers in ELF32 format.
244
245 --elf64-core-headers
246 Prepare core headers in ELF64 format.
247
248 --reset-vga
249 Attempt to reset a standard VGA device.
250
251 --serial=port
252 Specify the serial port for debug output.
253
254 --serial-baud=baud_rate
255 Specify the baud rate of the serial port.
256
257
258
259Linux April 2006 kexec(8)