1DRACUT(8) dracut DRACUT(8)
2
3
4
6 dracut - low-level tool for generating an initramfs/initrd image
7
9 dracut [OPTION...] [<image> [<kernel version>]]
10
12 Create an initramfs <image> for the kernel with the version <kernel
13 version>. If <kernel version> is omitted, then the version of the
14 actual running kernel is used. If <image> is omitted or empty,
15 depending on bootloader specification, the default location can be
16 /efi/<machine-id>/<kernel-version>/initrd,
17 /boot/<machine-id>/<kernel-version>/initrd,
18 /boot/efi/<machine-id>/<kernel-version>/initrd,
19 /lib/modules/<kernel-version>/initrd or
20 /boot/initramfs-<kernel-version>.img.
21
22 dracut creates an initial image used by the kernel for preloading the
23 block device modules (such as IDE, SCSI or RAID) which are needed to
24 access the root filesystem, mounting the root filesystem and booting
25 into the real system.
26
27 At boot time, the kernel unpacks that archive into RAM disk, mounts and
28 uses it as initial root file system. All finding of the root device
29 happens in this early userspace.
30
31 Initramfs images are also called "initrd".
32
33 For a complete list of kernel command line options see
34 dracut.cmdline(7).
35
36 If you are dropped to an emergency shell, while booting your initramfs,
37 the file /run/initramfs/rdsosreport.txt is created, which can be saved
38 to a (to be mounted by hand) partition (usually /boot) or a USB stick.
39 Additional debugging info can be produced by adding rd.debug to the
40 kernel command line. /run/initramfs/rdsosreport.txt contains all logs
41 and the output of some tools. It should be attached to any report about
42 dracut problems.
43
45 To create a initramfs image, the most simple command is:
46
47 # dracut
48
49 This will generate a general purpose initramfs image, with all possible
50 functionality resulting of the combination of the installed dracut
51 modules and system tools. The image, depending on bootloader
52 specification, can be /efi/<machine-id>/<kernel-version>/initrd,
53 /boot/<machine-id>/<kernel-version>/initrd,
54 /boot/efi/<machine-id>/<kernel-version>/initrd,
55 /lib/modules/<kernel-version>/initrd or
56 /boot/initramfs-<kernel-version>.img and contains the kernel modules of
57 the currently active kernel with version <kernel-version>.
58
59 If the initramfs image already exists, dracut will display an error
60 message, and to overwrite the existing image, you have to use the
61 --force option.
62
63 # dracut --force
64
65 If you want to specify another filename for the resulting image you
66 would issue a command like:
67
68 # dracut foobar.img
69
70 To generate an image for a specific kernel version, the command would
71 be:
72
73 # dracut foobar.img 2.6.40-1.rc5.f20
74
75 A shortcut to generate the image at the default location for a specific
76 kernel version is:
77
78 # dracut --kver 2.6.40-1.rc5.f20
79
80 If you want to create lighter, smaller initramfs images, you may want
81 to specify the --hostonly or -H option. Using this option, the
82 resulting image will contain only those dracut modules, kernel modules
83 and filesystems, which are needed to boot this specific machine. This
84 has the drawback, that you can’t put the disk on another controller or
85 machine, and that you can’t switch to another root filesystem, without
86 recreating the initramfs image. The usage of the --hostonly option is
87 only for experts and you will have to keep the broken pieces. At least
88 keep a copy of a general purpose image (and corresponding kernel) as a
89 fallback to rescue your system.
90
91 Inspecting the Contents
92 To see the contents of the image created by dracut, you can use the
93 lsinitrd tool.
94
95 # lsinitrd | less
96
97 To display the contents of a file in the initramfs also use the
98 lsinitrd tool:
99
100 # lsinitrd -f /etc/ld.so.conf
101 include ld.so.conf.d/*.conf
102
103 Adding dracut Modules
104 Some dracut modules are turned off by default and have to be activated
105 manually. You can do this by adding the dracut modules to the
106 configuration file /etc/dracut.conf or /etc/dracut.conf.d/myconf.conf.
107 See dracut.conf(5). You can also add dracut modules on the command line
108 by using the -a or --add option:
109
110 # dracut --add module initramfs-module.img
111
112 To see a list of available dracut modules, use the --list-modules
113 option:
114
115 # dracut --list-modules
116
117 Omitting dracut Modules
118 Sometimes you don’t want a dracut module to be included for reasons of
119 speed, size or functionality. To do this, either specify the
120 omit_dracutmodules variable in the dracut.conf or
121 /etc/dracut.conf.d/myconf.conf configuration file (see dracut.conf(5)),
122 or use the -o or --omit option on the command line:
123
124 # dracut -o "multipath lvm" no-multipath-lvm.img
125
126 Adding Kernel Modules
127 If you need a special kernel module in the initramfs, which is not
128 automatically picked up by dracut, you have the use the --add-drivers
129 option on the command line or the drivers variable in the
130 /etc/dracut.conf or /etc/dracut.conf.d/myconf.conf configuration file
131 (see dracut.conf(5)):
132
133 # dracut --add-drivers mymod initramfs-with-mymod.img
134
135 Boot parameters
136 An initramfs generated without the "hostonly" mode, does not contain
137 any system configuration files (except for some special exceptions), so
138 the configuration has to be done on the kernel command line. With this
139 flexibility, you can easily boot from a changed root partition, without
140 the need to recompile the initramfs image. So, you could completely
141 change your root partition (move it inside a md raid with encryption
142 and LVM on top), as long as you specify the correct filesystem LABEL or
143 UUID on the kernel command line for your root device, dracut will find
144 it and boot from it.
145
146 The kernel command line can also be provided by the dhcp server with
147 the root-path option. See the section called “Network Boot”.
148
149 For a full reference of all kernel command line parameters, see
150 dracut.cmdline(7).
151
152 To get a quick start for the suitable kernel command line on your
153 system, use the --print-cmdline option:
154
155 # dracut --print-cmdline
156 root=UUID=8b8b6f91-95c7-4da2-831b-171e12179081 rootflags=rw,relatime,discard,data=ordered rootfstype=ext4
157
158 Specifying the root Device
159 This is the only option dracut really needs to boot from your root
160 partition. Because your root partition can live in various
161 environments, there are a lot of formats for the root= option. The
162 most basic one is root=<path to device node>:
163
164 root=/dev/sda2
165
166 Because device node names can change, dependent on the drive
167 ordering, you are encouraged to use the filesystem identifier
168 (UUID) or filesystem label (LABEL) to specify your root partition:
169
170 root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
171
172 or
173
174 root=LABEL=myrootpartitionlabel
175
176 To see all UUIDs or LABELs on your system, do:
177
178 # ls -l /dev/disk/by-uuid
179
180 or
181
182 # ls -l /dev/disk/by-label
183
184 If your root partition is on the network see the section called
185 “Network Boot”.
186
187 Keyboard Settings
188 If you have to input passwords for encrypted disk volumes, you
189 might want to set the keyboard layout and specify a display font.
190
191 A typical german kernel command line would contain:
192
193 rd.vconsole.font=eurlatgr rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
194
195 Setting these options can override the setting stored on your
196 system, if you use a modern init system, like systemd.
197
198 Blacklisting Kernel Modules
199 Sometimes it is required to prevent the automatic kernel module
200 loading of a specific kernel module. To do this, just add
201 rd.driver.blacklist=<kernel module name>, with <kernel module name>
202 not containing the .ko suffix, to the kernel command line. For
203 example:
204
205 rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
206
207 The option can be specified multiple times on the kernel command
208 line.
209
210 Speeding up the Boot Process
211 If you want to speed up the boot process, you can specify as much
212 information for dracut on the kernel command as possible. For
213 example, you can tell dracut, that you root partition is not on a
214 LVM volume or not on a raid partition, or that it lives inside a
215 specific crypto LUKS encrypted volume. By default, dracut searches
216 everywhere. A typical dracut kernel command line for a plain
217 primary or logical partition would contain:
218
219 rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
220
221 This turns off every automatic assembly of LVM, MD raids, DM raids
222 and crypto LUKS.
223
224 Of course, you could also omit the dracut modules in the initramfs
225 creation process, but then you would lose the possibility to turn
226 it on on demand.
227
228 Injecting custom Files
229 To add your own files to the initramfs image, you have several
230 possibilities.
231
232 The --include option let you specify a source path and a target path.
233 For example
234
235 # dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
236
237 will create an initramfs image, where the file cmdline-preset will be
238 copied inside the initramfs to /etc/cmdline.d/mycmdline.conf. --include
239 can only be specified once.
240
241 # mkdir -p rd.live.overlay/etc/cmdline.d
242 # mkdir -p rd.live.overlay/etc/conf.d
243 # echo "ip=dhcp" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
244 # echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
245 # echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
246 # tree rd.live.overlay/
247 rd.live.overlay/
248 `-- etc
249 |-- cmdline.d
250 | `-- mycmdline.conf
251 `-- conf.d
252 `-- testvar.conf
253
254 # dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
255
256 This will put the contents of the rd.live.overlay directory into the
257 root of the initramfs image.
258
259 The --install option let you specify several files, which will get
260 installed in the initramfs image at the same location, as they are
261 present on initramfs creation time.
262
263 # dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
264
265 This will create an initramfs with the strace, fsck.ext3 and ssh
266 executables, together with the libraries needed to start those. The
267 --install option can be specified multiple times.
268
269 Network Boot
270 If your root partition is on a network drive, you have to have the
271 network dracut modules installed to create a network aware initramfs
272 image.
273
274 If you specify ip=dhcp on the kernel command line, then dracut asks a
275 dhcp server about the ip address for the machine. The dhcp server can
276 also serve an additional root-path, which will set the root device for
277 dracut. With this mechanism, you have static configuration on your
278 client machine and a centralized boot configuration on your TFTP/DHCP
279 server. If you can’t pass a kernel command line, then you can inject
280 /etc/cmdline.d/mycmdline.conf, with a method described in the section
281 called “Injecting custom Files”.
282
283 Reducing the Image Size
284 To reduce the size of the initramfs, you should create it with by
285 omitting all dracut modules, which you know, you don’t need to boot
286 the machine.
287
288 You can also specify the exact dracut and kernel modules to produce
289 a very tiny initramfs image.
290
291 For example for a NFS image, you would do:
292
293 # dracut -m "nfs network base" initramfs-nfs-only.img
294
295 Then you would boot from this image with your target machine and
296 reduce the size once more by creating it on the target machine with
297 the --host-only option:
298
299 # dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
300
301 This will reduce the size of the initramfs image significantly.
302
304 If the boot process does not succeed, you have several options to debug
305 the situation.
306
307 Identifying your problem area
308 1. Remove 'rhgb' and 'quiet' from the kernel command line
309
310 2. Add 'rd.shell' to the kernel command line. This will present a
311 shell should dracut be unable to locate your root device
312
313 3. Add 'rd.shell rd.debug log_buf_len=1M' to the kernel command line
314 so that dracut shell commands are printed as they are executed
315
316 4. The file /run/initramfs/rdsosreport.txt is generated, which
317 contains all the logs and the output of all significant tools,
318 which are mentioned later.
319
320 If you want to save that output, simply mount /boot by hand or insert
321 an USB stick and mount that. Then you can store the output for later
322 inspection.
323
324 Information to include in your report
325 All bug reports
326 In all cases, the following should be mentioned and attached to
327 your bug report:
328
329 • The exact kernel command-line used. Typically from the
330 bootloader configuration file (e.g. /boot/grub2/grub.cfg) or
331 from /proc/cmdline.
332
333 • A copy of your disk partition information from /etc/fstab,
334 which might be obtained booting an old working initramfs or a
335 rescue medium.
336
337 • Turn on dracut debugging (see the debugging dracut section),
338 and attach the file /run/initramfs/rdsosreport.txt.
339
340 • If you use a dracut configuration file, please include
341 /etc/dracut.conf and all files in /etc/dracut.conf.d/*.conf
342
343 Network root device related problems
344 This section details information to include when experiencing
345 problems on a system whose root device is located on a network
346 attached volume (e.g. iSCSI, NFS or NBD). As well as the
347 information from the section called “All bug reports”, include the
348 following information:
349
350 • Please include the output of
351
352 # /sbin/ifup <interfacename>
353 # ip addr show
354
355 Debugging dracut
356 Configure a serial console
357 Successfully debugging dracut will require some form of console
358 logging during the system boot. This section documents configuring
359 a serial console connection to record boot messages.
360
361 1. First, enable serial console output for both the kernel and the
362 bootloader.
363
364 2. Open the file /boot/grub2/grub.cfg for editing. Below the line
365 'timeout=5', add the following:
366
367 serial --unit=0 --speed=9600
368 terminal --timeout=5 serial console
369
370 3. Also in /boot/grub2/grub.cfg, add the following boot arguments
371 to the 'kernel' line:
372
373 console=tty0 console=ttyS0,9600
374
375 4. When finished, the /boot/grub2/grub.cfg file should look
376 similar to the example below.
377
378 default=0
379 timeout=5
380 serial --unit=0 --speed=9600
381 terminal --timeout=5 serial console
382 title Fedora (2.6.29.5-191.fc11.x86_64)
383 root (hd0,0)
384 kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
385 initrd /dracut-2.6.29.5-191.fc11.x86_64.img
386
387 5. More detailed information on how to configure the kernel for
388 console output can be found at
389 http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
390
391 6. Redirecting non-interactive output
392
393 Note
394 You can redirect all non-interactive output to /dev/kmsg
395 and the kernel will put it out on the console when it
396 reaches the kernel buffer by doing
397
398 # exec >/dev/kmsg 2>&1 </dev/console
399
400 Using the dracut shell
401 dracut offers a shell for interactive debugging in the event dracut
402 fails to locate your root filesystem. To enable the shell:
403
404 1. Add the boot parameter 'rd.shell' to your bootloader
405 configuration file (e.g. /boot/grub2/grub.cfg)
406
407 2. Remove the boot arguments 'rhgb' and 'quiet'
408
409 A sample /boot/grub2/grub.cfg bootloader configuration file is
410 listed below.
411
412 default=0
413 timeout=5
414 serial --unit=0 --speed=9600
415 terminal --timeout=5 serial console
416 title Fedora (2.6.29.5-191.fc11.x86_64)
417 root (hd0,0)
418 kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
419 initrd /dracut-2.6.29.5-191.fc11.x86_64.img
420
421 3. If system boot fails, you will be dropped into a shell as seen
422 in the example below.
423
424 No root device found
425 Dropping to debug shell.
426
427 #
428
429 4. Use this shell prompt to gather the information requested above
430 (see the section called “All bug reports”).
431
432 Accessing the root volume from the dracut shell
433 From the dracut debug shell, you can manually perform the task of
434 locating and preparing your root volume for boot. The required
435 steps will depend on how your root volume is configured. Common
436 scenarios include:
437
438 • A block device (e.g. /dev/sda7)
439
440 • A LVM logical volume (e.g. /dev/VolGroup00/LogVol00)
441
442 • An encrypted device (e.g.
443 /dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83)
444
445 • A network attached device (e.g.
446 netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.example:for.all)
447
448 The exact method for locating and preparing will vary. However, to
449 continue with a successful boot, the objective is to locate your
450 root volume and create a symlink /dev/root which points to the file
451 system. For example, the following example demonstrates accessing
452 and booting a root volume that is an encrypted LVM Logical volume.
453
454 1. Inspect your partitions using parted
455
456 # parted /dev/sda -s p
457 Model: ATA HTS541060G9AT00 (scsi)
458 Disk /dev/sda: 60.0GB
459 Sector size (logical/physical): 512B/512B
460 Partition Table: msdos
461 Number Start End Size Type File system Flags
462 1 32.3kB 10.8GB 107MB primary ext4 boot
463 2 10.8GB 55.6GB 44.7GB logical lvm
464
465 2. You recall that your root volume was a LVM logical volume. Scan
466 and activate any logical volumes.
467
468 # lvm vgscan
469 # lvm vgchange -ay
470
471 3. You should see any logical volumes now using the command blkid:
472
473 # blkid
474 /dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
475 /dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
476 /dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
477 /dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
478 /dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
479
480 4. From the output above, you recall that your root volume exists
481 on an encrypted block device. Following the guidance disk
482 encryption guidance from the Installation Guide, you unlock
483 your encrypted root volume.
484
485 # UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
486 # cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
487 Enter passphrase for /dev/mapper/linux-root:
488 Key slot 0 unlocked.
489
490 5. Next, make a symbolic link to the unlocked root volume
491
492 # ln -s /dev/mapper/luks-$UUID /dev/root
493
494 6. With the root volume available, you may continue booting the
495 system by exiting the dracut shell
496
497 # exit
498
499 Additional dracut boot parameters
500 For more debugging options, see dracut.cmdline(7).
501
502 Debugging dracut on shutdown
503 To debug the shutdown sequence on systemd systems, you can rd.break
504 on pre-shutdown or shutdown.
505
506 To do this from an already booted system:
507
508 # mkdir -p /run/initramfs/etc/cmdline.d
509 # echo "rd.debug rd.break=pre-shutdown rd.break=shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
510 # touch /run/initramfs/.need_shutdown
511
512 This will give you a dracut shell after the system pivot’ed back in
513 the initramfs.
514
516 --kver <kernel version>
517 Set the kernel version. This enables to specify the kernel version,
518 without specifying the location of the initramfs image. For
519 example:
520
521 # dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
522
523 -f, --force
524 Overwrite existing initramfs file.
525
526 <output file> --rebuild
527 Append the current arguments to those with which the input
528 initramfs image was built. This option helps in incrementally
529 building the initramfs for testing. If optional <output file> is
530 not provided, the input initramfs provided to rebuild will be used
531 as output file.
532
533 -a, --add <list of dracut modules>
534 Add a space-separated list of dracut modules to the default set of
535 modules. This parameter can be specified multiple times.
536
537 Note
538 If the list has multiple arguments, then you have to put these
539 in quotes. For example:
540
541 # dracut --add "module1 module2" ...
542
543 --force-add <list of dracut modules>
544 Force to add a space-separated list of dracut modules to the
545 default set of modules, when -H is specified. This parameter can be
546 specified multiple times.
547
548 Note
549 If the list has multiple arguments, then you have to put these
550 in quotes. For example:
551
552 # dracut --force-add "module1 module2" ...
553
554 -o, --omit <list of dracut modules>
555 Omit a space-separated list of dracut modules. This parameter can
556 be specified multiple times.
557
558 Note
559 If the list has multiple arguments, then you have to put these
560 in quotes. For example:
561
562 # dracut --omit "module1 module2" ...
563
564 -m, --modules <list of dracut modules>
565 Specify a space-separated list of dracut modules to call when
566 building the initramfs. Modules are located in
567 /usr/lib/dracut/modules.d. This parameter can be specified multiple
568 times. This option forces dracut to only include the specified
569 dracut modules. In most cases the "--add" option is what you want
570 to use.
571
572 Note
573 If the list has multiple arguments, then you have to put these
574 in quotes. For example:
575
576 # dracut --modules "module1 module2" ...
577
578 -d, --drivers <list of kernel modules>
579 Specify a space-separated list of kernel modules to exclusively
580 include in the initramfs. The kernel modules have to be specified
581 without the ".ko" suffix. This parameter can be specified multiple
582 times.
583
584 Note
585 If the list has multiple arguments, then you have to put these
586 in quotes. For example:
587
588 # dracut --drivers "kmodule1 kmodule2" ...
589
590 --add-drivers <list of kernel modules>
591 Specify a space-separated list of kernel modules to add to the
592 initramfs. The kernel modules have to be specified without the
593 ".ko" suffix. This parameter can be specified multiple times.
594
595 Note
596 If the list has multiple arguments, then you have to put these
597 in quotes. For example:
598
599 # dracut --add-drivers "kmodule1 kmodule2" ...
600
601 --force-drivers <list of kernel modules>
602 See add-drivers above. But in this case it is ensured that the
603 drivers are tried to be loaded early via modprobe.
604
605 Note
606 If the list has multiple arguments, then you have to put these
607 in quotes. For example:
608
609 # dracut --force-drivers "kmodule1 kmodule2" ...
610
611 --omit-drivers <list of kernel modules>
612 Specify a space-separated list of kernel modules not to add to the
613 initramfs. The kernel modules have to be specified without the
614 ".ko" suffix. This parameter can be specified multiple times.
615
616 Note
617 If the list has multiple arguments, then you have to put these
618 in quotes. For example:
619
620 # dracut --omit-drivers "kmodule1 kmodule2" ...
621
622 --filesystems <list of filesystems>
623 Specify a space-separated list of kernel filesystem modules to
624 exclusively include in the generic initramfs. This parameter can be
625 specified multiple times.
626
627 Note
628 If the list has multiple arguments, then you have to put these
629 in quotes. For example:
630
631 # dracut --filesystems "filesystem1 filesystem2" ...
632
633 -k, --kmoddir <kernel directory>
634 Specify the directory, where to look for kernel modules.
635
636 --fwdir <dir>[:<dir>...]++
637 Specify additional directories, where to look for firmwares. This
638 parameter can be specified multiple times.
639
640 --libdirs <list of directories>
641 Specify a space-separated list of directories to look for libraries
642 to include in the generic initramfs. This parameter can be
643 specified multiple times.
644
645 Note
646 If the list has multiple arguments, then you have to put these
647 in quotes. For example:
648
649 # dracut --libdirs "dir1 dir2" ...
650
651 --kernel-cmdline <parameters>
652 Specify default kernel command line parameters.
653
654 --kernel-only
655 Only install kernel drivers and firmware files.
656
657 --no-kernel
658 Do not install kernel drivers and firmware files.
659
660 --early-microcode
661 Combine early microcode with ramdisk.
662
663 --no-early-microcode
664 Do not combine early microcode with ramdisk.
665
666 --print-cmdline
667 Print the kernel command line for the current disk layout.
668
669 --mdadmconf
670 Include local /etc/mdadm.conf file.
671
672 --nomdadmconf
673 Do not include local /etc/mdadm.conf file.
674
675 --lvmconf
676 Include local /etc/lvm/lvm.conf file.
677
678 --nolvmconf
679 Do not include local /etc/lvm/lvm.conf file.
680
681 --fscks <list of fsck tools>
682 Add a space-separated list of fsck tools, in addition to
683 dracut.conf's specification; the installation is opportunistic
684 (non-existing tools are ignored).
685
686 Note
687 If the list has multiple arguments, then you have to put these
688 in quotes. For example:
689
690 # dracut --fscks "fsck.foo barfsck" ...
691
692 --nofscks
693 Inhibit installation of any fsck tools.
694
695 --strip
696 Strip binaries in the initramfs (default).
697
698 --aggressive-strip
699 Strip more than just debug symbol and sections, for a smaller
700 initramfs build. The --strip option must also be specified.
701
702 --nostrip
703 Do not strip binaries in the initramfs.
704
705 --hardlink
706 Hardlink files in the initramfs (default).
707
708 --nohardlink
709 Do not hardlink files in the initramfs.
710
711 --prefix <dir>
712 Prefix initramfs files with the specified directory.
713
714 --noprefix
715 Do not prefix initramfs files (default).
716
717 -h, --help
718 Display help text and exit.
719
720 --debug
721 Output debug information of the build process.
722
723 -v, --verbose
724 Increase verbosity level (default is info(4)).
725
726 --version
727 Display version and exit.
728
729 -q, --quiet
730 Decrease verbosity level (default is info(4)).
731
732 -c, --conf <dracut configuration file>
733 Specify configuration file to use.
734
735 Default: /etc/dracut.conf
736
737 --confdir <configuration directory>
738 Specify configuration directory to use.
739
740 Default: /etc/dracut.conf.d
741
742 --tmpdir <temporary directory>
743 Specify temporary directory to use.
744
745 Default: /var/tmp
746
747 -r, --sysroot <sysroot directory>
748 Specify the sysroot directory to collect files from. This is useful
749 to create the initramfs image from a cross-compiled sysroot
750 directory. For the extra helper variables, see ENVIRONMENT below.
751
752 Default: empty
753
754 --sshkey <sshkey file>
755 SSH key file used with ssh-client module.
756
757 --logfile <logfile>
758 Logfile to use; overrides any setting from the configuration files.
759
760 Default: /var/log/dracut.log
761
762 -l, --local
763 Activates the local mode. dracut will use modules from the current
764 working directory instead of the system-wide installed modules in
765 /usr/lib/dracut/modules.d. This is useful when running dracut from
766 a git checkout.
767
768 -H, --hostonly
769 Host-only mode: Install only what is needed for booting the local
770 host instead of a generic host and generate host-specific
771 configuration.
772
773 Warning
774 If chrooted to another root other than the real root device,
775 use "--fstab" and provide a valid /etc/fstab.
776
777 -N, --no-hostonly
778 Disable host-only mode.
779
780 --hostonly-mode <mode>
781 Specify the host-only mode to use. <mode> could be one of "sloppy"
782 or "strict". In "sloppy" host-only mode, extra drivers and modules
783 will be installed, so minor hardware change won’t make the image
784 unbootable (e.g. changed keyboard), and the image is still portable
785 among similar hosts. With "strict" mode enabled, anything not
786 necessary for booting the local host in its current state will not
787 be included, and modules may do some extra job to save more space.
788 Minor change of hardware or environment could make the image
789 unbootable.
790
791 Default: sloppy
792
793 --hostonly-cmdline
794 Store kernel command line arguments needed in the initramfs.
795
796 --no-hostonly-cmdline
797 Do not store kernel command line arguments needed in the initramfs.
798
799 --no-hostonly-default-device
800 Do not generate implicit host devices like root, swap, fstab, etc.
801 Use "--mount" or "--add-device" to explicitly add devices as
802 needed.
803
804 --hostonly-i18n
805 Install only needed keyboard and font files according to the host
806 configuration (default).
807
808 --no-hostonly-i18n
809 Install all keyboard and font files available.
810
811 --hostonly-nics <list of nics>
812 Only enable listed NICs in the initramfs. The list can be empty, so
813 other modules can install only the necessary network drivers.
814
815 --persistent-policy <policy>
816 Use <policy> to address disks and partitions. <policy> can be any
817 directory name found in /dev/disk (e.g. "by-uuid", "by-label"), or
818 "mapper" to use /dev/mapper device names (default).
819
820 --fstab
821 Use /etc/fstab instead of /proc/self/mountinfo.
822
823 --add-fstab <filename>
824 Add entries of <filename> to the initramfs /etc/fstab.
825
826 --mount "<device> <mountpoint> <filesystem type> [<filesystem options>
827 [<dump frequency> [<fsck order>]]]"
828 Mount <device> on <mountpoint> with <filesystem type> in the
829 initramfs. <filesystem options>, <dump options> and <fsck order>
830 can be specified, see fstab manpage for the details. The default
831 <filesystem options> is "defaults". The default <dump frequency> is
832 "0". The default <fsck order> is "2".
833
834 --mount "<mountpoint>"
835 Like above, but <device>, <filesystem type> and <filesystem
836 options> are determined by looking at the current mounts.
837
838 --add-device <device>
839 Bring up <device> in initramfs, <device> should be the device name.
840 This can be useful in host-only mode for resume support when your
841 swap is on LVM or an encrypted partition. [NB --device can be used
842 for compatibility with earlier releases]
843
844 -i, --include <SOURCE> <TARGET>
845 Include the files in the SOURCE directory into the TARGET directory
846 in the final initramfs. If SOURCE is a file, it will be installed
847 to TARGET in the final initramfs. This parameter can be specified
848 multiple times.
849
850 -I, --install <file list>
851 Install the space separated list of files into the initramfs.
852
853 Note
854 If the list has multiple arguments, then you have to put these
855 in quotes. For example:
856
857 # dracut --install "/bin/foo /sbin/bar" ...
858
859 --install-optional <file list>
860 Install the space separated list of files into the initramfs, if
861 they exist.
862
863 --gzip
864 Compress the generated initramfs using gzip. This will be done by
865 default, unless another compression option or --no-compress is
866 passed. Equivalent to "--compress=gzip -9".
867
868 --bzip2
869 Compress the generated initramfs using bzip2.
870
871 Warning
872 Make sure your kernel has bzip2 decompression support compiled
873 in, otherwise you will not be able to boot. Equivalent to
874 "--compress=bzip2 -9".
875
876 --lzma
877 Compress the generated initramfs using lzma.
878
879 Warning
880 Make sure your kernel has lzma decompression support compiled
881 in, otherwise you will not be able to boot. Equivalent to
882 "--compress=lzma -9 -T0".
883
884 --xz
885 Compress the generated initramfs using xz.
886
887 Warning
888 Make sure your kernel has xz decompression support compiled in,
889 otherwise you will not be able to boot. Equivalent to
890 "--compress=xz --check=crc32 --lzma2=dict=1MiB -T0".
891
892 --lzo
893 Compress the generated initramfs using lzop.
894
895 Warning
896 Make sure your kernel has lzo decompression support compiled
897 in, otherwise you will not be able to boot. Equivalent to
898 "--compress=lzop -9".
899
900 --lz4
901 Compress the generated initramfs using lz4.
902
903 Warning
904 Make sure your kernel has lz4 decompression support compiled
905 in, otherwise you will not be able to boot. Equivalent to
906 "--compress=lz4 -l -9".
907
908 --zstd
909 Compress the generated initramfs using Zstandard.
910
911 Warning
912 Make sure your kernel has zstd decompression support compiled
913 in, otherwise you will not be able to boot. Equivalent to
914 "--compress=zstd -15 -q -T0".
915
916 --compress <compressor>
917 Compress the generated initramfs using the passed compression
918 program. If you pass it just the name of a compression program, it
919 will call that program with known-working arguments. If you pass a
920 quoted string with arguments, it will be called with exactly those
921 arguments. Depending on what you pass, this may result in an
922 initramfs that the kernel cannot decompress. The default value can
923 also be set via the INITRD_COMPRESS environment variable.
924
925 --squash-compressor <compressor>
926 Compress the squashfs image using the passed compressor and
927 compressor specific options for mksquashfs. You can refer to
928 mksquashfs manual for supported compressors and compressor specific
929 options. If squash module is not called when building the
930 initramfs, this option will not take effect.
931
932 --no-compress
933 Do not compress the generated initramfs. This will override any
934 other compression options.
935
936 --reproducible
937 Create reproducible images.
938
939 --no-reproducible
940 Do not create reproducible images.
941
942 --list-modules
943 List all available dracut modules.
944
945 -M, --show-modules
946 Print included module’s name to standard output during build.
947
948 --keep
949 Keep the initramfs temporary directory for debugging purposes.
950
951 --printsize
952 Print out the module install size.
953
954 --profile
955 Output profile information of the build process.
956
957 --ro-mnt
958 Mount / and /usr read-only by default.
959
960 -L, --stdlog <level>
961 [0-6] Specify logging level (to standard error).
962
963 0 - suppress any messages
964 1 - only fatal errors
965 2 - all errors
966 3 - warnings
967 4 - info
968 5 - debug info (here starts lots of output)
969 6 - trace info (and even more)
970
971 --regenerate-all
972 Regenerate all initramfs images at the default location with the
973 kernel versions found on the system. Additional parameters are
974 passed through.
975
976 -p, --parallel
977 Try to execute tasks in parallel. Currently only supported with
978 --regenerate-all (build initramfs images for all kernel versions
979 simultaneously).
980
981 --noimageifnotneeded
982 Do not create an image in host-only mode, if no kernel driver is
983 needed and no /etc/cmdline/*.conf will be generated into the
984 initramfs.
985
986 --loginstall <directory>
987 Log all files installed from the host to <directory>.
988
989 --uefi
990 Instead of creating an initramfs image, dracut will create an UEFI
991 executable, which can be executed by an UEFI BIOS. The default
992 output filename is
993 <EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi. <EFI>
994 might be /efi, /boot or /boot/efi depending on where the ESP
995 partition is mounted. The <BUILD_ID> is taken from BUILD_ID in
996 /usr/lib/os-release or if it exists /etc/os-release and is left
997 out, if BUILD_ID is non-existant or empty.
998
999 --no-uefi
1000 Disables UEFI mode.
1001
1002 --no-machineid
1003 Affects the default output filename of --uefi and will discard the
1004 <MACHINE_ID> part.
1005
1006 --uefi-stub <file>
1007 Specifies the UEFI stub loader, which will load the attached
1008 kernel, initramfs and kernel command line and boots the kernel. The
1009 default is
1010 $prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub.
1011
1012 --uefi-splash-image <file>
1013 Specifies the UEFI stub loader’s splash image. Requires bitmap
1014 (.bmp) image format.
1015
1016 --kernel-image <file>
1017 Specifies the kernel image, which to include in the UEFI
1018 executable. The default is /lib/modules/<KERNEL-VERSION>/vmlinuz or
1019 /boot/vmlinuz-<KERNEL-VERSION>.
1020
1021 --enhanced-cpio
1022 Attempt to use the dracut-cpio binary, which optimizes archive
1023 creation for copy-on-write filesystems by using the
1024 copy_file_range(2) syscall via Rust’s io::copy(). When specified,
1025 initramfs archives are also padded to ensure optimal data alignment
1026 for extent sharing. To retain reflink data deduplication benefits,
1027 this should be used alongside the --no-compress and --nostrip
1028 parameters, with initramfs source files, --tmpdir staging area and
1029 destination all on the same copy-on-write capable filesystem.
1030
1032 INITRD_COMPRESS
1033 sets the default compression program. See --compress.
1034
1035 DRACUT_LDCONFIG
1036 sets the ldconfig program path and options. Optional. Used for
1037 --sysroot.
1038
1039 Default: ldconfig
1040
1041 DRACUT_LDD
1042 sets the ldd program path and options. Optional. Used for
1043 --sysroot.
1044
1045 Default: ldd
1046
1047 DRACUT_TESTBIN
1048 sets the initially tested binary for detecting library paths.
1049 Optional. Used for --sysroot. In the cross-compiled sysroot, the
1050 default value (/bin/sh) is unusable, as it is an absolute symlink
1051 and points outside the sysroot directory.
1052
1053 Default: /bin/sh
1054
1055 DRACUT_INSTALL
1056 overrides path and options for executing dracut-install internally.
1057 Optional. Can be used to debug dracut-install while running the
1058 main dracut script.
1059
1060 Default: dracut-install
1061
1062 Example: DRACUT_INSTALL="valgrind dracut-install"
1063
1064 DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_LBZIP2,
1065 DRACUT_COMPRESS_LZMA, DRACUT_COMPRESS_XZ, DRACUT_COMPRESS_GZIP,
1066 DRACUT_COMPRESS_PIGZ, DRACUT_COMPRESS_LZOP, DRACUT_COMPRESS_ZSTD,
1067 DRACUT_COMPRESS_LZ4, DRACUT_COMPRESS_CAT
1068 overrides for compression utilities to support using them from
1069 non-standard paths.
1070
1071 Default values are the default compression utility names to be
1072 found in PATH.
1073
1074 DRACUT_ARCH
1075 overrides the value of uname -m. Used for --sysroot.
1076
1077 Default: empty (the value of uname -m on the host system)
1078
1079 SYSTEMD_VERSION
1080 overrides systemd version. Used for --sysroot.
1081
1082 SYSTEMCTL
1083 overrides the systemctl binary. Used for --sysroot.
1084
1085 NM_VERSION
1086 overrides the NetworkManager version. Used for --sysroot.
1087
1088 DRACUT_INSTALL_PATH
1089 overrides PATH environment for dracut-install to look for binaries
1090 relative to --sysroot. In a cross-compiled environment (e.g.
1091 Yocto), PATH points to natively built binaries that are not in the
1092 host’s /bin, /usr/bin, etc. dracut-install still needs plain /bin
1093 and /usr/bin that are relative to the cross-compiled sysroot.
1094
1095 Default: PATH
1096
1097 DRACUT_INSTALL_LOG_TARGET
1098 overrides DRACUT_LOG_TARGET for dracut-install. It allows running
1099 dracut-install* to run with different log target that dracut** runs
1100 with.
1101
1102 Default: DRACUT_LOG_TARGET
1103
1104 DRACUT_INSTALL_LOG_LEVEL
1105 overrides DRACUT_LOG_LEVEL for dracut-install. It allows running
1106 dracut-install* to run with different log level that dracut** runs
1107 with.
1108
1109 Default: DRACUT_LOG_LEVEL
1110
1112 /var/log/dracut.log
1113 logfile of initramfs image creation
1114
1115 /tmp/dracut.log
1116 logfile of initramfs image creation, if /var/log/dracut.log is not
1117 writable
1118
1119 /etc/dracut.conf
1120 see dracut.conf5
1121
1122 /etc/dracut.conf.d/*.conf
1123 see dracut.conf5
1124
1125 /usr/lib/dracut/dracut.conf.d/*.conf
1126 see dracut.conf5
1127
1128 Configuration in the initramfs
1129 /etc/conf.d/
1130 Any files found in /etc/conf.d/ will be sourced in the initramfs to
1131 set initial values. Command line options will override these values
1132 set in the configuration files.
1133
1134 /etc/cmdline
1135 Can contain additional command line options. Deprecated, better use
1136 /etc/cmdline.d/*.conf.
1137
1138 /etc/cmdline.d/*.conf
1139 Can contain additional command line options.
1140
1142 The dracut command is part of the dracut package and is available from
1143 https://github.com/dracutdevs/dracut
1144
1146 Harald Hoyer
1147
1148 Victor Lowther
1149
1150 Amadeusz Żołnowski
1151
1152 Hannes Reinecke
1153
1154 Daniel Molkentin
1155
1156 Will Woods
1157
1158 Philippe Seewer
1159
1160 Warren Togami
1161
1163 dracut.cmdline(7) dracut.conf(5) lsinitrd(1)
1164
1165
1166
1167dracut 44b18de 11/16/2023 DRACUT(8)