How do I get a script included in initramfs with dracut?
4
votes
2
answers
3666
views
I am using dracut to create an initramfs to test a script for creating a key
in the TPM chip. For now, this script is just a dummy script, so I can
see if I've created the initramfs correctly:
#!/usr/bin/env bash
#
read -p 'This file will run to initialize the TPM'
exit 0
I want to include this script in the pre-mount boot phase. I followed
the answer to the question "How to write a pre-mount startup script?" in
this forum, modifying it as necessary, but when I list the contents of the
image file, my scripts are not there. I also tried using the --include
and --install dracut options, but I either receive an error, or if I
don't, the scripts are not in the initramfs. I named my file tpm.img,
and placed it in the /boot directory. When booting the computer, I press
'e' to modify the grub line, and change the initrdefi command to point to
my tpm.img. Of course, my script doesn't run, because it's not present
in the initramfs. I'm not sure that I understand the "Injecting custom Files"
section of the dracut manual:
I haven't been able to find any examples of dracut configuration files or dracut command line files that show the complete path to the module to be included. Please help me understand why my script is not being included in the initramfs.
Thanks!
Jeff
Asked by Jeff
(41 rep)
Feb 1, 2021, 10:34 PM
Last activity: May 20, 2025, 03:02 PM
Last activity: May 20, 2025, 03:02 PM