- allow running on a cross-compiled rootfs

  dracutsysrootdir is the root directory, file existence checks use it.

  DRACUT_LDCONFIG can override ldconfig with a different one that works
  on the sysroot with foreign binaries.

  DRACUT_LDD can override ldd with a different one that works
  with foreign binaries.

  DRACUT_TESTBIN can override /bin/sh. A cross-compiled sysroot
  may use symlinks that are valid only when running on the target
  so a real file must be provided that exist in the sysroot.

  DRACUT_INSTALL now supports debugging dracut-install in itself
  when run by dracut but without debugging the dracut scripts.
  E.g. DRACUT_INSTALL="valgrind dracut-install or
  DRACUT_INSTALL="dracut-install --debug".

  DRACUT_COMPRESS_CAT: All of the compression utilities may be
  overridden, to support the native binaries in non-standard places.

  DRACUT_ARCH overrides "uname -m".

  SYSTEMD_VERSION overrides "systemd --version".

  The dracut-install utility was overhauled to support sysroot via
  a new option -r and fixes for clang-analyze. It supports
  cross-compiler-ldd from

  DRACUT_INSTALL_PATH was introduced so dracut-install can work with
  a different PATH. In a cross-compiled environment (e.g. Yocto), PATH
  points to natively built binaries that are not in the host's /bin,
  /usr/bin, etc. dracut-install still needs plain /bin and /usr/bin
  that are relative to the cross-compiled sysroot.

  introduced so dracut-install can use different settings from

- don't call fsfreeze on subvol of root file system
- Use TMPDIR (typically /run/user/$UID) if available
- dracut.sh: add check for invalid configuration files
  Emit a warning about possible misconfigured configuration files, where
  the spaces around values are missing for +=""
- dracut-functions: fix find_binary() to return full path
- dracut.sh: FIPS workaround for openssl-libs on Fedora/RHEL
- dracut.sh: fix early microcode detection logic
- dracut.sh: fix ia32 detection for uefi executables
- dracut.sh: Add --version
- dracut.sh: Add --hostonly-nics option
- EFI Mode: only write kernel cmdline to UEFI binary
- Allow $DRACUT_INSTALL to be not an absolute path
- Don't print when a module is explicitly omitted (by default)
- Remove uses of bash (and bash specific syntax) in runtime scripts
- dracut-init.sh: Add a helper for detect device kernel modules
- dracut-functions.sh: Fix check_block_and_slaves_all
- dracut-functions.sh: add a helper to check if kernel module is available

- dracut.cmdline.7.asc: clarify usage of `rd.lvm.vg` and `rd.lvm.lv`
- dracut.conf.5.asc: document how to config --no-compress in the config
- fix CI badges in README.md and fix dracut description
- dracut.modules.7.asc: fix typos
- dracut.modules.7.asc: fix reference to insmodpost module
- Add --version to man page
- Adding code of conduct
- Document initqueue/online hook

- install: also install post weak dependencies of kernel modules
- install: Globbing support for resolving "firmware:"

- use vmlinux regex for ppc*, vmlinuz for i686

- fix i586 platform detection


- skip dependency add for non-existent units
- add missing cryptsetup-related targets

- simplify listing of supported utilities

- install dependant libs too
- Do not start inside container

- i18n: Always install /etc/vconsole.conf

- dhclient-script: Fix typo in output of  BOUND & BOUND6 cases
- simplify fallback dhcp setup

- ensure that nm-run.sh is executed when needed
- install libnss DNS and mDNS plugins
- always pull in machinery to read ifcfg files
- set kernel hostname from the command line
- move connection generation to a lib file

- fix glob matching ipv6 addresses
- net-lib.sh: support infiniband network mac addresses

- drop NSS if it's not in curl --version

- regenerate NetworkManager connections

- force preload btrfs module
- Install crypto modules in 90kernel-modules

- cryptroot-ask: no warn if /run/cryptsetup exist
- install crypto modules in 90kernel-modules
- try to catch kernel config changes
- fix force on multiple lines
- pull in remote-cryptsetup.target enablement
- cryptroot-ask: unify /etc/crypttab and rd.luks.key

- iso-scan.sh: Provide an easy reference to iso-scan device

- remove nfit from static module list (see nvdimm module)
- install crypto modules in 90kernel-modules
- add sg kernel module
- add pci_hyperv
- install block drivers more strictly
- install less modules for hostonly mode
- arm: add drivers/hwmon for arm/arm64

- on't install iscsi related module (use 95iscsi)

- remove unnecessary ${initdir} from lvm_scan.sh
- fix removal of pvscan from udev rules
- do not add newline to cmdline

- add automatic configuration for multipath
  (adds 'rd.multipath=default' to use the default config)
- install kpartx's 11-dm-parts.rules

- new module for NVDIMM support

- respect DRACUT_ARCH, don't exclude ppcle

- in hostonly mode, only install if network is needed
- install less module for strict hostonly mode

- parse-zipl.sh: honor SYSTEMD_READY

- pass rootflags to mount
- install new softdeps (sha512, gcm, ccm, aead2)

- only install /etc/dasd.conf if present

- fix script permissions

- fix pre-trigger stage by replacing exit with return in lldpad.sh
- default rd.nofcoe to false
- don't install if there is no FCoE hostonly devices

- fix missing space when compiling cmdline args
- fix ipv6 target discovery

- only install rpc services for NFS < 4 when hostonly is strict
- Change the order of NFS servers during the boot
  (next-server option has higher priority than DHCP-server itself)
- install less module if hostonly mode is strict

- add module for NVMe-oF
- add NVMe over TCP support

- do not resume on iSCSI, FCoE or NBD

- mount-root.sh: fix writing fstab file with missing fsck flag
- only write root argument for block device

- match simplified rd.zfcp format too

- parse-zfcp.sh: remove rule existence check

- add a rd.znet_ifname= option

- remove memtrace-ko and rd.memdebug=4 support in dracut
- remove cleanup_trace_mem calls
- dracut-initqueue: Print more useful info in case of timeout
- as of v246 of systemd "syslog" and "syslog-console" switches have been deprecated
- don't wait for root device if remote cryptsetup active

- dracut-lib.sh: quote variables in parameter expansion patterns
- remove memtrace-ko and rd.memdebug=4 support in dracut
- remove cleanup_trace_mem calls
- see new module 99memstrack
- prevent creating unexpected files on the host when running dracut

- memstrack is a new tool to track the overall memory usage and
  allocation, which can help off load the improve the builtin module
  memory tracing function in dracut.

- don't hardcode the squash sub directories
- improve pre-requirements check
- check require module earlier, and properly

new modules:
- nvmf
- watchdog-modules
- dbus
- network-wicked

removed modules:
- stratis

test suite:
- use dd from /dev/zero, instead of creating files with a hole
- TEST-03-USR-MOUNT/test.sh: increase loglevel
- TEST-12-RAID-DEG/create-root.sh: more udevadm settle
- TEST-35-ISCSI-MULTI: bump disk space
- TEST-41-NBD-NM/Makefile: should be based on TEST-40-NBD not TEST-20-NFS
- TEST-99: exclude /etc/dnf/* from check
4 files changed
tree: 88ce2a134c95387dd1ff17250c716c830ddcfca0
  1. .github/
  2. dracut.conf.d/
  3. examples/
  4. install/
  5. modules.d/
  6. skipcpio/
  7. test/
  8. .dir-locals.el
  9. .gitignore
  10. .kateconfig
  11. .kateproject
  12. .mailmap
  13. .travis.yml
  14. 50-dracut.install
  15. 51-dracut-rescue.install
  17. configure
  19. dracut-bash-completion.sh
  20. dracut-catimages.8.asc
  21. dracut-catimages.sh
  22. dracut-functions.sh
  23. dracut-init.sh
  24. dracut-initramfs-restore.sh
  25. dracut-logger.sh
  26. dracut.8.asc
  27. dracut.asc
  28. dracut.bootup.7.asc
  29. dracut.cmdline.7.asc
  30. dracut.conf
  31. dracut.conf.5.asc
  32. dracut.css
  33. dracut.logrotate
  34. dracut.modules.7.asc
  35. dracut.png
  36. dracut.sh
  37. dracut.spec
  38. dracut.svg
  39. dracut.usage.asc
  40. fedora-test-github.sh
  41. fedora-test.sh
  42. git2spec.pl
  44. logtee.c
  45. lsinitrd-bash-completion.sh
  46. lsinitrd.1.asc
  47. lsinitrd.sh
  48. Makefile
  49. mkinitrd-dracut.sh
  50. mkinitrd-suse.8.asc
  51. mkinitrd-suse.sh
  52. mkinitrd.8.asc
  53. NEWS
  55. profile.py
  56. README.cross
  57. README.generic
  58. README.kernel
  59. README.md
  60. README.modules
  61. README.testsuite
  62. TODO


dracut is an event driven initramfs infrastructure.

Contributor Covenant Build Status Fedora-31 Fedora-32

dracut (the tool) is used to create an initramfs image by copying tools and files from an installed system and combining it with the dracut framework, usually found in /usr/lib/dracut/modules.d.

Unlike other implementations, dracut hard-codes as little as possible into the initramfs. The initramfs has (basically) one purpose in life -- getting the rootfs mounted so that we can transition to the real rootfs. This is all driven off of device availability. Therefore, instead of scripts hard-coded to do various things, we depend on udev to create device nodes for us and then when we have the rootfs‘s device node, we mount and carry on. This helps to keep the time required in the initramfs as little as possible so that things like a 5 second boot aren’t made impossible as a result of the very existence of an initramfs.

Most of the initramfs generation functionality in dracut is provided by a bunch of generator modules that are sourced by the main dracut script to install specific functionality into the initramfs. They live in the modules.d subdirectory, and use functionality provided by dracut-functions to do their work.

Some general rules for writing modules:

  • Use one of the inst family of functions to actually install files on to the initramfs. They handle mangling the pathnames and (for binaries, scripts, and kernel modules) installing dependencies as appropriate so you do not have to.
  • Scripts that end up on the initramfs should be POSIX compliant. dracut will try to use /bin/dash as /bin/sh for the initramfs if it is available, so you should install it on your system -- dash aims for strict POSIX compliance to the extent possible.
  • Hooks MUST be POSIX compliant -- they are sourced by the init script, and having a bashism break your user's ability to boot really sucks.
  • Generator modules should have a two digit numeric prefix -- they run in ascending sort order. Anything in the 90-99 range is stuff that dracut relies on, so try not to break those hooks.
  • Hooks must have a .sh extension.
  • Generator modules are described in more detail in README.modules.
  • We have some breakpoints for debugging your hooks. If you pass ‘rdbreak’ as a kernel parameter, the initramfs will drop to a shell just before switching to a new root. You can pass ‘rdbreak=hookpoint’, and the initramfs will break just before hooks in that hookpoint run.

Also, there is an attempt to keep things as distribution-agnostic as possible. Every distribution has their own tool here and it's not something which is really interesting to have separate across them. So contributions to help decrease the distro-dependencies are welcome.

Currently dracut lives on github.com and kernel.org.

The tarballs can be found here: http://www.kernel.org/pub/linux/utils/boot/dracut/ ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/

Git: git://git.kernel.org/pub/scm/boot/dracut/dracut.git http://git.kernel.org/pub/scm/boot/dracut/dracut.git https://git.kernel.org/pub/scm/boot/dracut/dracut.git


Git Web: https://github.com/dracutdevs/dracut.git


Project Documentation: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html

Project Wiki: http://dracut.wiki.kernel.org

See the TODO file for things which still need to be done and HACKING for some instructions on how to get started. There is also a mailing list that is being used for the discussion -- initramfs@vger.kernel.org. It is a typical vger list, send mail to majordomo@vger.kernel.org with body of ‘subscribe initramfs email@host.com

Licensed under the GPLv2